iOS Developer Library

Developer

QuartzCore Framework Reference CAMediaTiming Protocol Reference

Options
Deployment Target:

On This Page
Language:

CAMediaTiming

Inherits From


Not Applicable

Conforms To


Not Applicable

Import Statement


Swift

import QuartzCore

Objective-C

@import QuartzCore;

Availability


Available in iOS 2.0 and later

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.

  • beginTime beginTime Required Property

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

    Declaration

    Swift

    var beginTime: CFTimeInterval { get set }

    Objective-C

    @property CFTimeInterval beginTime

    Discussion

    Defaults to 0.

    Import Statement

    Objective-C

    @import QuartzCore;

    Swift

    import QuartzCore

    Availability

    Available in iOS 2.0 and later

  • timeOffset timeOffset Required Property

    Specifies an additional time offset in active local time. (required)

    Declaration

    Swift

    var timeOffset: CFTimeInterval { get set }

    Objective-C

    @property CFTimeInterval timeOffset

    Discussion

    Defaults to 0. .

    Import Statement

    Objective-C

    @import QuartzCore;

    Swift

    import QuartzCore

    Availability

    Available in iOS 2.0 and later

  • repeatCount repeatCount Required Property

    Determines the number of times the animation will repeat. (required)

    Declaration

    Swift

    var repeatCount: Float { get set }

    Objective-C

    @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.

    Setting this property to HUGE_VALF will cause the animation to repeat forever.

    Import Statement

    Objective-C

    @import QuartzCore;

    Swift

    import QuartzCore

    Availability

    Available in iOS 2.0 and later

  • repeatDuration repeatDuration Required Property

    Determines how many seconds the animation will repeat for. (required)

    Declaration

    Swift

    var repeatDuration: CFTimeInterval { get set }

    Objective-C

    @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.

    Import Statement

    Objective-C

    @import QuartzCore;

    Swift

    import QuartzCore

    Availability

    Available in iOS 2.0 and later

  • duration duration Required Property

    Specifies the basic duration of the animation, in seconds. (required)

    Declaration

    Swift

    var duration: CFTimeInterval { get set }

    Objective-C

    @property CFTimeInterval duration

    Discussion

    Defaults to 0.

    Import Statement

    Objective-C

    @import QuartzCore;

    Swift

    import QuartzCore

    Availability

    Available in iOS 2.0 and later

  • speed speed Required Property

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

    Declaration

    Swift

    var speed: Float { get set }

    Objective-C

    @property float speed

    Discussion

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

    Import Statement

    Objective-C

    @import QuartzCore;

    Swift

    import QuartzCore

    Availability

    Available in iOS 2.0 and later

  • autoreverses autoreverses Required Property

    Determines if the receiver plays in the reverse upon completion. (required)

    Declaration

    Swift

    var autoreverses: Bool { get set }

    Objective-C

    @property BOOL autoreverses

    Discussion

    When YEStrue, the receiver plays backwards after playing forwards. Defaults to NOfalse.

    Import Statement

    Objective-C

    @import QuartzCore;

    Swift

    import QuartzCore

    Availability

    Available in iOS 2.0 and later

  • fillMode fillMode Required Property

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

    Declaration

    Swift

    var fillMode: String! { get set }

    Objective-C

    @property(copy) NSString *fillMode

    Discussion

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

    Import Statement

    Objective-C

    @import QuartzCore;

    Swift

    import QuartzCore

    Availability

    Available in iOS 2.0 and later

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

    Declaration

    Swift

    let kCAFillModeRemoved: String let kCAFillModeForwards: String let kCAFillModeBackwards: String let kCAFillModeBoth: String

    Objective-C

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

    Constants

    • kCAFillModeRemoved

      kCAFillModeRemoved

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

      Available in iOS 2.0 and later

    • kCAFillModeForwards

      kCAFillModeForwards

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

      Available in iOS 2.0 and later

    • kCAFillModeBackwards

      kCAFillModeBackwards

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

      Available in iOS 2.0 and later

    • kCAFillModeBoth

      kCAFillModeBoth

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

      Available in iOS 2.0 and later

    • kCAFillModeFrozen

      kCAFillModeFrozen

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

      Available in iOS 2.0 and later

      Deprecated in iOS 4.0