Next Page > Hide TOC

CAKeyframeAnimation Class Reference

Inherits from
Conforms to
Framework
/System/Library/Frameworks/QuartzCore.framework
Availability
Available in Mac OS X v10.5 and later.
Declared in
CAAnimation.h
Companion guides

Overview

CAKeyframeAnimation provides generic keyframe animation capabilities for a layer property in the render tree. You create an CAKeyframeAnimation instance using the inherited animationWithKeyPath: method, specifying the key path of the property updated in the render tree during the animation. The animation provides a series of keyframe values, either as an array or a series of points in a CGPathRef. While animating, it updates the value of the property in the render tree with values calculated using the specified interpolation calculation mode.

Tasks

Providing Keyframe Values

Keyframe Timing

Rotation Mode

Properties

For more about Objective-C properties, see “Properties” in The Objective-C 2.0 Programming Language.

calculationMode

Specifies how intermediate keyframe values are calculated by the receiver.

@property(copy) NSString *calculationMode

Discussion

The possible values are described in “Value calculation modes”. The default is kCAAnimationLinear.

Availability
Declared In
CAAnimation.h

keyTimes

An optional array of NSNumber objects that define the duration of each keyframe segment.

@property(copy) NSArray *keyTimes

Discussion

Each value in the array is a floating point number between 0.0 and 1.0 and corresponds to one element in the values array. Each element in the keyTimes array defines the duration of the corresponding keyframe value as a fraction of the total duration of the animation. Each element value must be greater than, or equal to, the previous value.

The appropriate values in the keyTimes array are dependent on the calculationMode property.

If the values in the keyTimes array are invalid or inappropriate for the calculationMode, the keyTimes array is ignored.

Availability
Declared In
CAAnimation.h

path

An optional CGPathRef that provides the keyframe values for the receiver.

@property CGPathRef path;

Discussion

Defaults to nil. Specifying a path overrides the values property. Each point in the path, except for moveto points, defines a single keyframe segment for the purpose of timing and interpolation. For constant velocity animation along the path, calculationMode should be set to kCAAnimationPaced.

Availability
See Also
Declared In
CAAnimation.h

rotationMode

Determines whether objects animating along the path rotate to match the path tangent.

@property(copy) NSString *rotationMode

Discussion

Possible values are described in “Rotation Mode Values”. The default is nil, which indicates that objects should not rotate to follow the path.

The effect of setting this property to a non-nil value when no path object is supplied is undefined.

Availability
See Also
Declared In
CAAnimation.h

timingFunctions

An optional array of CAMediaTimingFunction instances that defines the pacing of the each keyframe segment.

@property(copy) NSArray *timingFunctions

Discussion

If the receiver defines n keyframes, there must be n-1 objects in the timingFunctions array. Each timing function describes the pacing of one keyframe to keyframe segment.

Special Considerations

The inherited timingFunction value is always ignored.

Availability
Declared In
CAAnimation.h

values

An array of objects that provide the keyframe values for the receiver.

@property(copy) NSArray *values

Discussion

The values property is ignored when the path property is used.

Availability
Declared In
CAAnimation.h

Constants

Rotation Mode Values

These constants are used by the rotationMode property.

NSString * const kCAAnimationRotateAuto NSString * const kCAAnimationRotateAutoReverse

Constants
kCAAnimationRotateAuto

The objects travel on a tangent to the path.

Available in Mac OS X v10.5 and later.

Declared in CAAnimation.h.

kCAAnimationRotateAutoReverse

The objects travel at a 180 degree tangent to the path.

Available in Mac OS X v10.5 and later.

Declared in CAAnimation.h.

Declared In
CAAnimation.h

Value calculation modes

These constants are used by the calculationMode property.

NSString * const kCAAnimationLinear;
NSString * const kCAAnimationDiscrete;
NSString * const kCAAnimationPaced;

Constants
kCAAnimationLinear

Simple linear calculation between keyframe values.

Available in Mac OS X v10.5 and later.

Declared in CAAnimation.h.

kCAAnimationDiscrete

Each keyframe value is used in turn, no interpolated values are calculated.

Available in Mac OS X v10.5 and later.

Declared in CAAnimation.h.

kCAAnimationPaced

Keyframe values are interpolated to produce an even pace throughout the animation. This mode is not currently implemented

Available in Mac OS X v10.5 and later.

Declared in CAAnimation.h.

Declared In
CAAnimation.h

Next Page > Hide TOC


© 2007 Apple Inc. All Rights Reserved. (Last updated: 2007-07-24)


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.