The Anim Component Layer allows managers a single layer of the animation state graph.
get activeState(): string
Gets the currently active state name.
string
get activeStateCurrentTime(): number
Gets the active state's time in seconds.
number
set activeStateCurrentTime(time: number): void
Sets the active state's time in seconds.
number
void
get activeStateDuration(): number
Gets the currently active states duration.
number
get activeStateProgress(): number
Gets the currently active state's progress as a value normalized by the state's animation duration. Looped animations will return values greater than 1.
number
get mask(): any
Gets the mask of bones which should be animated or ignored by this layer.
any
set mask(value: any): void
Sets the mask of bones which should be animated or ignored by this layer.
entity.anim.baseLayer.mask = {
// include the spine of the current model and all of its children
'path/to/spine': {
children: true
},
// include the hip of the current model but not all of its children
'path/to/hip': true
}
any
void
get name(): string
Returns the name of the layer.
string
get playable(): boolean
Returns true if a state graph has been loaded and all states in the graph have been assigned animation tracks.
boolean
get playing(): boolean
Gets whether this layer is currently playing.
boolean
set playing(value: boolean): void
Sets whether this layer is currently playing.
boolean
void
get previousState(): null | string
Gets the previously active state name.
null | string
get states(): string[]
Gets all available states in this layers state graph.
string
get transitioning(): boolean
Gets whether the anim component layer is currently transitioning between states.
boolean
get transitionProgress(): null | number
Gets the progress, if the anim component layer is currently transitioning between states. Otherwise returns null.
null | number
get weight(): number
Sets the blending weight of this layer.
number
set weight(value: number): void
Sets the blending weight of this layer. Used when calculating the value of properties that are animated by more than one layer.
number
void
assignAnimation(
nodePath: string,
animTrack: AnimTrack,
speed?: number,
loop?: boolean): void
Assigns an animation track to a state or blend tree node in the current graph. If a state for the given nodePath doesn't exist, it will be created. If all states nodes are linked and the AnimComponent#activate value was set to true then the component will begin playing.
string
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.
number
Update the speed of the state you are assigning an animation to. Defaults to 1.
boolean
Update the loop property of the state you are assigning an animation to. Defaults to true.
void
blendToWeight(weight: number, time: number): void
Blend from the current weight value to the provided weight value over a given amount of time.
number
The new weight value to blend to.
number
The duration of the blend in seconds.
void
getAnimationAsset(stateName: string): {
asset: number;
}
Returns an object holding the animation asset id that is associated with the given state.
string
The name of the state to get the asset for.
{
asset: number
}
An object containing the animation asset id associated with the given state.
asset: number
pause(): void
Pause the animation in the current state.
void
play(name?: string): void
Start playing the animation in the current state.
string
If provided, will begin playing from the start of the state with this name.
void
rebind(): void
Rebind any animations in the layer to the currently present components and model of the anim components entity.
void
removeNodeAnimations(nodeName: string): void
Removes animations from a node in the loaded state graph.
string
The name of the node that should have its animation tracks removed.
void
reset(): void
Reset the animation component to its initial state, including all parameters. The system will be paused.
void
transition(
to: string,
time?: number,
transitionOffset?: number): void
Transition to any state in the current layers graph. Transitions can be instant or take an optional blend time.
string
The state that this transition will transition to.
number = 0
The duration of the transition in seconds. Defaults to 0.
number = null
If provided, the destination state will begin playing its animation at this time. Given in normalized time, based on the states duration & must be between 0 and 1. Defaults to null.
void