 
         let containerView = transitionContext.containerView()!
 
-        guard let startingView = startingView else {
+        var _startingViewForAnimation: UIView? = self.startingViewForAnimation
+        var _endingViewForAnimation: UIView? = self.startingViewForAnimation
+
+        if _startingViewForAnimation == nil {
+            if let startingView = startingView {
+                _startingViewForAnimation = PhotoTransitionAnimator.newAnimationViewFromView(startingView)
+            }
+        }
+
+        if _endingViewForAnimation == nil {
+            if let endingView = endingView {
+                _endingViewForAnimation = PhotoTransitionAnimator.newAnimationViewFromView(endingView)
+            }
+        }
+
+        guard let startingViewForAnimation = _startingViewForAnimation else {
             return
         }
-        guard let endingView = endingView else {
+        guard let endingViewForAnimation = _endingViewForAnimation else {
             return
         }
 
-        let startingViewForAnimation = self.startingViewForAnimation ?? PhotoTransitionAnimator.newAnimationViewFromView(startingView)
-        let endingViewForAnimation = self.startingViewForAnimation ?? PhotoTransitionAnimator.newAnimationViewFromView(endingView)
-
-        let finalEndingViewTransform = endingView.transform
+        let finalEndingViewTransform = endingView?.transform
 
         let endingViewInitialTransform = startingViewForAnimation.frame.height / endingViewForAnimation.frame.height
 
-        let translatedStartingViewCenter = PhotoTransitionAnimator.centerPointForView(startingView, translatedToContainerView: containerView)
-
-        startingViewForAnimation.center = translatedStartingViewCenter
+        if let startingView = startingView {
+            let translatedStartingViewCenter = PhotoTransitionAnimator.centerPointForView(startingView, translatedToContainerView: containerView)
+            startingViewForAnimation.center = translatedStartingViewCenter
+            endingViewForAnimation.center = translatedStartingViewCenter
+        }
 
         endingViewForAnimation.transform = CGAffineTransformScale(endingViewForAnimation.transform, endingViewInitialTransform, endingViewInitialTransform)
-        endingViewForAnimation.center = translatedStartingViewCenter
         endingViewForAnimation.alpha = 0
 
         containerView.addSubview(startingViewForAnimation)
         containerView.addSubview(endingViewForAnimation)
 
-        startingView.alpha = 0
-        endingView.alpha = 0
+        startingView?.alpha = 0
+        endingView?.alpha = 0
 
         let fadeInDuration = transitionDuration(transitionContext) * animationDurationEndingViewFadeInRatio
         let fadeOutDuration = transitionDuration(transitionContext) * animationDurationStartingViewFadeOutRatio

            viewToFade?.alpha = endingAlpha

        }, completion: { [unowned self] finished in
            if self.shouldPerformZoomingAnimation {
                self.completeTransitionWithTransitionContext(transitionContext)
            }
        })

        })

        let startingViewFinalTransform = 1.0 / endingViewInitialTransform

        var translatedEndingViewFinalCenter: CGPoint?
        if let endingView = endingView {
            translatedEndingViewFinalCenter = PhotoTransitionAnimator.centerPointForView(endingView, translatedToContainerView: containerView)
        }

        UIView.animateWithDuration(transitionDuration(transitionContext), delay: 0, usingSpringWithDamping: zoomingAnimationSpringDamping, initialSpringVelocity: 0, options: [.AllowAnimatedContent, .BeginFromCurrentState], animations: {

            if let finalEndingViewTransform = finalEndingViewTransform {
                endingViewForAnimation.transform = finalEndingViewTransform
            }

            if let translatedEndingViewFinalCenter = translatedEndingViewFinalCenter {
                endingViewForAnimation.center = translatedEndingViewFinalCenter
            }
            
            startingViewForAnimation.transform = CGAffineTransformScale(startingViewForAnimation.transform, startingViewFinalTransform, startingViewFinalTransform)

            if let translatedEndingViewFinalCenter = translatedEndingViewFinalCenter {
                startingViewForAnimation.center = translatedEndingViewFinalCenter
            }

        }, completion: { [unowned self] finished in
            endingViewForAnimation.removeFromSuperview()
            self.endingView?.alpha = 1
            self.startingView?.alpha = 1

            self.completeTransitionWithTransitionContext(transitionContext)
        })
