iOS Reference Library Apple Developer
Search

CAMediaTimingFunction Class Reference

Inherits from
Conforms to
Framework
/System/Library/Frameworks/QuartzCore.framework
Availability
Available in iOS 2.0 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].

Tasks

Creating Timing Functions

Accessing the Control Points

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.

+ (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)].

Availability
  • Available in iOS 2.0 and later.
Declared In
CAMediaTimingFunction.h

functionWithName:

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

+ (id)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.

Availability
  • Available in iOS 2.0 and later.
Declared In
CAMediaTimingFunction.h

Instance Methods

getControlPointAtIndex:values:

Returns the control point for the specified index.

- (void)getControlPointAtIndex:(size_t)index values:(float)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 between 0 and 3.

Availability
  • Available in iOS 2.0 and later.
Declared In
CAMediaTimingFunction.h

initWithControlPoints::::

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

- (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)].

Availability
  • Available in iOS 2.0 and later.
Declared In
CAMediaTimingFunction.h

Constants

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
kCAMediaTimingFunctionLinear

Specifies linear pacing. Linear pacing causes an animation to occur evenly over its duration.

Available in iOS 2.0 and later.

Declared in CAMediaTimingFunction.h.

kCAMediaTimingFunctionEaseIn

Specifies ease-in pacing. Ease-in pacing causes the animation to begin slowly, and then speed up as it progresses.

Available in iOS 2.0 and later.

Declared in CAMediaTimingFunction.h.

kCAMediaTimingFunctionEaseOut

Specifies ease-out pacing. An ease-out pacing causes the animation to begin quickly, and then slow as it completes.

Available in iOS 2.0 and later.

Declared in CAMediaTimingFunction.h.

kCAMediaTimingFunctionEaseInEaseOut

Specifies 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 iOS 2.0 and later.

Declared in CAMediaTimingFunction.h.

kCAMediaTimingFunctionDefault

Specifies 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 iOS 3.0 and later.

Declared in CAMediaTimingFunction.h.




Last updated: 2009-11-17

Did this document help you? Yes It's good, but... Not helpful...