     }
     
     public func animationDidStop(_ anim: CAAnimation, finished flag: Bool) {
-        if let transform = desTransform, flag {
+        if flag {
             CATransaction.begin()
             CATransaction.setDisableActions(true)
-            bgLayer.transform = transform
+            bgLayer.transform = desTransform
             bgLayer.removeAllAnimations()
             CATransaction.commit()
             let activeView = stepViews[currStep]

    private func animate() {
        let originTransform = (bgLayer.presentation() ?? bgLayer).transform
        desTransform = CATransform3DInvert(stepViews[currStep].si.transform3D)
        let animation = CABasicAnimation()
        animation.delegate = self
        animation.isRemovedOnCompletion = false

        }
    }
    
    private var bgLayer: CATransformLayer = {
       let layer = CATransformLayer()
        return layer
    }()
    private var scaleX: CGFloat = 1.0
    private var scaleY: CGFloat = 1.0
    
