         
         let d = transitionDuration(using: transitionContext)
         
-        if let v = toViewController.view.backgroundColor {
-            bgView.motion(.backgroundColor(v), .duration(d))
+        if let v = toView.backgroundColor {
+            backgroundView.motion(.backgroundColor(v), .duration(d))
         }
         
         Motion.delay(d) { [weak self] in

                        }
                    }
                    
                    let b = toView.bounds
                    let w = b.width
                    let h = b.height
                    let p = toView.superview?.convert(toView.position, to: nil) ?? toView.position
                    snapshotAnimations.append(Motion.position(x: p.x, y: p.y))
                    
                    let sizeAnimation = Motion.size(CGSize(width: w, height: h))
                    snapshotAnimations.append(sizeAnimation)
                    
                    snapshotChildAnimations.append(Motion.position(x: w / 2, y:  h / 2))
                    snapshotChildAnimations.append(sizeAnimation)
                    
                    snapshotAnimations.append(Motion.rotate(angle: toView.motionRotationAngle))
                    
                    let cornerRadiusAnimation = Motion.corner(radius: toView.cornerRadius)
                    snapshotAnimations.append(cornerRadiusAnimation)
                    snapshotChildAnimations.append(cornerRadiusAnimation)
                    
                    let snapshot = transitionView.snapshot(view: fromView, afterUpdates: true)
                    
                    Motion.delay(t) {
                        for ta in toView.motionTransitionAnimations {
                            switch ta {
                            case let .timingFunction(timingFunction):
                                tf = timingFunction

    }
}

open class MotionTransition: NSObject {
    open var isPresenting = false
    
    open var toViewController: UIViewController!
