Skip to content

Documentation / scene / AnimationSet

Class: AnimationSet

Defined in: libs/scene/src/animation/animationset.ts:1356

Animation set

Manages a collection of named animation clips for a model and orchestrates:

  • Playback state (time, loops, speed, weights, fade-in/out).
  • Blending across multiple tracks targeting the same property via weighted averages.
  • Skeleton usage and application for clips that drive skeletal animation.
  • Active track registration and cleanup as clips start/stop.

Usage:

  • Create or retrieve AnimationClips by name.
  • Start playback with playAnimation(name, options).
  • Advance animation with update(deltaSeconds).
  • Optionally adjust weight while playing with setAnimationWeight(name, weight).

Lifetime:

  • Disposing the set releases references to the model, clips, and clears active state.

Extends

  • object & Disposable<this>

Implements

  • IDisposable

Constructors

Constructor

new AnimationSet(model): AnimationSet

Defined in: libs/scene/src/animation/animationset.ts:1387

Create an AnimationSet controlling the provided model.

Parameters

model

SceneNode

The SceneNode (model root) controlled by this animation set.

Returns

AnimationSet

Overrides

makeObservable(Disposable)<AnimationSetEventMap>().constructor

Accessors

disposed

Get Signature

get disposed(): boolean

Defined in: libs/base/dist/index.d.ts:6107

Returns

boolean

Implementation of

IDisposable.disposed

Inherited from

makeObservable(Disposable)<AnimationSetEventMap>().disposed


model

Get Signature

get model(): SceneNode

Defined in: libs/scene/src/animation/animationset.ts:1416

The model (SceneNode) controlled by this animation set.

Returns

SceneNode


numAnimations

Get Signature

get numAnimations(): number

Defined in: libs/scene/src/animation/animationset.ts:1422

Number of animation clips registered in this set.

Returns

number


skeletons

Get Signature

get skeletons(): DRef<SkinBinding>[]

Defined in: libs/scene/src/animation/animationset.ts:1428

The skeletons used by animations in this set.

Returns

DRef<SkinBinding>[]


rigs

Get Signature

get rigs(): DRef<SkeletonRig>[]

Defined in: libs/scene/src/animation/animationset.ts:1434

The shared rigs used by animations in this set.

Returns

DRef<SkeletonRig>[]


skinBindings

Get Signature

get skinBindings(): DRef<SkinBinding>[]

Defined in: libs/scene/src/animation/animationset.ts:1440

Per-skin bindings used by skinned meshes in this set.

Returns

DRef<SkinBinding>[]

Methods

on()

Call Signature

on<K>(type, listener, context?): void

Defined in: libs/base/dist/index.d.ts:671

IEventTarget.on

Type Parameters
K

K extends "dispose" | keyof AnimationSetEventMap

Parameters
type

K

listener

EventListener<AnimationSetEventMap & object, K>

context?

unknown

Returns

void

Implementation of

IDisposable.on

Inherited from

makeObservable(Disposable)<AnimationSetEventMap>().on

Call Signature

on<K>(type, listener, context?): void

Defined in: libs/base/dist/index.d.ts:630

IEventTarget.on

Type Parameters
K

K extends "dispose"

Parameters
type

K

listener

EventListener<{ dispose: []; }, K>

context?

unknown

Returns

void

Implementation of

IDisposable.on

Inherited from

makeObservable(Disposable)<AnimationSetEventMap>().on


once()

Call Signature

once<K>(type, listener, context?): void

Defined in: libs/base/dist/index.d.ts:675

IEventTarget.once

Type Parameters
K

K extends "dispose" | keyof AnimationSetEventMap

Parameters
type

K

listener

EventListener<AnimationSetEventMap & object, K>

context?

unknown

Returns

void

Implementation of

IDisposable.once

Inherited from

makeObservable(Disposable)<AnimationSetEventMap>().once

Call Signature

once<K>(type, listener, context?): void

Defined in: libs/base/dist/index.d.ts:634

IEventTarget.once

Type Parameters
K

K extends "dispose"

Parameters
type

K

listener

EventListener<{ dispose: []; }, K>

context?

unknown

Returns

void

Implementation of

IDisposable.once

Inherited from

makeObservable(Disposable)<AnimationSetEventMap>().once


off()

Call Signature

off<K>(type, listener, context?): void

Defined in: libs/base/dist/index.d.ts:679

IEventTarget.off

Type Parameters
K

K extends "dispose" | keyof AnimationSetEventMap

Parameters
type

K

listener

EventListener<AnimationSetEventMap & object, K>

context?

unknown

Returns

void

Implementation of

IDisposable.off

Inherited from

makeObservable(Disposable)<AnimationSetEventMap>().off

Call Signature

off<K>(type, listener?, context?): void

Defined in: libs/base/dist/index.d.ts:638

IEventTarget.off

Type Parameters
K

K extends "dispose"

