Next Page > Hide TOC

CAMediaTimingFunction Class Reference

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

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 bezier 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 bezier curve are automatically set to (0.0,0.0) and (1.0,1.0). The control points defining the bezier curve are: [(0.0,0.0), (c1x,c1y), (c2x,c2y), (1.0,1.0)].

Availability
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
Declared In
CAMediaTimingFunction.h

Instance Methods

getControlPointAtIndex:values:

Returns the control point for the specified index.

- (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 between 0 and 3.

Availability
Declared In
CAMediaTimingFunction.h

initWithControlPoints::::

Returns an initialized timing function modeled as a cubic bezier 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 bezier curve are automatically set to (0.0,0.0) and (1.0,1.0). The control points defining the bezier curve are: [(0.0,0.0), (c1x,c1y), (c2x,c2y), (1.0,1.0)].

Availability
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;

Constants
kCAMediaTimingFunctionLinear

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

Available in Mac OS X v10.5 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 Mac OS X v10.5 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 Mac OS X v10.5 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 Mac OS X v10.5 and later.

Declared in CAMediaTimingFunction.h.

Declared In
CAMediaTimingFunction.h

Next Page > Hide TOC


© 2008 Apple Inc. All Rights Reserved. (Last updated: 2008-07-11)


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.