An object that provides keyframe animation capabilities for a layer object.
- iOS 2.0+
- macOS 10.5+
- tvOS 9.0+
- Core Animation
You create a
CAKeyframe object using the inherited
init(key method, specifying the key path of the property that you want to animate on the layer. You can then specify the keyframe values to use to control the timing and animation behavior.
For most types of animations, you specify the keyframe values using the
key properties. During the animation, Core Animation generates intermediate values by interpolating between the values you provide. When animating a value that is a coordinate point, such as the layer’s position, you can specify a
path for that point to follow instead of individual values. The pacing of the animation is controlled by the timing information you provide.
Listing 1 shows how to create a keyframe animation that animates a layer's background color from red to green to blue over a two second duration.