Type Property

default

The system default timing function. Use this function to ensure that the timing of your animations matches that of most system animations.

Declaration

static let `default`: CAMediaTimingFunctionName

Discussion

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

Listing 1 shows how to create a basic animation object using default interpolation:

Listing 1

Creating a basic animation with a default timing function

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

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 default timing function

Path taken using default timing function