Create a new AnimComponent instance.
The ComponentSystem that created this Component.
The Entity that this Component is attached to.
The Entity that this Component is attached to.
The ComponentSystem used to create this Component.
Gets whether the first animation will begin playing when the scene is loaded.
Sets whether the first animation will begin playing when the scene is loaded.
Returns the base layer of the state graph.
Gets the enabled state of the component.
Sets the enabled state of the component.
Returns the animation layers available in this anim component.
Gets whether the animation component will normalize the weights of its layers by their sum total.
Sets whether the animation component will normalize the weights of its layers by their sum total.
Returns whether all component layers are currently playable.
Gets whether to play or pause all animations in the component.
Sets whether to play or pause all animations in the component.
Gets the speed multiplier for animation play back speed.
Sets the speed multiplier for animation play back speed. 1.0 is playback at normal speed, 0.0 pauses the animation.
Adds a new anim component layer to the anim component.
The name of the layer to create.
Optional
weight: numberThe blending weight of the layer. Defaults to 1.
Optional
mask: object[]A list of paths to bones in the model which should be animated in this layer. If omitted the full model is used. Defaults to null.
Optional
blendType: stringDefines how properties animated by this layer blend with animations of those properties in previous layers. Defaults to pc.ANIM_LAYER_OVERWRITE.
The created anim component layer.
Associates an animation with a state or blend tree node 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. If no state graph is loaded, a default state graph will be created with a single state based on the provided nodePath parameter.
Either the state name or the path to a blend tree node that this
animation should be associated with. Each section of a blend tree path is split using a
period (.
) therefore state names should not include this character (e.g "MyStateName" or
"MyStateName.BlendTreeNode").
The animation track that will be assigned to this state and played whenever this state is active.
Optional
layerName: stringThe name of the anim component layer to update. If omitted the default layer is used. If no state graph has been previously loaded this parameter is ignored.
Optional
speed: number = 1Update the speed of the state you are assigning an animation to. Defaults to 1.
Optional
loop: boolean = trueUpdate the loop property of the state you are assigning an animation to. Defaults to true.
Finds a AnimComponentLayer in this component.
The name of the anim component layer to find.
Layer.
Fire an event, all additional arguments are passed on to the event listener.
Name of event to fire.
Optional
arg1: anyFirst argument that is passed to the event handler.
Optional
arg2: anySecond argument that is passed to the event handler.
Optional
arg3: anyThird argument that is passed to the event handler.
Optional
arg4: anyFourth argument that is passed to the event handler.
Optional
arg5: anyFifth argument that is passed to the event handler.
Optional
arg6: anySixth argument that is passed to the event handler.
Optional
arg7: anySeventh argument that is passed to the event handler.
Optional
arg8: anyEighth argument that is passed to the event handler.
Self for chaining.
Initializes component animation controllers using the provided state graph.
The state graph asset to load into the component. Contains the states, transitions and parameters used to define a complete animation controller.
Detach an event handler from an event. If callback is not provided then all callbacks are unbound from the event, if scope is not provided then all events with the callback will be unbound.
Optional
name: stringName of the event to unbind.
Optional
callback: HandleEventCallbackFunction to be unbound.
Optional
scope: objectScope that was used as the this when the event is fired.
Self for chaining.
const handler = function () {
};
obj.on('test', handler);
obj.off(); // Removes all events
obj.off('test'); // Removes all events called 'test'
obj.off('test', handler); // Removes all handler functions, called 'test'
obj.off('test', handler, this); // Removes all handler functions, called 'test' with scope this
Attach an event handler to an event.
Name of the event to bind the callback to.
Function that is called when event is fired. Note the callback is limited to 8 arguments.
Optional
scope: object = ...Object to use as 'this' when the event is fired, defaults to current this.
Can be used for removing event in the future.
Attach an event handler to an event. This handler will be removed after being fired once.
Name of the event to bind the callback to.
Function that is called when event is fired. Note the callback is limited to 8 arguments.
Optional
scope: object = ...Object to use as 'this' when the event is fired, defaults to current this.
Removes animations from a node in the loaded state graph.
The name of the node that should have its animation tracks removed.
Optional
layerName: stringThe name of the anim component layer to update. If omitted the default layer is used.
Sets the value of a trigger parameter that was defined in the animation components state graph to true.
The name of the parameter to set.
Optional
singleFrame: boolean = falseIf true, this trigger will be set back to false at the end of the animation update. Defaults to false.
The Anim Component allows an Entity to playback animations on models and entity properties.