I am trying to perform spring animation in a view that is issued by a user’s gesture and may have a non-zero speed. I'm basically trying to recreate the animation of this WWDC video , where they use it UISpringTimingParameters(dampingRatio:initialVelocity:). However, the documentation seems to contradict itself:
speed
The initial speed and direction of the animation given as a unit vector.
[...]
For example, if the total animation distance is 200 points, and the initial viewing speed is 100 points per second, specify a vector with a value 0.5.
If 0.5is an approximate value, then, apparently, it does not have to be a unit vector. And first of all, it is impossible to code the speed in a single vector.
Unable to rely on the documentation, I tried to connect several different values, but nothing led to even remotely satisfactory results.
How to use this API?
source
share