Documentation
    Preparing search index...

    Class AnimationTrack<T>

    A typed keyframe sequence over clip-local time (§17).

    const track = new AnimationTrack({
    path: "transform.position",
    adapter: vector3Adapter,
    times: [0, 0.5, 1], // seconds (§7a)
    values: [new Vector3(0, 0, 0), new Vector3(0, 2, 0), new Vector3(0, 0, 0)],
    interpolation: "cubic",
    });
    track.sample(0.25, out); // → out, mutated

    Clamped, not extrapolated: below the first key the first value is returned, at or above the last key the last one. This differs from §13's trajectories, which extrapolate their closed forms, and the difference is deliberate — a trajectory is a curve that happens to be parameterized by time, while a clip track is authored content with a beginning and an end. Repeating, ping-ponging, and holding past the end are the player's decisions (WP-4.6), made by transforming the time it passes in; a track that extrapolated would fight every one of them.

    Sampling time must be finite: nothing is validated on the sample path (it is per-frame, per-track code), so a non-finite time propagates into the result rather than throwing.

    "cubic" and "hermite" can leave the interval spanned by their keyframes — that is what makes them useful for anticipation and follow-through — and nothing here clamps them back. A track whose values must stay in range uses "linear" or "step".

    Type Parameters

    • T

      The track's value type, matching its adapter.

    Implements

    Index
    • Type Parameters

      • T

        The track's value type, matching its adapter.

      Parameters

      Returns AnimationTrack<T>

      FourError INVALID_APPLICATION_STATE — empty path; no keyframes; values not the same length as times; a non-finite or non-increasing keyframe time; a cubic/Hermite mode on a value kind with no component arithmetic; or missing/mismatched tangent arrays for "hermite".

    adapter: ValueAdapter<T>

    Adapter for this track's value type; also its §17 track type.

    endTime: number

    Last keyframe time in seconds.

    inTangents: readonly T[]

    Per-key incoming tangents; empty unless the mode is "hermite".

    interpolation: InterpolationMode

    Interpolation mode (§17).

    outTangents: readonly T[]

    Per-key outgoing tangents; empty unless the mode is "hermite".

    path: string

    Property path, resolved by the mixer (see the module header).

    startTime: number

    First keyframe time in seconds.

    times: readonly number[]

    Keyframe times in seconds, strictly increasing.

    values: readonly T[]

    Keyframe values, index-parallel with AnimationTrack.times.

    • Evaluates the track at timeSeconds (clip-local) and returns the effective value: the mutated out for in-place value kinds, the computed value itself for number, boolean, and discrete kinds. Callers must use the return value — the same split as ValueAdapter.lerp, for the same reason (a primitive has no storage to write through).

      Pure and allocation-free. out must not alias a keyframe value.

      Parameters

      • timeSeconds: number
      • out: T

      Returns T