Skip to content
Shapemetry

Types - Animation

API reference for ./evaluate/animation on @huukhanhnguyen/types.

See the Guide for the package's role.

API reference

Signatures are generated from the live package .d.ts - not hand-written.

AnimationClip

type

A named GROUP of tracks — the export/selection unit ("Walk", "Run", "Idle"). Every format that round-trips a real animation clip requires one: Blender's Action, Unity's AnimationClip, Unreal's AnimSequence, FBX's AnimStack, glTF/USD's named animation — measured 2026-08-14: a clip with no shared anchor for its member tracks is a real, filed interop bug (github.com/KhronosGroup/glTF#569 — mismatched per-track length with no clip-level tie, ~1.79s desync per loop between two implementations' guesses). Membership is BY REFERENCE (track keys), not containment — a track stays independently addressable (a parameter can point at one directly) whether or not it is also a clip member.

type AnimationClip
// = {
    name: string;
    /** Member track keys, in authoring order. */
    tracks: string[];
}

Track

type

One keyframe track — pure value-over-time data, nothing else. key is unique across the WHOLE model (not just within its enclosing AnimationClip, if any) — a reference to a track never needs to know which clip (if any) it lives in.

values[i] is the value at times[i] — an array whose OWN length is however many numbers that keyframe carries (3 for a position, 4 for a rotation quaternion, N for a mesh's whole morph-weights array at once — glTF packs every morph target of one node into a single weights channel, so one track already covers all of them). Self-describing: no separate "how many numbers per key" field, no N separate tracks to re-merge at export.

type Track
// = {
    key: string;
    times: number[];
    values: number[][];
    /** LINEAR when absent. STEP holds the previous key's value. No
     *  CUBICSPLINE: that needs in/out tangent data this shape doesn't
     *  carry and nothing here builds or consumes — declaring it would be
     *  claiming a capability that silently produces wrong output. */
    interpolation?: "LINEAR" | "STEP";
}
Last updated: 📖 1 min readEdit on GitHub