AnimComponent
Extends: Component
The Anim Component allows an Entity to playback animations on models and entity properties.
Summary
Properties
activate | If true the first animation will begin playing when the scene is loaded. |
baseLayer | Returns the base layer of the state graph.[read only] |
playable | Returns whether all component layers are currently playable.[read only] |
playing | Plays or pauses all animations in the component. |
rootBone | The entity that this anim component should use as the root of the animation hierarchy. |
speed | Speed multiplier for animation play back speed. |
stateGraphAsset | The state graph asset this component should use to generate it's animation state graph. |
Methods
assignAnimation | Associates an animation with a state in the loaded state graph. |
findAnimationLayer | Finds a AnimComponentLayer in this component. |
getBoolean | Returns a boolean parameter value by name. |
getFloat | Returns a float parameter value by name. |
getInteger | Returns an integer parameter value by name. |
getTrigger | Returns a trigger parameter value by name. |
loadStateGraph | Initialises component animation controllers using the provided state graph. |
rebind | Rebind all of the components layers. |
removeNodeAnimations | Removes animations from a node in the loaded state graph. |
removeStateGraph | Removes all layers from the anim component. |
reset | Reset all of the components layers and parameters to their initial states. |
resetTrigger | Resets the value of a trigger parameter that was defined in the animation components state graph to false. |
setBoolean | Sets the value of a boolean parameter that was defined in the animation components state graph. |
setFloat | Sets the value of a float parameter that was defined in the animation components state graph. |
setInteger | Sets the value of an integer parameter that was defined in the animation components state graph. |
setTrigger | Sets the value of a trigger parameter that was defined in the animation components state graph to true. |
Inherited
Properties
system | The ComponentSystem used to create this Component. |
entity | The Entity that this Component is attached to. |
enabled | Enables or disables the component. |
Details
Constructor
AnimComponent(system, entity)
Create a new AnimComponent.
Parameters
system | AnimComponentSystem | The ComponentSystem that created this Component. |
entity | Entity | The Entity that this Component is attached to. |
Properties
The entity that this anim component should use as the root of the animation hierarchy.
Speed multiplier for animation play back speed. 1.0 is playback at normal speed, 0.0 pauses the animation.
The state graph asset this component should use to generate it's animation state graph.
Methods
assignAnimation(nodeName, animTrack, [layerName])
Associates an animation with a state in the loaded state graph. If all states are linked and the AnimComponent#activate value was set to true then the component will begin playing.
Parameters
nodeName | string | The name of the state node that this animation should be associated with. |
animTrack | object | The animation track that will be assigned to this state and played whenever this state is active. |
layerName | string | The name of the anim component layer to update. If omitted the default layer is used. |
findAnimationLayer(layerName)
Finds a AnimComponentLayer in this component.
Parameters
layerName | string | The name of the anim component layer to find. |
Returns
AnimComponentLayerLayer.
getBoolean(name)
Returns a boolean parameter value by name.
Parameters
name | string | The name of the boolean to return the value of. |
Returns
booleanA boolean.
getFloat(name)
Returns a float parameter value by name.
Parameters
name | string | The name of the float to return the value of. |
Returns
numberA float.
getInteger(name)
Returns an integer parameter value by name.
Parameters
name | string | The name of the integer to return the value of. |
Returns
numberAn integer.
getTrigger(name)
Returns a trigger parameter value by name.
Parameters
name | string | The name of the trigger to return the value of. |
Returns
booleanA boolean.
loadStateGraph(stateGraph)
Initialises component animation controllers using the provided state graph.
Parameters
stateGraph | object | The state graph asset to load into the component. Contains the states, transitions and parameters used to define a complete animation controller. |
rebind()
Rebind all of the components layers.
removeNodeAnimations(nodeName, [layerName])
Removes animations from a node in the loaded state graph.
Parameters
nodeName | string | The name of the node that should have its animation tracks removed. |
layerName | string | The name of the anim component layer to update. If omitted the default layer is used. |
removeStateGraph()
Removes all layers from the anim component.
reset()
Reset all of the components layers and parameters to their initial states. If a layer was playing before it will continue playing.
resetTrigger(name)
Resets the value of a trigger parameter that was defined in the animation components state graph to false.
Parameters
name | string | The name of the parameter to set. |
setBoolean(name, value)
Sets the value of a boolean parameter that was defined in the animation components state graph.
Parameters
name | string | The name of the parameter to set. |
value | boolean | The new boolean value to set this parameter to. |
setFloat(name, value)
Sets the value of a float parameter that was defined in the animation components state graph.
Parameters
name | string | The name of the parameter to set. |
value | number | The new float value to set this parameter to. |
setInteger(name, value)
Sets the value of an integer parameter that was defined in the animation components state graph.
Parameters
name | string | The name of the parameter to set. |
value | number | The new integer value to set this parameter to. |
setTrigger(name)
Sets the value of a trigger parameter that was defined in the animation components state graph to true.
Parameters
name | string | The name of the parameter to set. |