Type Property


Linear pacing, which causes an animation to occur evenly over its duration.


static let linear: CAMediaTimingFunctionName


This is a Bézier timing function with the control points (0.0,0.0) and (1.0,1.0).

Listing 1 shows how to create a basic animation object using linear interpolation.

Listing 1

Creating a basic animation with a linear timing function

 let verticalAnimation = CABasicAnimation(keyPath: "position.y")
 verticalAnimation.fromValue = 310
 verticalAnimation.toValue = 10
 verticalAnimation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionLinear)

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

Figure 1

Path taken using linear timing function

Path taken using linear timing function

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