Mac Developer Library

Developer

QuartzCore Framework Reference CAMediaTimingFunction Class Reference

Options
Deployment Target:

On This Page
Language:

CAMediaTimingFunction

Inheritance


Conforms To


Import Statement


Swift

import QuartzCore

Objective-C

@import QuartzCore;

Availability


Available in OS X v10.5 and later.

CAMediaTimingFunction represents one segment of a function that defines the pacing of an animation as a timing curve. The function maps an input time normalized to the range [0,1] to an output time also in the range [0,1].

  • Creates and returns a new instance of CAMediaTimingFunction configured with the predefined timing function specified by name.

    Declaration

    Swift

    convenience init!(name name: String!)

    Objective-C

    + (instancetype)functionWithName:(NSString *)name

    Parameters

    name

    The timing function to use as specified in “Predefined Timing Functions”.

    Return Value

    A new instance of CAMediaTimingFunction with the timing function specified by name.

    Import Statement

    Objective-C

    @import QuartzCore;

    Swift

    import QuartzCore

    Availability

    Available in OS X v10.5 and later.

  • Creates and returns a new instance of CAMediaTimingFunction timing function modeled as a cubic Bézier curve using the specified control points.

    Declaration

    Objective-C

    + (id)functionWithControlPoints:(float)c1x :(float)c1y :(float)c2x :(float)c2y

    Parameters

    c1x

    A floating point number representing the x position of the c1 control point.

    c1y

    A floating point number representing the y position of the c1 control point.

    c2x

    A floating point number representing the x position of the c2 control point.

    c2y

    A floating point number representing the y position of the c2 control point.

    Return Value

    A new instance of CAMediaTimingFunction with the timing function specified by the provided control points.

    Discussion

    The end points of the Bézier curve are automatically set to (0.0,0.0) and (1.0,1.0). The control points defining the Bézier curve are: [(0.0,0.0), (c1x,c1y), (c2x,c2y), (1.0,1.0)].

    Import Statement

    Objective-C

    @import QuartzCore;

    Availability

    Available in OS X v10.5 and later.

  • Returns an initialized timing function modeled as a cubic Bézier curve using the specified control points.

    Declaration

    Swift

    init!(controlPoints c1x: Float, _ c1y: Float, _ c2x: Float, _ c2y: Float)

    Objective-C

    - (id)initWithControlPoints:(float)c1x :(float)c1y :(float)c2x :(float)c2y

    Parameters

    c1x

    A floating point number representing the x position of the c1 control point.

    c1y

    A floating point number representing the y position of the c1 control point.

    c2x

    A floating point number representing the x position of the c2 control point.

    c2y

    A floating point number representing the y position of the c2 control point.

    Return Value

    An instance of CAMediaTimingFunction with the timing function specified by the provided control points.

    Discussion

    The end points of the Bézier curve are automatically set to (0.0,0.0) and (1.0,1.0). The control points defining the Bézier curve are: [(0.0,0.0), (c1x,c1y), (c2x,c2y), (1.0,1.0)].

    Import Statement

    Objective-C

    @import QuartzCore;

    Swift

    import QuartzCore

    Availability

    Available in OS X v10.5 and later.

  • Returns the control point for the specified index.

    Declaration

    Swift

    func getControlPointAtIndex(_ index: Int, values ptr: UnsafeMutablePointer<Float>)

    Objective-C

    - (void)getControlPointAtIndex:(size_t)index values:(float [2])ptr

    Parameters

    index

    An integer specifying the index of the control point to return.

    ptr

    A pointer to an array that, upon return, will contain the x and y values of the specified point.

    Discussion

    The value of index must be between 0 and 3.

    Import Statement

    Objective-C

    @import QuartzCore;

    Swift

    import QuartzCore

    Availability

    Available in OS X v10.5 and later.

  • Constants that specify system-provided timing functions, used by functionWithName:.

    Declaration

    Swift

    let kCAMediaTimingFunctionLinear: String let kCAMediaTimingFunctionEaseIn: String let kCAMediaTimingFunctionEaseOut: String let kCAMediaTimingFunctionEaseInEaseOut: String let kCAMediaTimingFunctionDefault: String

    Objective-C

    NSString * const kCAMediaTimingFunctionLinear; NSString * const kCAMediaTimingFunctionEaseIn; NSString * const kCAMediaTimingFunctionEaseOut; NSString * const kCAMediaTimingFunctionEaseInEaseOut; NSString * const kCAMediaTimingFunctionDefault;

    Constants

    • kCAMediaTimingFunctionLinear

      kCAMediaTimingFunctionLinear

      Linear pacing, which causes an animation to occur evenly over its duration.

      This is a Bézier timing function with the control points (0.0,0.0) and (1.0,1.0).

      Available in OS X v10.5 and later.

    • kCAMediaTimingFunctionEaseIn

      kCAMediaTimingFunctionEaseIn

      Ease-in pacing, which causes an animation to begin slowly and then speed up as it progresses.

      This is a Bézier timing function with the control points (0.42,0.0) and (1.0,1.0).

      Available in OS X v10.5 and later.

    • kCAMediaTimingFunctionEaseOut

      kCAMediaTimingFunctionEaseOut

      Ease-out pacing, which causes an animation to begin quickly and then slow as it progresses.

      This is a Bézier timing function with the control points (0.0,0.0) and (0.58,1.0).

      Available in OS X v10.5 and later.

    • kCAMediaTimingFunctionEaseInEaseOut

      kCAMediaTimingFunctionEaseInEaseOut

      Ease-in-ease-out pacing, which causes an animation to begin slowly, accelerate through the middle of its duration, and then slow again before completing.

      This is a Bézier timing function with the control points (0.42,0.0) and (0.58,1.0).

      Available in OS X v10.5 and later.

    • kCAMediaTimingFunctionDefault

      kCAMediaTimingFunctionDefault

      The system default timing function. Use this function to ensure that the timing of your animations matches that of most system animations.

      This is a Bézier timing function with the control points (0.25,0.1) and (0.25,1.0).

      Available in OS X v10.6 and later.