Skip to content
Shapemetry

@huukhanhnguyen/model / lanes/animations/animation

lanes/animations/animation

AnimationPlayer

Constructors

Constructor

new AnimationPlayer(model): AnimationPlayer

Parameters

model

PlayerModel

Returns

AnimationPlayer

model

readonly model: PlayerModel

onStateChange

onStateChange: (() => void) | null = null

UI hook — fired whenever playing flips (including self-finish).

playing

playing: boolean = false

Accessors

hasAnimation

Get Signature

get hasAnimation(): boolean

Returns

boolean

Methods

seek()

seek(time): void

Scrub to time seconds. Deterministic.

Parameters

time

number

Returns

void

stop()

stop(): void

Returns

void

toggleAll()

toggleAll(): void

Global Play button — every animated parameter on the shared clock.

Returns

void

toggleParameters()

toggleParameters(nodes): void

Interact-tool click — just the picked parameters, same shared clock.

Parameters

nodes

ParameterNode[]

Returns

void


animatedParameters()

animatedParameters(model): ParameterNode[]

Recursively collect animated parameters (header containers are display grouping).

Parameters

model

PlayerModel

Returns

ParameterNode[]


animatedParametersFor()

animatedParametersFor(model, nodeKey): ParameterNode[]

Interact-tool click resolution: the animated parameters referenced by any expression inside the subtree of the node keyed nodeKey — click the door, only the door's openAngle runs. A model with a single animated parameter resolves to it regardless of what was clicked.

Parameters

model

PlayerModel

nodeKey

string

Returns

ParameterNode[]


groupDuration()

groupDuration(tracks): number

How long a GROUP of tracks runs — the longest member. One fold, not reimplemented at each call site: AnimationPlayer.run below uses it for whichever tracks are playing this tick, and a clip's length is this over its members (which is exactly why a clip stores no length of its own).

Parameters

tracks

Track[]

Returns

number


trackDuration()

trackDuration(track): number

Where a track's own domain ends — its last keyframe time. Not a stored field: the samples say it (see evaluate/animation.ts's header).

Parameters

track

Track

Returns

number


trackValueAt()

trackValueAt(track, time): number

Parameters

track

Track

time

number

Returns

number

Last updated: 📖 2 min readEdit on GitHub