Class: RotateAction
The Action class has static methods for creating actions to be executed by an M2Node.
Extends
Constructors
new RotateAction()
new RotateAction(
byAngle
,toAngle
,shortestUnitArc
,duration
,runDuringTransition
):RotateAction
Parameters
• byAngle: undefined
| number
• toAngle: undefined
| number
• shortestUnitArc: undefined
| boolean
• duration: Futurable
• runDuringTransition: boolean
= false
Returns
Overrides
Source
Properties
byAngle?
optional
byAngle:number
Source
delta
delta:
number
=0
Source
duration
duration:
Futurable
Inherited from
Source
finalValue
finalValue:
number
=NaN
Source
key?
optional
key:string
Inherited from
Source
parent?
optional
parent:ActionContainer
Inherited from
Source
runDuringTransition
runDuringTransition:
boolean
Inherited from
Source
runStartTime
runStartTime:
number
=-1
Start time of a running action is always known; it is not a Futurable
.
-1 indicates that the root action has not yet started running.
Inherited from
Source
running
running:
boolean
=false
Inherited from
Source
shortestUnitArc?
optional
shortestUnitArc:boolean
Source
startOffset
startOffset:
Futurable
Inherited from
Source
started
started:
boolean
=false
Inherited from
Source
toAngle?
optional
toAngle:number
Source
type
type:
ActionType
=ActionType.Rotate
Overrides
Source
Accessors
completed
get
completed():boolean
Indicates whether the action has completed.
set
completed(value
):void
Parameters
• value: boolean
Returns
boolean
Source
Methods
assignRunStartTimes()
assignRunStartTimes(
action
,runStartTime
):void
Assigns RunStartTime to all actions in the hierarchy.
Parameters
• action: Action
the action to assign RunStartTime to
• runStartTime: number
Returns
void
Inherited from
Remarks
Uses recursion to handle arbitrary level of nesting parent actions within parent actions.
Source
clone()
clone():
RotateAction
Clones the action, and any actions it contains, recursively.
Returns
a clone of the action
Overrides
Remarks
We need to clone an action before running it because actions
have state that is updated over time such as whether they are running or
not, etc. If we didn't clone actions, two nodes reusing the same action
would share state. On Action
, this method is abstract and is
implemented in each subclass.
Source
initialize()
initialize(
key
?):Action
Prepares the Action for evaluation.
Parameters
• key?: string
optional string to identify an action
Returns
action prepared for evaluation
Inherited from
Remarks
Calculates start times for all actions in the hierarchy and returns a copy of the action that is prepared for evaluation during the update loop.
Source
isParent()
isParent(
action
):action is ActionContainer
Type guard that returns true if the action is a parent action.
Parameters
• action: Action
action to check
Returns
action is ActionContainer
true if the action is a parent action
Inherited from
Remarks
Parent actions are Group, Sequence, Repeat, and RepeatForever actions.
Source
restartAction()
restartAction(
action
,now
):void
Configures action to be run again.
Parameters
• action: Action
action to restart
• now: number
current time
Returns
void
Inherited from
Remarks
This method is called on a repeating action's children when they need to be run again.
Source
shouldBeRunning()
shouldBeRunning(
now
):boolean
Determines if the action should be running.
Parameters
• now: number
current time
Returns
boolean
true if the action should be running
Inherited from
Remarks
An action should be running if current time is in the interval [ start time + start offset, start time + start offset + duration ]
Source
custom()
static
custom(options
):CustomAction
Creates an action that will execute a callback function.
Parameters
• options: CustomActionOptions
Returns
The custom action
Inherited from
Source
evaluateAction()
static
evaluateAction(action
,node
,now
,dt
):void
Evaluates an action, updating the node's properties as needed.
Parameters
• action: Action
the Action to be evaluated and possibly run
• node: M2Node
the M2Node
that the action will be run on
• now: number
the current elapsed time, from performance.now()
• dt: number
the time since the last frame (delta time)
Returns
void