Class cc.ActionInterval
- Defined in: CCActionInterval.js
- Extends cc.FiniteTimeAction
Constructor Attributes | Constructor Name and Description |
---|---|
An interval action is an action that takes place within a certain period of time. |
Method Summary
Class Detail
cc.ActionInterval()
An interval action is an action that takes place within a certain period of time.
It has an start time, and a finish time. The finish time is the parameter
duration plus the start time.
These CCActionInterval actions have some interesting properties, like:
- They can run normally (default)
- They can run reversed with the reverse method
- They can run with the time altered with the Accelerate, AccelDeccel and Speed actions.
For example, you can simulate a Ping Pong effect running the action normally and
then running it again in Reverse mode.
Method Detail
-
{cc.ActionInterval} clone()returns a new clone of the action
- Returns:
- {cc.ActionInterval}
-
// example var actionInterval = cc.ActionInterval.create(3);
- Parameters:
- {Number} d
- duration in seconds
- Returns:
- {cc.ActionInterval}
-
ctor(d)constructor of cc.ActionInterval
var actionInterval = new cc.ActionInterval(3);
- Parameters:
- {Number} d
- duration in seconds
-
{Number} getAmplitudeRate()
- Returns:
- {Number}
-
{Number} getElapsed()how many seconds had elapsed since the actions started to run.
- Returns:
- {Number}
-
{Number} getSpeed()
- Returns:
- {Number}
-
{Boolean} initWithDuration(d)initializes the action
- Parameters:
- {Number} d
- duration in seconds
- Returns:
- {Boolean}
-
{Boolean} isDone()returns true if the action has finished
- Returns:
- {Boolean}
-
{cc.ActionInterval} repeat(times)Repeats an action a number of times. To repeat an action forever use the CCRepeatForever action.
- Parameters:
- times
- Returns:
- {cc.ActionInterval}
-
{cc.ActionInterval} repeatForever()Repeats an action for ever.
To repeat the an action for a limited number of times use the Repeat action.
- Returns:
- {cc.ActionInterval}
-
{Null} reverse()
- Returns:
- {Null}
-
setAmplitudeRate(amp)
- Parameters:
- {Number} amp
-
{cc.ActionInterval} setSpeed(speed)
- Parameters:
- {Number} speed
- Returns:
- {cc.ActionInterval}
-
{cc.Action} speed(speed)Changes the speed of an action, making it take longer (speed>1) or less (speed<1) time.
Useful to simulate 'slow motion' or 'fast forward' effect.- Parameters:
- speed
- Returns:
- {cc.Action}
-
startWithTarget(target)
- Parameters:
- {cc.Node} target
-
step(dt)
- Parameters:
- {Number} dt
- delta time in seconds