CAMediaTimingFunction Class Reference
| Inherits from | |
| Conforms to | |
| Framework | /System/Library/Frameworks/QuartzCore.framework |
| Availability | Available in OS X v10.5 and later. |
| Declared in | CAMediaTimingFunction.h |
| Companion guides | |
Overview
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].
Class Methods
functionWithControlPoints::::
Creates and returns a new instance of CAMediaTimingFunction timing function modeled as a cubic Bézier curve using the specified control points.
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)].
Availability
- Available in OS X v10.5 and later.
Declared In
CAMediaTimingFunction.hfunctionWithName:
Creates and returns a new instance of CAMediaTimingFunction configured with the predefined timing function specified by 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.
Availability
- Available in OS X v10.5 and later.
Declared In
CAMediaTimingFunction.hInstance Methods
getControlPointAtIndex:values:
Returns the control point for the specified index.
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.
Availability
- Available in OS X v10.5 and later.
Declared In
CAMediaTimingFunction.hinitWithControlPoints::::
Returns an initialized timing function modeled as a cubic Bézier curve using the specified control points.
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)].
Availability
- Available in OS X v10.5 and later.
Declared In
CAMediaTimingFunction.hConstants
Predefined Timing Functions
These constants are used to specify one of the predefined timing functions used by functionWithName:.
NSString * const kCAMediaTimingFunctionLinear; NSString * const kCAMediaTimingFunctionEaseIn; NSString * const kCAMediaTimingFunctionEaseOut; NSString * const kCAMediaTimingFunctionEaseInEaseOut; NSString * const kCAMediaTimingFunctionDefault;
Constants
kCAMediaTimingFunctionLinearSpecifies linear pacing. Linear pacing causes an animation to occur evenly over its duration.
Available in OS X v10.5 and later.
Declared in
CAMediaTimingFunction.h.kCAMediaTimingFunctionEaseInSpecifies ease-in pacing. Ease-in pacing causes the animation to begin slowly, and then speed up as it progresses.
Available in OS X v10.5 and later.
Declared in
CAMediaTimingFunction.h.kCAMediaTimingFunctionEaseOutSpecifies ease-out pacing. An ease-out pacing causes the animation to begin quickly, and then slow as it completes.
Available in OS X v10.5 and later.
Declared in
CAMediaTimingFunction.h.kCAMediaTimingFunctionEaseInEaseOutSpecifies ease-in ease-out pacing. An ease-in ease-out animation begins slowly, accelerates through the middle of its duration, and then slows again before completing.
Available in OS X v10.5 and later.
Declared in
CAMediaTimingFunction.h.kCAMediaTimingFunctionDefaultSpecifies the timing function used as the default by most animations. It approximates a Bézier timing function using the control points [(0.0,0.0), (0.25,0.1), (0.25,0.1), (1.0,1.0)]. By using this constant you ensure that your animations will use the current default timing.
Available in OS X v10.6 and later.
Declared in
CAMediaTimingFunction.h.
© 2009 Apple Inc. All Rights Reserved. (Last updated: 2009-11-17)