Methods that model a hierarchical timing system, allowing objects to map time between their parent and local time.


protocol CAMediaTiming


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.


Animation Start Time

var beginTime: CFTimeInterval

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


var timeOffset: CFTimeInterval

Specifies an additional time offset in active local time.


Repeating Animations

var repeatCount: Float

Determines the number of times the animation will repeat.


var repeatDuration: CFTimeInterval

Determines how many seconds the animation will repeat for.


Duration and Speed

var duration: CFTimeInterval

Specifies the basic duration of the animation, in seconds.


var speed: Float

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


Playback Modes

var autoreverses: Bool

Determines if the receiver plays in the reverse upon completion.


var fillMode: CAMediaTimingFillMode

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



Fill Modes

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


Conforming Types

See Also

Animation Timing

func CACurrentMediaTime() -> CFTimeInterval

Returns the current absolute time, in seconds.

class CAMediaTimingFunction

A function that defines the pacing of an animation as a timing curve.

class CADisplayLink

A timer object that allows your application to synchronize its drawing to the refresh rate of the display.