Contents

linear

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

Declaration

static let linear: CAMediaTimingFunctionName

Discussion

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

The following code shows how to create a basic animation object using linear interpolation.

 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 the following figure.

[Image]

See Also

Constants