Next Page > Hide TOC

CAAnimation 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

CAAnimation is an abstract animation class. It provides the basic support for the CAMediaTiming and CAAction protocols.

Tasks

Archiving Properties

Providing Default Values for Properties

Creating an Animation

Animation Attributes

Getting and Setting the Delegate

Animation Progress

Properties

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

delegate

Specifies the receiver’s delegate object.

@property(retain) id delegate

Discussion

Defaults to nil.

Important: The delegate object is retained by the receiver. This is a rare exception to the memory management rules described in Memory Management Programming Guide for Cocoa.

An instance of CAAnimation should not be set as a delegate of itself. Doing so (outside of a garbage-collected environment) will cause retain cycles.

Availability
Declared In
CAAnimation.h

removedOnCompletion

Determines if the animation is removed from the target layer’s animations upon completion.

@property BOOL removedOnCompletion

Discussion

When YES, the animation is removed from the target layer’s animations once its active duration has passed. Defaults to YES.

Availability
Declared In
CAAnimation.h

timingFunction

An optional timing function defining the pacing of the animation.

@property(retain) CAMediaTimingFunction *timingFunction

Discussion

Defaults to nil, indicating linear pacing.

Availability
Declared In
CAAnimation.h

Class Methods

animation

Creates and returns a new CAAnimation instance.

+ (id)animation

Return Value

An CAAnimation object whose input values are initialized.

Availability
Declared In
CAAnimation.h

defaultValueForKey:

Specifies the default value of the property with the specified key.

+ (id)defaultValueForKey:(NSString *)key

Parameters
key

The name of one of the receiver’s properties.

Return Value

The default value for the named property. Returns nil if no default value has been set.

Discussion

If this method returns nil a suitable “zero” default value for the property is provided, based on the declared type of the key. For example, if key is a CGSize object, a size of (0.0,0.0) is returned. For a CGRect an empty rectangle is returned. For CGAffineTransform and CATransform3D, the appropriate identity matrix is returned.

Special Considerations

If key is not a known for property of the class, the result of the method is undefined.

Availability
Declared In
CAAnimation.h

Instance Methods

isRemovedOnCompletion

A synthesized accessor for the removedOnCompletion property.

- (BOOL)isRemovedOnCompletion

See Also

shouldArchiveValueForKey:

Specifies whether the value of the property for a given key is archived.

- (BOOL)shouldArchiveValueForKey:(NSString *)key

Parameters
key

The name of one of the receiver’s properties.

Return Value

YES if the specified property should be archived, otherwise NO.

Discussion

Called by the object's implementation of encodeWithCoder:. The object must implement keyed archiving.

The default implementation returns YES.

Availability
Declared In
CAAnimation.h

Delegate Methods

animationDidStart:

Called when the animation begins its active duration.

- (void)animationDidStart:(CAAnimation *)theAnimation

Parameters
theAnimation

The CAAnimation instance that started animating.

Availability
Declared In
CAAnimation.h

animationDidStop:finished:

Called when the animation completes its active duration or is removed from the object it is attached to.

- (void)animationDidStop:(CAAnimation *)theAnimation finished:(BOOL)flag

Parameters
theAnimation

The CAAnimation instance that stopped animating.

flag

If YES, the animation reached the end of its active duration without being removed.

Availability
Declared In
CAAnimation.h

Next Page > Hide TOC


© 2007 Apple Inc. All Rights Reserved. (Last updated: 2007-10-31)


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.