# CCAction Class Reference

Inherits from | NSObject
Conforms to | NSCopying
Declared in | CCAction.h

## Overview

CCAction forms the foundation for one the great areas of Cocos2D functionality. The manipulatinon of node properties such as position, rotation, scale and opacity over time, to create fun effects.

- Actions can be modified with easing actions to create more realistic animations.
- Actions can be put in sequence to create more complex animation sequences.

## Tasks

### Accessing Action Attributes

- `target` property
- `originalTarget` property
- `tag` property

### Creating a CCAction Object

- `+ action`

### Initializing a CCAction Object

- `– init`

### Action Management

- `– isDone`
- `– startWithTarget:`
- `– stop`
- `– step:`
- `– update:`

## Properties

### originalTarget

The original target, since target can be nil.

`@property (nonatomic, readonly, unsafe_unretained) id originalTarget`

#### Declared In

`CCAction.h`

### tag

The action tag. An identifier of the action.

`@property (nonatomic, readwrite, assign) NSInteger tag`

#### Declared In

`CCAction.h`

### target

The “target”. The action will modify the target properties. The target will be set with the ‘startWithTarget’ method. When the ‘stop’ method is called, target will be set to nil. The target is ‘assigned’, it is not ‘retained’.

`@property (nonatomic, readonly, unsafe_unretained) id target`

#### Declared In

`CCAction.h`

## Class Methods

### action

Creates and returns an action object.

`+ (id)action`

#### Return Value

The CCAction Object.

#### Declared In

`CCAction.h`

## Instance Methods

### init

Initializes and returns an action object.

`- (id)init`

#### Return Value

An initialized CCAction Object.

#### Declared In

`CCAction.h`

### isDone

Return YES if the action has finished.

`- (BOOL)isDone`

#### Return Value

Action completion status

#### Declared In

`CCAction.h`

### startWithTarget:

Assigns a target to the action Called before the action is started.

`- (void)startWithTarget:(id)target`

#### Parameters

target

  Target to assign to action (weak reference).

#### Declared In

`CCAction.h`

### step:

Steps the action. Called for every frame with step interval.

`- (void)step:(CCTime)dt`

#### Parameters

dt

  Ellapsed interval since last step.

#### Discussion

Note: Do not override unless you know what you are doing.

#### Declared In

`CCAction.h`

### stop

Stops the action Called after the action has finished. Will assign the internal target reference to nil. Note: You should never call this method directly. In stead use: [target stopAction:action]

`- (void)stop`

#### Declared In

`CCAction.h`

### update:

Updates the action with normalized value.

`- (void)update:(CCTime)time`

#### Parameters

time

  Normalized action progress.

#### Discussion

For example: A value of 0.5 indicates that the action is 50% complete.

#### Declared In

`CCAction.h`