Parameters
type

K

listener?

EventListener<{ dispose: []; }>

context?

unknown

Returns

void

Implementation of

IDisposable.off

Inherited from

makeObservable(Disposable)<AnimationSetEventMap>().off


dispatchEvent()

Call Signature

dispatchEvent<K>(type, ...args): void

Defined in: libs/base/dist/index.d.ts:683

IEventTarget.dispatchEvent

Type Parameters
K

K extends "dispose" | keyof AnimationSetEventMap

Parameters
type

K

args

...AnimationSetEventMap & object[K]

Returns

void

Implementation of

IDisposable.dispatchEvent

Inherited from

makeObservable(Disposable)<AnimationSetEventMap>().dispatchEvent

Call Signature

dispatchEvent<K>(type, ...args): void

Defined in: libs/base/dist/index.d.ts:642

IEventTarget.dispatchEvent

Type Parameters
K

K extends "dispose"

Parameters
type

K

args

...object[K]

Returns

void

Implementation of

IDisposable.dispatchEvent

Inherited from

makeObservable(Disposable)<AnimationSetEventMap>().dispatchEvent


dispose()

dispose(): void

Defined in: libs/base/dist/index.d.ts:6108

Returns

void

Implementation of

IDisposable.dispose

Inherited from

makeObservable(Disposable)<AnimationSetEventMap>().dispose


get()

get(name): AnimationClip

Defined in: libs/scene/src/animation/animationset.ts:1467

Retrieve an animation clip by name.

Parameters

name

string

Name of the animation.

Returns

AnimationClip

The clip if present; otherwise null.


createAnimation()

createAnimation(name, embedded?): AnimationClip

Defined in: libs/scene/src/animation/animationset.ts:1477

Create and register a new animation clip.

Parameters

name

string

Unique name for the animation clip.

embedded?

boolean = false

Whether the clip is embedded/owned (implementation-specific). Default false.

Returns

AnimationClip

The created clip, or null if the name is empty or not unique.


deleteAnimation()

deleteAnimation(name): void

Defined in: libs/scene/src/animation/animationset.ts:1495

Delete and dispose an animation clip by name.

  • If the animation is currently playing, it is first stopped (immediately).

Parameters

name

string

Name of the animation to remove.

Returns

void


getAnimationNames()

getAnimationNames(): string[]

Defined in: libs/scene/src/animation/animationset.ts:1508

Get the list of all registered animation names.

Returns

string[]

An array of clip names.


update()

update(deltaInSeconds): void

Defined in: libs/scene/src/animation/animationset.ts:1523

Advance and apply active animations.

Responsibilities per call:

  • Update time cursor for each active clip (respecting speedRatio and looping).
  • Enforce repeat limits and apply fade-out termination if configured.
  • For each animated target, blend active tracks (weighted by clip weight × fade-in × fade-out) and apply the resulting state to the target.
  • Apply shared rig modifiers once, then update skin binding palettes.

Parameters

deltaInSeconds

number

Time step in seconds since last update.

Returns

void


isPlayingAnimation()

isPlayingAnimation(name?): boolean

Defined in: libs/scene/src/animation/animationset.ts:1667

Check whether an animation is currently playing.

Parameters

name?

string

Optional animation name. If omitted, returns true if any animation is playing.

Returns

boolean

True if playing; otherwise false.


getAnimationClip()

getAnimationClip(name): AnimationClip

Defined in: libs/scene/src/animation/animationset.ts:1682

Get an animation clip by name.

Alias of get(name) returning a nullable type.

Parameters

name

string

Name of the animation.

Returns

AnimationClip

The clip if present; otherwise null.


setAnimationWeight()

setAnimationWeight(name, weight): void

Defined in: libs/scene/src/animation/animationset.ts:1693

Set the runtime blend weight for a currently playing animation.

Has no effect if the clip is not active.

Parameters

name

string

Name of the playing animation.

weight

number

New weight value used during blending.

Returns

void


createPlayback()

createPlayback(name, options?): AnimationPlayback

Defined in: libs/scene/src/animation/animationset.ts:1709

Create a playback handle without starting it.

Parameters

name

string

options?

PlayAnimationOptions

Returns

AnimationPlayback


play()

play(name, options?): AnimationPlayback

Defined in: libs/scene/src/animation/animationset.ts:1720

Start an animation and return its playback handle.

Parameters

name

string

options?

PlayAnimationOptions

Returns

AnimationPlayback


getPlaybacks()

getPlaybacks(name?): AnimationPlayback[]

Defined in: libs/scene/src/animation/animationset.ts:1728

Get currently active playbacks.

Parameters

name?

string

Returns

AnimationPlayback[]


getPlayback()

getPlayback(name): AnimationPlayback

Defined in: libs/scene/src/animation/animationset.ts:1740

Get the currently active playback for a clip.

Parameters

name

string

Returns

AnimationPlayback


