THE PROBLEM
Running the same code on iOS10 and iOS11 my UIViewPropertyAnimator has a different behaviour just after changing of his .isReversed
property.
Everything is ok on iOS10. The animation problem happens on iOS11
CONDITIONS
It's true for any animations, not only for a particular one, and it is verifiable both by watching the animation and within the code.
It happens both on simulators and real devices.
DETAILS
Once created a UIViewPropertyAnimator with his animation, during its running I just call .pauseAnimation()
and change the .isReversed
property to true. After that I resume the animation calling:
continueAnimation(withTimingParameters parameters: UITimingCurveProvider?, durationFactor: CGFloat)
at this point on iOS10 the animation smoothly changes his verse, on iOS11 it stops immediately and reverses itself with a bit frames lag.
If in code I check the value of .fractionComplete
(called on my UIViewPropertyAnimator object it gives me back the completion of the animation in his percent value, starting from 0.0 and ending at 1.0)
just after .continueAnimation(...
- On iOS 10 it remains for a few moments like if the animation is continuing and only after some fractions of time jumps to his complementary.
- On iOS 11 it jumps suddenly on his complementary
On the documentation there are non updates related to this, just a couple of new properties for the UIViewPropertyAnimator but not used because I'm targeting iOS10
Could be a bug or I'm missing something!?
Little update: just tested, same behaviour on iOS 11.0.1 and on iOS 11.1 beta1
As linked in the comment, this happens only with a non-linear curve!
let paras = UISpringTimingParameters(dampingRatio: 0.8, initialVelocity: CGVector(dx: 0, dy: 100))
andanimator.continueAnimation(withTimingParameters: paras, durationFactor: 1)
– NonsectariancontinueAnimation(withTimingParameters: UICubicTimingParameters(animationCurve: UIViewAnimationCurve.easeIn) ...)
but it has the described problem. As you can find inside the link on my previous comment the problems is present performing animations with a non-linear curve! Indeed if I usecontinueAnimation(withTimingParameters: UICubicTimingParameters(animationCurve: UIViewAnimationCurve.linear) ...)
, using a linear curve, it hasn't any problem! But I will try with yourtrimmingParamenters
! – AlphardwithTimingParameters
. – Nonsectarian