CAMediaTiming Protocol Reference
| Adopted by | |
| Framework | /System/Library/Frameworks/QuartzCore.framework |
| Availability | Available in iOS 2.0 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:
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.
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
-
beginTimeproperty -
timeOffsetproperty
Repeating Animations
-
repeatCountproperty -
repeatDurationproperty
Duration and Speed
Playback Modes
-
autoreversesproperty -
fillModeproperty
Properties
autoreverses
Determines if the receiver plays in the reverse upon completion. (required)
Discussion
When YES, the receiver plays backwards after playing forwards. Defaults to NO.
Availability
- Available in iOS 2.0 and later.
Declared In
CAMediaTiming.hbeginTime
Specifies the begin time of the receiver in relation to its parent object, if applicable. (required)
Discussion
Defaults to 0.
Availability
- Available in iOS 2.0 and later.
Declared In
CAMediaTiming.hduration
Specifies the basic duration of the animation, in seconds. (required)
Discussion
Defaults to 0.
Availability
- Available in iOS 2.0 and later.
Declared In
CAMediaTiming.hfillMode
Determines if the receiver’s presentation is frozen or removed once its active duration has completed. (required)
Discussion
The possible values are described in “Fill Modes”. The default is kCAFillModeRemoved.
Availability
- Available in iOS 2.0 and later.
Declared In
CAMediaTiming.hrepeatCount
Determines the number of times the animation will repeat. (required)
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.
Setting this property to HUGE_VALF will cause the animation to repeat forever.
Availability
- Available in iOS 2.0 and later.
Declared In
CAMediaTiming.hrepeatDuration
Determines how many seconds the animation will repeat for. (required)
Discussion
Defaults to 0. If the repeatDuration is 0, it is ignored. If both repeatDuration and repeatCount are specified the behavior is undefined.
Availability
- Available in iOS 2.0 and later.
Declared In
CAMediaTiming.hspeed
Specifies how time is mapped to receiver’s time space from the parent time space. (required)
Discussion
For example, if speed is 2.0 local time progresses twice as fast as parent time. Defaults to 1.0.
Availability
- Available in iOS 2.0 and later.
Declared In
CAMediaTiming.htimeOffset
Specifies an additional time offset in active local time. (required)
Discussion
Defaults to 0. .
Availability
- Available in iOS 2.0 and later.
Declared In
CAMediaTiming.hConstants
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
kCAFillModeRemovedThe receiver is removed from the presentation when the animation is completed.
Available in iOS 2.0 and later.
Declared in
CAMediaTiming.h.kCAFillModeForwardsThe receiver remains visible in its final state when the animation is completed.
Available in iOS 2.0 and later.
Declared in
CAMediaTiming.h.kCAFillModeBackwardsThe receiver clamps values before zero to zero when the animation is completed.
Available in iOS 2.0 and later.
Declared in
CAMediaTiming.h.kCAFillModeBothThe receiver clamps values at both ends of the object’s time space
Available in iOS 2.0 and later.
Declared in
CAMediaTiming.h.kCAFillModeFrozenThe mode was deprecated before OS X v10.5 shipped.
Available in iOS 2.0 and later.
Declared in
CAMediaTiming.h.
Declared In
CAMediaTiming.h© 2009 Apple Inc. All Rights Reserved. (Last updated: 2009-11-17)