Mac Developer Library

Developer

QuartzCore Framework Reference CABasicAnimation Class Reference

Options
Deployment Target:

On This Page
Language:

CABasicAnimation

CABasicAnimation provides basic, single-keyframe animation capabilities for a layer property. You create an instance of CABasicAnimation using the inherited animationWithKeyPath: method, specifying the key path of the property to be animated in the render tree.

Setting Interpolation Values

The fromValue, byValue and toValue properties define the values being interpolated between. All are optional, and no more than two should be non-nil. The object type should match the type of the property being animated.

The interpolation values are used as follows:

  • Both fromValue and toValue are non-nil. Interpolates between fromValue and toValue.

  • fromValue and byValue are non-nil. Interpolates between fromValue and (fromValue + byValue).

  • byValue and toValue are non-nil. Interpolates between (toValue - byValue) and toValue.

  • fromValue is non-nil. Interpolates between fromValue and the current presentation value of the property.

  • toValue is non-nil. Interpolates between the current value of keyPath in the target layer’s presentation layer and toValue.

  • byValue is non-nil. Interpolates between the current value of keyPath in the target layer’s presentation layer and that value plus byValue.

  • All properties are nil. Interpolates between the previous value of keyPath in the target layer’s presentation layer and the current value of keyPath in the target layer’s presentation layer.

Inheritance


Import Statement


Swift

import QuartzCore

Objective-C

@import QuartzCore;

Availability


Available in OS X v10.5 and later.
  • fromValue fromValue Property

    Defines the value the receiver uses to start interpolation.

    Declaration

    Swift

    var fromValue: AnyObject!

    Objective-C

    @property(strong) id fromValue

    Discussion

    See Setting Interpolation Values for details on how fromValue interacts with the other interpolation values.

    Import Statement

    Objective-C

    @import QuartzCore;

    Swift

    import QuartzCore

    Availability

    Available in OS X v10.5 and later.

  • toValue toValue Property

    Defines the value the receiver uses to end interpolation.

    Declaration

    Swift

    var toValue: AnyObject!

    Objective-C

    @property(strong) id toValue

    Discussion

    See Setting Interpolation Values for details on how toValue interacts with the other interpolation values.

    Import Statement

    Objective-C

    @import QuartzCore;

    Swift

    import QuartzCore

    Availability

    Available in OS X v10.5 and later.

  • byValue byValue Property

    Defines the value the receiver uses to perform relative interpolation.

    Declaration

    Swift

    var byValue: AnyObject!

    Objective-C

    @property(strong) id byValue

    Discussion

    See Setting Interpolation Values for details on how byValue interacts with the other interpolation values.

    Import Statement

    Objective-C

    @import QuartzCore;

    Swift

    import QuartzCore

    Availability

    Available in OS X v10.5 and later.