There is an animation to increase the picture, and how to do the opposite decrease

UIView.animateWithDuration(transitionDuration(transitionContext), animations: { snapshotView.transform = CGAffineTransformMakeScale(1.5, 1.5); }, completion: { finished -> Void in snapshotView.transform = CGAffineTransformMakeScale(1.0, 1.0) }) 
  • transfer values ​​less than 1.0 (for example 0.5) to makeScale - Max Mikheyenko 6:38 pm
  • Thank you) And now I’m only reducing it in one direction (to the right), can a decrease be made to the left? - Leci
  • one
    view.layer has an anchorPoint property; it sets the anchor point. put it at 0.5-0.5 (center) and then the reduction should leave your object in the same place. It is advisable to change the anchor point before adding your view to the screen (if you do it later, the view will move around the screen) - Max Mikheyenko
  • Thanks for the help) - Leci

1 answer 1

to reduce, you need to pass values ​​less than 1.0 (for example 0.5) to makeScale.

at the same time, a decrease will occur relative to the anchor point (the upper left corner by default). To change this: view.layer has an anchorPoint property; it sets the anchor point. put it at 0.5-0.5 (center) and then the reduction should leave your object in the same place. change the anchor point is desirable to do before adding your twist on the screen (if you do this later, twist will move around the screen)