CCActionTween Class Reference

Inherits from CCActionInterval : CCActionFiniteTime : CCAction : NSObject
Declared in CCActionTween.h

Overview

CCActionTween lets you modify a node property over time.

Usage Example that modifies the rotationalSkewX property of a target from 0 to 89 in 2.5 seconds:

id tween = [CCActionTween actionWithDuration:2.5 key:@"rotationalSkewX" from:0 to:89];
[target runAction:tween];

Note: The tweened property must be a float or double type.

Warning: The value is updated using the KVC method setValue:forKey: and thus must be wrapped in NSNumber on every update. It is therefore recommended to avoid using many tween actions at the same time as the NSNumber overhead can add up and adversely affect performance.

Creating a Tween Action

+ actionWithDuration:key:from:to:

Creates an initializes a tween action.

+ (id)actionWithDuration:(CCTime)aDuration key:(NSString *)key from:(float)from to:(float)to

Parameters

aDuration

Action duration.

key

Name of property to modify. Property be a float or double type.

from

Value to tween from.

to

Value to tween to.

Return Value

New tween action.

Declared In

CCActionTween.h

– initWithDuration:key:from:to:

Initializes an initializes a tween action.

- (id)initWithDuration:(CCTime)aDuration key:(NSString *)key from:(float)from to:(float)to

Parameters

aDuration

Action duration.

key

Name of property to modify. Property be a float or double type.

from

Value to tween from.

to

Value to tween to.

Return Value

New tween action.

Declared In

CCActionTween.h