Contents

CASpringAnimation

An animation that applies a spring-like force to a layer’s properties.

Declaration

class CASpringAnimation

Overview

You would typically use a spring animation to animate a layer’s position so that it appears to be pulled towards a target by a spring. The further the layer is from the target, the greater the acceleration towards it is.

CASpringAnimation allows control over physically based attributes such as the spring’s damping and stiffness.

You can use a spring animation to animation properties of a layer other than its position. The following code shows how to create a spring animation that bounces a layer into view by animating its scale from 0 to 1. Because the spring animation can overshoot its toValue, the animated layer may exceed its frame.

let springAnimation = CASpringAnimation(keyPath: "transform.scale")

springAnimation.fromValue = 0
springAnimation.toValue = 1

Topics

Configuring Physical Attributes

Initializers

Instance Properties

See Also

Animation