Class

UISpringTimingParameters

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

Overview

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.

Topics

Initializing a Spring Timing Parameters Object

init()

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.

Relationships

Inherits From

See Also

Timing Curves

protocol UITimingCurveProvider

An interface for providing the timing information needed to perform animations.

class UICubicTimingParameters

The timing information for animations in the form of a cubic Bézier curve.