Specifies timing information for animations that mimics the behavior of a spring.


The timing provided by a UISpringTimingParameters object mimics the behavior of a spring acting on the value of the property being animated. This property’s value accelerates toward its final value according to the relative force of the spring, which you configure. It then oscillates around that final value until it comes to a rest. The speed at which a property animates to its new value is based on the initial velocity of the value and the damping ratio applied to the spring. You can specify those values directly or using analogous spring-related values.

Use instances of this class to specify custom timing curves when creating animations with objects that adopt the UIViewAnimating protocol, such as UIViewPropertyAnimator. Spring animations are commonly used to modify a view’s position onscreen, but you can apply the timing to any of the view’s properties to get a similar type of animation timing.


Initializing a Spring Timing Parameters Object


Initializes the object with the default timing parameters.

init(dampingRatio: CGFloat)

Initializes the timing parameters with the specified damping ratio.

init(dampingRatio: CGFloat, initialVelocity: CGVector)

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

init(mass: CGFloat, stiffness: CGFloat, damping: CGFloat, initialVelocity: CGVector)

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

Getting the Initial Velocity

var initialVelocity: CGVector

The initial velocity to apply to the animation.


Inherits From