playAnimation()

playAnimation(name, options?): void

Defined in: libs/scene/src/animation/animationset.ts:1755

Start (or update) playback of an animation clip.

Behavior:

  • If the clip is already playing, stops it first.
  • Otherwise initializes playback state (repeat counter, speed, weight, initial time).
  • Registers clip tracks and skeletons into the active sets for blending and application.

Parameters

name

string

Name of the animation to play.

options?

PlayAnimationOptions

Playback options (repeat, speedRatio, fadeIn).

Returns

void


stopAnimation()

stopAnimation(name, options?): void

Defined in: libs/scene/src/animation/animationset.ts:2144

Stop playback of an animation clip.

Behavior:

  • If options.fadeOut > 0, marks the clip for fade-out; actual removal occurs after fade completes.
  • If fadeOut is 0 or omitted, immediately:
    • Removes the clip from active animations.
    • Unregisters its tracks from active track maps.
    • Decrements skeleton reference counts; resets and removes skeletons when refcount reaches 0.

Parameters

name

string

Name of the animation to stop.

options?

StopAnimationOptions

Optional fade-out configuration.

Returns

void


createSkeletalMaskedAnimation()

createSkeletalMaskedAnimation(sourceName, targetName, options): AnimationClip

Defined in: libs/scene/src/animation/animationset.ts:2223

Create a skeletal-only masked clip from an existing clip in this set.

The generated clip is a regular AnimationClip: it contains cloned node transform tracks for the selected rig joints and can be played/blended through the normal animation system. Non-skeletal tracks are skipped by default.

Parameters

sourceName

string

Name of the source clip.

targetName

string

Name of the generated clip.

options

SkeletalAnimationMaskOptions

Humanoid semantic or joint-name based mask options.

Returns

AnimationClip

The generated clip, or null on failure.


copyHumanoidAnimationFrom()

Call Signature

copyHumanoidAnimationFrom(sourceSet, animationName, options?): AnimationClip

Defined in: libs/scene/src/animation/animationset.ts:2253

Copy a humanoid animation clip from another AnimationSet into this one via humanoid rig mapping.

Prerequisites:

  • Both source and destination skeletons must have a non-null humanoidJointMapping.
  • Joints are matched by shared HumanoidBodyRig / HumanoidHandRig keys instead of joint names.
  • The source clip must exist in sourceSet and must be driven by exactly one skeleton.
Parameters
sourceSet

AnimationSet

The AnimationSet to copy from.

animationName

string

Name of the clip to copy.

options?

CopyHumanoidAnimationOptions

Returns

AnimationClip

The newly created AnimationClip, or null on failure.

Call Signature

copyHumanoidAnimationFrom(sourceSet, animationName, targetName?, options?): AnimationClip

Defined in: libs/scene/src/animation/animationset.ts:2258

Copy a humanoid animation clip from another AnimationSet into this one via humanoid rig mapping.

Prerequisites:

  • Both source and destination skeletons must have a non-null humanoidJointMapping.
  • Joints are matched by shared HumanoidBodyRig / HumanoidHandRig keys instead of joint names.
  • The source clip must exist in sourceSet and must be driven by exactly one skeleton.
Parameters
sourceSet

AnimationSet

The AnimationSet to copy from.

animationName

string

Name of the clip to copy.

targetName?

string

Name for the new clip in this set. Defaults to animationName.

options?

CopyHumanoidAnimationOptions

Returns

AnimationClip

The newly created AnimationClip, or null on failure.


copyAnimationFrom()

copyAnimationFrom(sourceSet, animationName, targetName?, excludeJoint?): AnimationClip

Defined in: libs/scene/src/animation/animationset.ts:2715

Copy an animation clip from another AnimationSet into this one.

Prerequisites:

  • Both sets must reference skeletons with identical joint names and counts.
  • The source clip must exist in sourceSet.

Parameters

sourceSet

AnimationSet

The AnimationSet to copy from.

animationName

string

Name of the clip to copy.

targetName?

string

Name for the new clip in this set. Defaults to animationName.

excludeJoint?

(jointName) => boolean

Optional predicate; joints whose name returns true are excluded from skeleton structure matching.

Returns

AnimationClip

The newly created AnimationClip, or null on failure.

Deprecated

Use AnimationSet.copyHumanoidAnimationFrom instead.


resetSkeletonModifiers()

resetSkeletonModifiers(): void

Defined in: libs/scene/src/animation/animationset.ts:2886

Reset all skeleton modifiers

Returns

void


onDispose()

protected onDispose(): void

Defined in: libs/scene/src/animation/animationset.ts:2901

Dispose the animation set and release owned resources.

  • Disposes the weak reference to the model.
  • Disposes all registered animation clips.
  • Clears active animations, tracks, and skeleton references.

Returns

void

Overrides

makeObservable(Disposable)<AnimationSetEventMap>().onDispose

Released under the MIT License.