Next Page > Hide TOC

CAMediaTiming Protocol Reference

Adopted by
Framework
/System/Library/Frameworks/QuartzCore.framework
Availability
Available in Mac OS X v10.5 and later.
Declared in
CAMediaTiming.h
Companion guides

Overview

The CAMediaTiming protocol models a hierarchical timing system, with each object describing the mapping of time values from the object's parent to local time.

Absolute time is defined as mach time converted to seconds. The CACurrentMediaTime function is provided as a convenience for getting the current absolute time.

The conversion from parent time to local time has two stages:

  1. Conversion to “active local time”. This includes the point at which the object appears in the parent object's timeline and how fast it plays relative to the parent.

  2. Conversion from “active local time” to “basic local time”. The timing model allows for objects to repeat their basic duration multiple times and, optionally, to play backwards before repeating.

Tasks

Animation Start Time

Repeating Animations

Duration and Speed

Playback Modes

Properties

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

autoreverses

Determines if the receiver plays in the reverse upon completion.

@property BOOL autoreverses

Discussion

When YES, the receiver plays backwards after playing forwards. Defaults to NO.

Availability
Declared In
CAMediaTiming.h

beginTime

Specifies the begin time of the receiver in relation to its parent object, if applicable.

@property CFTimeInterval beginTime

Discussion

Defaults to 0.

Availability
Declared In
CAMediaTiming.h

duration

Specifies the basic duration of the animation, in seconds.

@property CFTimeInterval duration

Discussion

Defaults to 0.

Availability
Declared In
CAMediaTiming.h

fillMode

Determines if the receiver’s presentation is frozen or removed once its active duration has completed.

@property(copy) NSString *fillMode

Discussion

The possible values are described in “Fill Modes”. The default is kCAFillModeRemoved.

Availability
Declared In
CAMediaTiming.h

repeatCount

Determines the number of times the animation will repeat.

@property float repeatCount

Discussion

May be fractional. If the repeatCount is 0, it is ignored. Defaults to 0. If both repeatDuration and repeatCount are specified the behavior is undefined.

Availability
Declared In
CAMediaTiming.h

repeatDuration

Determines how many seconds the animation will repeat for.

@property CFTimeInterval repeatDuration

Discussion

Defaults to 0. If the repeatDuration is 0, it is ignored. If both repeatDuration and repeatCount are specified the behavior is undefined.

Availability
Declared In
CAMediaTiming.h

speed

Specifies how time is mapped to receiver’s time space from the parent time space.

@property float speed

Discussion

For example, if speed is 2.0 local time progresses twice as fast as parent time. Defaults to 1.0.

Availability
Declared In
CAMediaTiming.h

timeOffset

Specifies an additional time offset in active local time.

@property CFTimeInterval timeOffset

Discussion

Defaults to 0. .

Availability
Declared In
CAMediaTiming.h

Constants

Fill Modes

These constants determine how the timed object behaves once its active duration has completed. They are used with the fillMode property.

NSString * const kCAFillModeRemoved;
NSString * const kCAFillModeForwards;
NSString * const kCAFillModeBackwards;
NSString * const kCAFillModeBoth;
NSString * const kCAFillModeFrozen;

Constants
kCAFillModeRemoved

The receiver is removed from the presentation when the animation is completed.

Available in Mac OS X v10.5 and later.

Declared in CAMediaTiming.h.

kCAFillModeForwards

The receiver remains visible in its final state when the animation is completed.

Available in Mac OS X v10.5 and later.

Declared in CAMediaTiming.h.

kCAFillModeBackwards

The receiver clamps values before zero to zero when the animation is completed.

Available in Mac OS X v10.5 and later.

Declared in CAMediaTiming.h.

kCAFillModeBoth

The receiver clamps values at both ends of the object’s time space

Available in Mac OS X v10.5 and later.

Declared in CAMediaTiming.h.

kCAFillModeFrozen

The mode was deprecated before Mac OS X v10.5 shipped.

Deprecated in Mac OS X v10.5 and later.

Declared in CAMediaTiming.h.

Declared In
CAMediaTiming.h

Next Page > Hide TOC


© 2009 Apple Inc. All Rights Reserved. (Last updated: 2009-03-04)


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.