         
         containerView.addSubview(fromImageViewCopy)
         
-        fromVCSnapshot.layer.anchorPoint = CGPoint(x: fromImageViewCopy.center.x/containerView.frame.size.width, y: fromImageViewCopy.center.y/containerView.frame.size.height)
-        fromVCSnapshot.layer.position = fromImageViewCopy.center
-
-        let transforms = transformsForZoom(type, toFrame: toImageViewFrame, fromFrame: fromImageViewCopy.frame)
+        let fromAnchorPoint = CGPoint(x: fromImageViewCopy.center.x/containerView.frame.size.width, y: fromImageViewCopy.center.y/containerView.frame.size.height)
+        let toAnchorPoint = CGPoint(x: toImageViewFrame.midX/containerView.frame.size.width, y: toImageViewFrame.midY/containerView.frame.size.height)
+        let transforms = transformsForZoom(withType: type, toFrame: toImageViewFrame, fromFrame: fromImageViewCopy.frame)
+        
+        setAnchorPoint(fromAnchorPoint, forView: fromView)
+        setAnchorPoint(toAnchorPoint, forView: toView)
         
         toView.transform = transforms.to
-
+        
         self.animate(withTransitionContext: transitionContext, animations: {
             fromImageViewCopy.frame = toImageViewFrame
-            fromVCSnapshot.alpha = 0
-            fromVCSnapshot.transform = transforms.from
-            toView.transform = CGAffineTransform.identity
+            fromView.alpha = 0
+            fromView.transform = transforms.from
+            toView.transform = .identity
         }) { (completed) in
             toView.layer.position = toView.center
-            fromView.isHidden = false
+            fromView.alpha = 1
+            fromView.transform = .identity
             fromImageViewCopy.removeFromSuperview()
-            fromVCSnapshot.removeFromSuperview()
+            fromView.removeFromSuperview()
             
             if tabBar != nil { // Animate the tab bar after animation
                 self.animate(withTransitionContext: transitionContext, animations: {


    }
    
    fileprivate func transformsForZoom(_ type: JKHImageZoomType, toFrame: CGRect, fromFrame: CGRect) -> (from: CGAffineTransform, to: CGAffineTransform) {
        let fromFrameAspectRatio = fromFrame.width / fromFrame.height
        let toFrameCenter = CGPoint(x: toFrame.midX, y: toFrame.midY)
        let fromFrameCenter = CGPoint(x: fromFrame.midX, y: fromFrame.midY)

            toVC = (toVC as! UITabBarController).selectedViewController!
        }
        
        containerView.backgroundColor = backgroundColor
        containerView.addSubview(toView)
        containerView.addSubview(fromView)
        
        toView.setNeedsLayout()
        toView.layoutIfNeeded()
        
