ios - UIView scale animation overshoots when changed -
when animate change view's transform, reset change in animation before first animation finishes, everything's great (shown here rotation). animation smoothly switches new target:
but when scale, animation overshoots magnificently:
here's breaking code:
uiview.animatewithduration(1) { self.someview.layer.transform = catransform3dmakescale(0.001, 0.001, 1) } uiview.animatewithduration(1, delay: 0.5, options: nil, animations: { self.someview.layer.transform = catransform3didentity }, completion: nil )
has else seen this? doing wrong?
edit: , there workaround?
edit 2: believe duplicate of this question , voting close.
this blog post provides answer: in ios 8, uiview animations additive, , has unfortunate result scale animations.
basically, second animation happens together with first animation. solution explicitly remove original animation before starting new one:
view.layer.transform = view.layer.presentationlayer().transform view.layer.removeallanimations()
Comments
Post a Comment