mwg API
    Preparing search index...

    Class Animation

    import { Animation } from '@datamoc/mw_games/two-d/render';
    import type { Texture2D } from '@datamoc/mw_games/two-d/render';

    declare const frames: Texture2D[];

    const walk = new Animation(frames, { fps: 10 });
    console.log(walk.duration); // frames.length / 10, in seconds
    Index
    duration: number

    how long one pass over the frames takes, startTime excluded

    frameDuration: number

    the duration every frame without one of its own is held for

    frames: readonly AnimationFrame[]
    loop: boolean
    startTime: number
    • Which frame plays seconds in. Before it starts the first frame is held, however long that is, and a non-looping animation that has run out stays on its last frame rather than running off the end.

      Parameters

      • seconds: number

      Returns number