meo-canvas
    Preparing search index...

    Interface TrackConfig<T>

    A reusable animation: what to move between, when, and how.

    interface TrackConfig<T extends Animatable> {
        delay?: number;
        duration?: number;
        ease?: EasingName | ((t: number) => number);
        from: T;
        spring?: Omit<SpringConfig, "from" | "to">;
        stagger?: number;
        to: T;
    }

    Type Parameters

    Index
    delay?: number

    Seconds to wait before the motion starts. Defaults to 0.

    Counted in Sampled.duration, which reports how long from the start of the render until this track has finished rather than how long the motion itself lasts. A track delayed by 0.5 with a duration of 1 reports 1.5.

    duration?: number

    Seconds the motion lasts. Required unless spring supplies one.

    ease?: EasingName | ((t: number) => number)

    The timing curve, by name or as a function of 0..1.

    Mutually exclusive with spring, and giving both is refused rather than silently preferring one. A function receives a clamped t and may return outside 0..1: the overshooting curves depend on it.

    from: T

    The value before the track starts, and during any delay.

    spring?: Omit<SpringConfig, "from" | "to">

    Spring physics instead of an easing. Supplies its own duration.

    Narrowed rather than merely refused. A track defines its own range and drives the spring over 0..1, so a from or to on the spring cannot be honoured, and the assertion track runs throws on one. Accepting the wider type here left the compiler agreeing with a call the runtime rejects, which is the one thing types are for. The assertion stays for JavaScript callers, who have no compiler to tell.

    stagger?: number

    Extra delay per item index, for staggering a row of elements.

    to: T

    The value once the motion has finished.