Skip to content

Documentation / scene / PropertyTrack

Class: PropertyTrack

Defined in: libs/scene/src/animation/proptrack.ts:25

Property animation track

Animates a single property (scalar, vector, or color) on a target object using time-based interpolation. Supports:

  • float, vec2, vec3/rgb, vec4, rgba property types
  • Separate interpolation for RGB and Alpha in RGBA mode
  • Linear and cubic spline (natural) interpolation presets

The track reads a PropertyAccessor which encapsulates how to get/set the property on the target object. Internally, the current state is represented as a numeric array.

Notes:

  • calculateState samples interpolators into an internal reusable state instance for performance; consumers should treat returned states as ephemeral.
  • mixState performs component-wise linear interpolation for blending.

Extends

Constructors

Constructor

new PropertyTrack(prop, value?, embedded?): PropertyTrack

Defined in: libs/scene/src/animation/proptrack.ts:44

Construct a PropertyTrack for a specific property.

Initializes interpolators and internal state based on the property type. If an initial value is provided, it seeds the starting state and default key values.

Parameters

prop

PropertyAccessor

The property accessor describing what and how to animate.

value?

number[]

Optional initial numeric values (length must match the property type).

embedded?

boolean

Whether this track is embedded/owned inline. Default false.

Returns

PropertyTrack

Throws

Error if the property type is unsupported for animation.

Overrides

AnimationTrack.constructor

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

Inherited from

AnimationTrack.name


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

Inherited from

AnimationTrack.embedded


animation

Get Signature

get animation(): AnimationClip

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

The AnimationClip that owns this track.

Returns

AnimationClip

Set Signature

set animation(ani): void

Defined in: libs/scene/src/animation/animationtrack.ts:63

Parameters
ani

AnimationClip

Returns

void

Inherited from

AnimationTrack.animation


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

Inherited from

AnimationTrack.target


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

Inherited from

AnimationTrack.jointIndex


interpolator

Get Signature

get interpolator(): Interpolator

Defined in: libs/scene/src/animation/proptrack.ts:122

The primary interpolator for the property components.

  • For float/vec2/vec3/vec4/rgb: handles all channels.
  • For rgba: handles RGB channels only; alpha is handled by interpolatorAlpha.
Returns

Interpolator

Set Signature

set interpolator(interpolator): void

Defined in: libs/scene/src/animation/proptrack.ts:125

Parameters
interpolator

Interpolator

Returns

void


interpolatorAlpha

Get Signature

get interpolatorAlpha(): Interpolator

Defined in: libs/scene/src/animation/proptrack.ts:134

The alpha-channel interpolator for RGBA properties.

  • Only used when the property type is rgba.
  • Setting a non-null interpolator ensures alpha state storage is allocated.
Returns

Interpolator

Set Signature

set interpolatorAlpha(interpolator): void

Defined in: libs/scene/src/animation/proptrack.ts:137

Parameters
interpolator

Interpolator

Returns

void

Methods

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

Inherited from

AnimationTrack.reset


clone()

clone(): this

Defined in: libs/scene/src/animation/proptrack.ts:113

Clone this animation track

Returns

this

Overrides

AnimationTrack.clone


calculateState()

calculateState(target, currentTime): number[]

Defined in: libs/scene/src/animation/proptrack.ts:144

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

unknown

The animated object (used to resolve current baseline if needed).

currentTime

number

Time cursor in seconds within the track's timeline.

Returns

number[]

The computed state at currentTime.

Overrides

AnimationTrack.calculateState


applyState()

applyState(target, state): void

Defined in: libs/scene/src/animation/proptrack.ts:153

Apply a previously computed animation state to the target.

Parameters

target

object

The animated object to modify.

state

number[]

The state to apply.

Returns

void

Overrides

AnimationTrack.applyState


mixState()

mixState(a, b, t): number[]

Defined in: libs/scene/src/animation/proptrack.ts:157

Blend two states into a new state using a weight.

Parameters

a

number[]

First state.

b

number[]

Second state.

t

number

Blend weight in [0, 1], where 0 yields a and 1 yields b.

Returns

number[]

The blended state.

Overrides

AnimationTrack.mixState


getBlendId()

getBlendId(): PropertyAccessor

Defined in: libs/scene/src/animation/proptrack.ts:165

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

PropertyAccessor

An identifier used to group compatible tracks for blending.

Overrides

AnimationTrack.getBlendId


getDuration()

getDuration(): number

Defined in: libs/scene/src/animation/proptrack.ts:169

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).

Overrides

AnimationTrack.getDuration


getProp()

getProp(): PropertyAccessor

Defined in: libs/scene/src/animation/proptrack.ts:177

Access the underlying property accessor.

Returns

PropertyAccessor

The PropertyAccessor used by this track.

Released under the MIT License.