weasel API - v0.8.0
    Preparing search index...

    Interface MomentumOptions

    interface MomentumOptions {
        animator: Animator;
        boundary?: "stop" | "continue";
        bounds?: { height: number; width: number; x: number; y: number };
        friction?: number;
        now?: () => number;
        threshold?: number;
        velocitySampleMs?: number;
    }
    Index

    Properties

    animator: Animator

    Required: the per-Canvas animator that will own the decay.

    boundary?: "stop" | "continue"

    Boundary policy when the clamped position hits an edge. 'stop' cancels the decay (instant settle at the edge). 'continue' keeps decaying but subsequent ticks stay clamped (object drifts along the edge as friction decays the velocity). Default 'stop'.

    bounds?: { height: number; width: number; x: number; y: number }

    Optional bounds for the object's top-left corner (in world units). When supplied, momentum-driven translation is clamped: each tick's new position is constrained so the object's (x, y) stays inside the rect. Without bounds, a hard flick carries the object indefinitely until friction dampens velocity below threshold.

    Note: ignores object size for now — the bound is on the top-left, not the visible edges. A consumer wanting "object stays fully inside" should pass bounds = { x: canvas.x, y: canvas.y, width: canvas.w - obj.w, height: canvas.h - obj.h } (and accept that it doesn't adapt to variable-sized objects mid-flight).

    friction?: number
    now?: () => number

    Optional clock override for tests. Defaults to Date.now.

    threshold?: number
    velocitySampleMs?: number

    Sample window in ms for velocity computation. Default 80ms.