Type Property

cubicPaced

Cubic keyframe values are interpolated to produce an even pace throughout the animation.

Declaration

static let cubicPaced: CAAnimationCalculationMode

Discussion

kCAAnimationCubicPaced gives a linearly interpolated animation, but keyTimes and timingFunction are ignored and keyframe times are automatically generated to give the animation a constant velocity.

Listing 1 shows how to create a keyframe animation object using paced cubic interpolation.

Listing 1

Creating a keyframe animation object using paced cubic interpolation

let keyframeAnimation = CAKeyframeAnimation(keyPath: "position.y")
keyframeAnimation.calculationMode = kCAAnimationCubicPaced
keyframeAnimation.values = [310, 60, 120, 60, 310]

A layer animated with the keyframe animation created by the code above and with linearly interpolated horizontal movement would describe a path similar to Figure 1.

Figure 1

Tracing the path of an animation using cubic paced key values

Tracing the path of an animation using cubic paced key values

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software