UIViewPropertyAnimator different behaviour on iOS10 and iOS11 reversing an animation. Bug on `isReversed` and `fractionComplete` properties?

后端 未结 3 1844
你的背包
你的背包 2021-02-06 00:16

THE PROBLEM
Running the same code on iOS10 and iOS11 my UIViewPropertyAnimator has a different behaviour just after changing of his .isReversed

3条回答
  •  青春惊慌失措
    2021-02-06 00:35

    I have been fighting this for quite a while as well, but then I noticed the scrubsLinearly property that was added to UIViewPropertyAnimator in iOS 11:

    Defaults to true. Provides the ability for an animator to pause and scrub either linearly or using the animator’s current timing.

    Note that the default of this property is true, which seems to cause a conflict with using a non-linear animation curve. That might also explain why the issue is not present when using a linear timing function.

    Setting scrubsLinearly to false, the animator seems to work as expected:

    let animator = UIViewPropertyAnimator(duration: 0.25, curve: .easeOut) {
       ...
    }
    animator.scrubsLinearly = false
    

提交回复
热议问题