CAAnimation Class Reference

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

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

delegate

Specifies the receiver’s delegate object.

@property(retain) id delegate
Discussion

Defaults to nil.

Availability
  • Available in OS X v10.5 and later.
Related Sample Code
Declared In
CAAnimation.h

removedOnCompletion

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

@property(getter=isRemovedOnCompletion) 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
  • Available in OS X v10.5 and later.
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
  • Available in OS X v10.5 and later.
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
  • Available in OS X v10.5 and later.
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
  • Available in OS X v10.5 and later.
Declared In
CAAnimation.h

Instance Methods

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
  • Available in OS X v10.5 and later.
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
  • Available in OS X v10.5 and later.
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
  • Available in OS X v10.5 and later.
Declared In
CAAnimation.h