Principle provides Spring Animations using Tension and Friction, while iOS uses Duration, Damping and Initial Velocity. I’m wondering if you could provide guidance on how to convert these values provided by our design team.
I’m curious about this too, great question, hope someone can help you out. Following the thread for answers.
The iOS API that uses duration is discouraged. The duration parameter is a hack that the original Apple engineer who made it regrets adding - it essentially takes the duration and tries to work backwards from that to figure out tension and friction - there isn’t always a solution to this equation and it gets very problematic when the layer could possibly animate from different positions (say after a drag ends).
There is an iOS Spring API that doesn’t take a duration. Use that.
The real solution here was found yesterday - using UISpringTimingParamaters:
Where stiffness correlates to tension and damping correlates to friction.
You should feed this to a UIViewPropertyAnimator: https://developer.apple.com/documentation/uikit/uiviewpropertyanimator/1648362-init
The duration is ignored when using the spring parameters initializer.
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.