Initializes the object with the specified damping ratio and velocity vector.
SDKs
- iOS 10.0+
- Mac Catalyst 13.0+
- tvOS 10.0+
Framework
- UIKit
Declaration
Parameters
ratio
The damping ratio to apply to the spring’s motion. To smoothly decelerate the animation without oscillation, specify a value of
1
. Specify values closer to0
to create less damping and more oscillation.velocity
The initial velocity and direction of the animation, specified as a unit vector. When applying a spring animation to an existing animation, use this parameter to create a smoother transition between the animations. This parameter is specified as a two-dimensional vector to accommodate view movements. For properties that don’t involve two-dimensional motion, only the magnitude of the vector is considered.
A vector with a magnitude of
1
corresponds to an initial velocity that would cover the total animation distance in one second. For example, if the total animation distance is 200 points and the view’s initial velocity is 100 points per second, specify a vector with a magnitude of.0 0
..5
Return Value
An initialized spring timing parameters object or nil
if the object could not be created.
Discussion
This method sets the initial velocity and damping ratio to the provided values.