                         print("off screen for next image")
                         self.animator?.removeAllBehaviors()
                         self.isZoomMode = false;
+                        
+                        // hide the last original image to avoid flickering
+                        self.imageView.image = nil
+                        
                         self.loadNextImage()
+
+                        
                         self.imageView.transform = self.normalTransform
                         self.imageView.center = CGPoint(x: self.initialCenterX, y: self.initialCenterY)
                            self.isImageTransition = false

        view.addGestureRecognizer(tapRecognizer)
        
        
   
        
        
        

                */
                
                
                UIView.animate(withDuration: 0.5,
                               delay: 0,
                               usingSpringWithDamping: 0.8,
                               initialSpringVelocity: 0,
