Skip to content

Documentation / scene / AnimationClip

Class: AnimationClip ​

Defined in: libs/scene/src/animation/animation.ts:60

Animation clip

Represents a named animation composed of multiple tracks targeting various objects/properties, with an overall duration, weight, and optional auto-play behavior. Tracks may target different objects and are grouped by a per-target array. Skeletons used by this clip are tracked for lifecycle and application during playback.

Typical workflow:

  • Create a clip via AnimationSet.createAnimation(name).
  • Add one or more AnimationTracks via addTrack(target, track).
  • Optionally register skeletons via addSkeleton(...).
  • Start playback through the owning AnimationSet.playAnimation(name, options).

Extends ​

  • Disposable

Constructors ​

Constructor ​

new AnimationClip(name, animationSet, embedded?): AnimationClip

Defined in: libs/scene/src/animation/animation.ts:85

Creates an animation instance

Parameters ​

name ​

string

Name of the animation

animationSet ​

AnimationSet

embedded? ​

boolean = false

Returns ​

AnimationClip

Overrides ​

Disposable.constructor

Properties ​

_weight ​

protected _weight: number

Defined in: libs/scene/src/animation/animation.ts:73

Accessors ​

disposed ​

Get Signature ​

get disposed(): boolean

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

Returns ​

boolean

Inherited from ​

Disposable.disposed


embedded ​

Get Signature ​

get embedded(): boolean

Defined in: libs/scene/src/animation/animation.ts:101

Whether this clip is embedded (owned inline by its container/resource).

Returns ​

boolean


animationSet ​

Get Signature ​

get animationSet(): AnimationSet

Defined in: libs/scene/src/animation/animation.ts:107

The AnimationSet that owns this clip.

Returns ​

AnimationSet


weight ​

Get Signature ​

get weight(): number

Defined in: libs/scene/src/animation/animation.ts:115

Global blend weight for the clip.

Used by the animation system when combining multiple active clips.

Returns ​

number

Set Signature ​

set weight(val): void

Defined in: libs/scene/src/animation/animation.ts:118

Parameters ​
val ​

number

Returns ​

void


autoPlay ​

Get Signature ​

get autoPlay(): boolean

Defined in: libs/scene/src/animation/animation.ts:124

Whether this clip should start playing automatically when loaded/instantiated.

Returns ​

boolean

Set Signature ​

set autoPlay(val): void

Defined in: libs/scene/src/animation/animation.ts:127

Parameters ​
val ​

boolean

Returns ​

void


name ​

Get Signature ​

get name(): string

Defined in: libs/scene/src/animation/animation.ts:133

The unique name of this clip.

Returns ​

string


tracks ​

Get Signature ​

get tracks(): Map<object, AnimationTrack<unknown>[]>

Defined in: libs/scene/src/animation/animation.ts:141

All animation tracks grouped by target object.

Key: target object; Value: list of AnimationTracks affecting that target.

Returns ​

Map<object, AnimationTrack<unknown>[]>


skeletons ​

Get Signature ​

get skeletons(): Set<string>

Defined in: libs/scene/src/animation/animation.ts:147

All skeletons referenced by this clip.

Returns ​

Set<string>

Set Signature ​

set skeletons(val): void

Defined in: libs/scene/src/animation/animation.ts:150

Parameters ​
val ​

Set<string>

Returns ​

void


frameRate ​

Get Signature ​

get frameRate(): number

Defined in: libs/scene/src/animation/animation.ts:156

Default frame rate used to convert frame-based marker references.

Returns ​

number

Set Signature ​

set frameRate(val): void

Defined in: libs/scene/src/animation/animation.ts:159

Parameters ​
val ​

number

Returns ​

void


markers ​

Get Signature ​

get markers(): AnimationMarker[]

Defined in: libs/scene/src/animation/animation.ts:167

Timeline markers stored on this clip.

Returns ​

AnimationMarker[]


timeDuration ​

Get Signature ​

get timeDuration(): number

Defined in: libs/scene/src/animation/animation.ts:175

Total time span of the clip in seconds.

Automatically extended when adding tracks with longer duration.

Returns ​

number

Set Signature ​

set timeDuration(val): void

Defined in: libs/scene/src/animation/animation.ts:178

Parameters ​
val ​

number

Returns ​

void

Methods ​

on() ​

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

Inherited from ​

Disposable.on


once() ​

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

Inherited from ​

Disposable.once


off() ​

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

Inherited from ​

Disposable.off


dispatchEvent() ​

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

Inherited from ​

Disposable.dispatchEvent


dispose() ​

dispose(): void

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

Returns ​

void

Inherited from ​

Disposable.dispose


onDispose() ​

protected onDispose(): void

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

Returns ​

void

Inherited from ​

Disposable.onDispose


addMarker() ​

addMarker(marker): AnimationMarker

Defined in: libs/scene/src/animation/animation.ts:187

Add a serializable marker to this clip.

Parameters ​

marker ​

AnimationMarker

Marker metadata. If id is omitted, name is used as the id.

Returns ​

AnimationMarker

The normalized marker.


removeMarker() ​

removeMarker(idOrName): boolean

Defined in: libs/scene/src/animation/animation.ts:207

Remove markers matching the marker id or name.

Parameters ​

idOrName ​

string

Returns ​

boolean


getMarker() ​

getMarker(idOrName): AnimationMarker

Defined in: libs/scene/src/animation/animation.ts:215

Get the first marker matching the marker id or name.

Parameters ​

idOrName ​

string

Returns ​

AnimationMarker


resolveMarkerTime() ​

resolveMarkerTime(marker): number

Defined in: libs/scene/src/animation/animation.ts:221

Resolve a marker to seconds on this clip's timeline.

Parameters ​

marker ​

AnimationMarker

Returns ​

number


resolveTimeRef() ​

resolveTimeRef(ref): number

Defined in: libs/scene/src/animation/animation.ts:234

Resolve a time reference to seconds on this clip's timeline.

Parameters ​

ref ​

AnimationTimeRef

Returns ​

number


addSkeleton() ​

addSkeleton(skeletonId): void

Defined in: libs/scene/src/animation/animation.ts:259

Add a skeleton used by this clip.

Parameters ​

skeletonId ​

string

Persistent ID of Skeleton to register for this clip.

Returns ​

void


deleteTrack() ​

deleteTrack(track): AnimationClip

Defined in: libs/scene/src/animation/animation.ts:270

Remove a specific track from this clip.

Errors if the track does not belong to this clip. Does nothing if not found.

Parameters ​

track ​

AnimationTrack

The track instance to remove.

Returns ​

AnimationClip

This clip (for chaining).


addTrack() ​

addTrack(target, track): AnimationClip

Defined in: libs/scene/src/animation/animation.ts:299

Add a track to this clip for a specific target object.

Constraints:

  • The track must not already belong to another clip.
  • Only one track with the same blendId may exist per target in a single clip.

Side effects:

  • Assigns this clip to track.animation.
  • Extends timeDuration to cover the track duration if longer.
  • Calls track.reset(target) to initialize the target state if needed.

Parameters ​

target ​

object

Target object controlled by the track.

track ​

AnimationTrack

Track to add.

Returns ​

AnimationClip

This clip (for chaining).

Released under the MIT License.