Documentation / scene / AnimationTrack
Abstract Class: AnimationTrack<StateType>
Defined in: libs/scene/src/animation/animationtrack.ts:19
Base class for animation tracks.
A track produces time-varying state for a specific target and defines how to:
- Compute state at a given time (
calculateState) - Apply that state to a target (
applyState) - Blend between two states (
mixState) - Report its blend compatibility (
getBlendId) - Report its intrinsic duration (
getDuration)
Generic:
StateTypeis the shape of the computed/applied state (e.g., number, vector, pose).
Extended by
NodeTranslationTrackNodeRotationTrackNodeEulerRotationTrackNodeScaleTrackPropertyTrackMorphTargetTrackMorphTargetGroupTrackFixedGeometryCacheTrackPCAGeometryCacheTrack
Type Parameters
StateType
StateType = unknown
Constructors
Constructor
new AnimationTrack<
StateType>(embedded?):AnimationTrack<StateType>
Defined in: libs/scene/src/animation/animationtrack.ts:35
Construct a new animation track.
Parameters
embedded?
boolean
Whether this track is embedded/owned inline by its container. Default false.
Returns
AnimationTrack<StateType>
Accessors
name
Get Signature
get name():
string
Defined in: libs/scene/src/animation/animationtrack.ts:45
Human-readable name of the track.
Returns
string
Set Signature
set name(
val):void
Defined in: libs/scene/src/animation/animationtrack.ts:48
Parameters
val
string
Returns
void
embedded
Get Signature
get embedded():
boolean
Defined in: libs/scene/src/animation/animationtrack.ts:54
Whether this track is embedded (owned inline by a resource/container).
Returns
boolean
animation
Get Signature
get animation():
AnimationClip
Defined in: libs/scene/src/animation/animationtrack.ts:60
The AnimationClip that owns this track.
Returns
Set Signature
set animation(
ani):void
Defined in: libs/scene/src/animation/animationtrack.ts:63
Parameters
ani
Returns
void
target
Get Signature
get target():
string
Defined in: libs/scene/src/animation/animationtrack.ts:72
Logical target identifier for this track (optional metadata).
This does not affect application; it can be used by tooling or higher-level systems to label/group tracks.
Returns
string
Set Signature
set target(
val):void
Defined in: libs/scene/src/animation/animationtrack.ts:75
Parameters
val
string
Returns
void
jointIndex
Get Signature
get jointIndex():
number
Defined in: libs/scene/src/animation/animationtrack.ts:81
Joint index if this track controls a joint, otherwise -1
Returns
number
Set Signature
set jointIndex(
index):void
Defined in: libs/scene/src/animation/animationtrack.ts:84
Parameters
index
number
Returns
void
Methods
clone()
abstractclone():this
Defined in: libs/scene/src/animation/animationtrack.ts:90
Clone this animation track
Returns
this
reset()
reset(
_target):void
Defined in: libs/scene/src/animation/animationtrack.ts:98
Reset the track to its initial state for the given target.
Intended to stop playback and rewind the target to the first frame or default state.
Parameters
_target
object
The animated object to reset.
Returns
void
calculateState()
abstractcalculateState(target,currentTime):StateType
Defined in: libs/scene/src/animation/animationtrack.ts:109
Compute the animation state at the specified time.
Implementations should be pure with respect to inputs: given the same target and currentTime, return the same StateType.
Parameters
target
object
The animated object (used to resolve current baseline if needed).
currentTime
number
Time cursor in seconds within the track's timeline.
Returns
StateType
The computed state at currentTime.
applyState()
abstractapplyState(target,state):unknown
Defined in: libs/scene/src/animation/animationtrack.ts:116
Apply a previously computed animation state to the target.
Parameters
target
object
The animated object to modify.
state
StateType
The state to apply.
Returns
unknown
mixState()
abstractmixState(a,b,t):StateType
Defined in: libs/scene/src/animation/animationtrack.ts:125
Blend two states into a new state using a weight.
Parameters
a
StateType
First state.
b
StateType
Second state.
t
number
Blend weight in [0, 1], where 0 yields a and 1 yields b.
Returns
StateType
The blended state.
getBlendId()
abstractgetBlendId():unknown
Defined in: libs/scene/src/animation/animationtrack.ts:134
Get the blend identifier for this track.
Tracks with the same blend ID are considered compatible for blending on the same target channel/property.
Returns
unknown
An identifier used to group compatible tracks for blending.
getDuration()
abstractgetDuration():number
Defined in: libs/scene/src/animation/animationtrack.ts:142
Get the intrinsic duration of this track in seconds.
Used by clips to determine overall clip duration and looping behavior.
Returns
number
Track duration (seconds).