Instance Method


Initializes the object with the specified spring stiffness, mass, and damping coefficients.


- (instancetype)initWithMass:(CGFloat)mass stiffness:(CGFloat)stiffness damping:(CGFloat)damping initialVelocity:(CGVector)velocity;



The effective mass of the animated property. This value must be greater than 0.


The spring stiffness coefficient. Higher values correspond to a stiffer spring that yields a greater amount of force for moving objects.


The damping force to apply to the spring’s motion. This value is used to compute the damping ratio.


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.0 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.5.

Return Value

An initialized spring timing parameters object or nil if the object could not be created.


The damping ratio for the spring is computed from the formula damping / (2 * sqrt (stiffness * mass)).

See Also

Initializing a Spring Timing Parameters Object

- init

Initializes the object with the default timing parameters.

- initWithDampingRatio:

Initializes the timing parameters with the specified damping ratio.

- initWithDampingRatio:initialVelocity:

Initializes the object with the specified damping ratio and velocity vector.