Documentation / scene / AnimationSet
Class: AnimationSet
Defined in: libs/scene/src/animation/animationset.ts:1303
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:1334
Create an AnimationSet controlling the provided model.
Parameters
model
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:6065
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:1363
The model (SceneNode) controlled by this animation set.
Returns
numAnimations
Get Signature
get numAnimations():
number
Defined in: libs/scene/src/animation/animationset.ts:1369
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:1375
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:1381
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:1387
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:635
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:594
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:639
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:598
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:643
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:602
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:647
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:606
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:6066
Returns
void
Implementation of
IDisposable.dispose
Inherited from
makeObservable(Disposable)<AnimationSetEventMap>().dispose
get()
get(
name):AnimationClip
Defined in: libs/scene/src/animation/animationset.ts:1414
Retrieve an animation clip by name.
Parameters
name
string
Name of the animation.
Returns
The clip if present; otherwise null.
createAnimation()
createAnimation(
name,embedded?):AnimationClip
Defined in: libs/scene/src/animation/animationset.ts:1424
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
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:1442
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:1455
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:1470
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:1614
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:1629
Get an animation clip by name.
Alias of get(name) returning a nullable type.
Parameters
name
string
Name of the animation.
Returns
The clip if present; otherwise null.
setAnimationWeight()
setAnimationWeight(
name,weight):void
Defined in: libs/scene/src/animation/animationset.ts:1640
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:1656
Create a playback handle without starting it.
Parameters
name
string
options?
Returns
play()
play(
name,options?):AnimationPlayback
Defined in: libs/scene/src/animation/animationset.ts:1667
Start an animation and return its playback handle.
Parameters
name
string
options?
Returns
getPlaybacks()
getPlaybacks(
name?):AnimationPlayback[]
Defined in: libs/scene/src/animation/animationset.ts:1675
Get currently active playbacks.
Parameters
name?
string
Returns
getPlayback()
getPlayback(
name):AnimationPlayback
Defined in: libs/scene/src/animation/animationset.ts:1687
Get the currently active playback for a clip.
Parameters
name
string
Returns
playAnimation()
playAnimation(
name,options?):void
Defined in: libs/scene/src/animation/animationset.ts:1702
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?
Playback options (repeat, speedRatio, fadeIn).
Returns
void
stopAnimation()
stopAnimation(
name,options?):void
Defined in: libs/scene/src/animation/animationset.ts:2091
Stop playback of an animation clip.
Behavior:
- If
options.fadeOut > 0, marks the clip for fade-out; actual removal occurs after fade completes. - If
fadeOutis 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?
Optional fade-out configuration.
Returns
void
createSkeletalMaskedAnimation()
createSkeletalMaskedAnimation(
sourceName,targetName,options):AnimationClip
Defined in: libs/scene/src/animation/animationset.ts:2170
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
Humanoid semantic or joint-name based mask options.
Returns
The generated clip, or null on failure.
copyHumanoidAnimationFrom()
Call Signature
copyHumanoidAnimationFrom(
sourceSet,animationName,options?):AnimationClip
Defined in: libs/scene/src/animation/animationset.ts:2200
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/HumanoidHandRigkeys instead of joint names. - The source clip must exist in
sourceSetand must be driven by exactly one skeleton.
Parameters
sourceSet
AnimationSet
The AnimationSet to copy from.
animationName
string
Name of the clip to copy.
options?
Returns
The newly created AnimationClip, or null on failure.
Call Signature
copyHumanoidAnimationFrom(
sourceSet,animationName,targetName?,options?):AnimationClip
Defined in: libs/scene/src/animation/animationset.ts:2205
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/HumanoidHandRigkeys instead of joint names. - The source clip must exist in
sourceSetand 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?
Returns
The newly created AnimationClip, or null on failure.
copyAnimationFrom()
copyAnimationFrom(
sourceSet,animationName,targetName?,excludeJoint?):AnimationClip
Defined in: libs/scene/src/animation/animationset.ts:2619
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
The newly created AnimationClip, or null on failure.
Deprecated
Use AnimationSet.copyHumanoidAnimationFrom instead.
resetSkeletonModifiers()
resetSkeletonModifiers():
void
Defined in: libs/scene/src/animation/animationset.ts:2790
Reset all skeleton modifiers
Returns
void
onDispose()
protectedonDispose():void
Defined in: libs/scene/src/animation/animationset.ts:2805
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