API Reference

Class List

AnimationComponent

Extends: Component

The Animation Component allows an Entity to playback animations on models.

Summary

Properties

activate

If true the first animation asset will begin playing when the scene is loaded.

animations

Get or Set dictionary of animations by name.

assets

The array of animation assets - can also be an array of asset ids.

currentTime

Get or Set the current time position (in seconds) of the animation.

duration

Get the duration in seconds of the current animation.

loop

If true the animation will restart from the beginning when it reaches the end.

skeleton

Get the skeleton for the current model; unless model is from glTF/glb, then skeleton is null.

speed

Speed multiplier for animation play back speed.

Methods

getAnimation

Return an animation.

play

Start playing an animation.

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

AnimationComponent(system, entity)

Create a new AnimationComponent.

Parameters

systemAnimationComponentSystem

The ComponentSystem that created this Component.

entityEntity

The Entity that this Component is attached to.

Properties

booleanactivate

If true the first animation asset will begin playing when the scene is loaded.

{ [string]: Animation }animations

Get or Set dictionary of animations by name.

Asset[], number[]assets

The array of animation assets - can also be an array of asset ids.

numbercurrentTime

Get or Set the current time position (in seconds) of the animation.

numberduration

Get the duration in seconds of the current animation. [read only]

booleanloop

If true the animation will restart from the beginning when it reaches the end.

Skeleton, nullskeleton

Get the skeleton for the current model; unless model is from glTF/glb, then skeleton is null. [read only]

numberspeed

Speed multiplier for animation play back speed. 1.0 is playback at normal speed, 0.0 pauses the animation.

Methods

getAnimation(name)

Return an animation.

Parameters

namestring

The name of the animation asset.

Returns

Animation

An Animation.

play(name, [blendTime])

Start playing an animation.

Parameters

namestring

The name of the animation asset to begin playing.

blendTimenumber

The time in seconds to blend from the current animation state to the start of the animation being set. Defaults to 0.

Inherited

Properties

ComponentSystemsystem

The ComponentSystem used to create this Component.

Entityentity

The Entity that this Component is attached to.

booleanenabled

Enables or disables the component.