         
         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

        transitionView.isHidden = true
        
        let bgView = UIView()
        bgView.backgroundColor = fromViewController.view.backgroundColor
        bgView.frame = transitionView.bounds
        transitionView.addSubview(bgView)
        
        toViewController.view.updateConstraints()
        toViewController.view.setNeedsLayout()
        toViewController.view.layoutIfNeeded()
        
        for toView in toViews {
            for fromView in fromViews {
                if toView.motionTransitionIdentifier == fromView.motionTransitionIdentifier {
                    var t: TimeInterval = 0
                    var d: TimeInterval = 0
                    var snapshotAnimations = [CABasicAnimation]()
                    var snapshotChildAnimations = [CABasicAnimation]()
                    var tf = MotionAnimationTimingFunction.easeInEaseOut
                    
                    for ta in toView.motionTransitionAnimations {
                        switch ta {
                        case let .delay(time):
                            if time > delay {

    }
}

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