melonJS
    Preparing search index...

    Interface AnimationOptions

    Normalized options for a played animation, shared by the 2D Sprite frame-animation path and the 3D Mesh keyframe-animation path so both accept the same setCurrentAnimation(name, …) second argument.

    interface AnimationOptions {
        loop: boolean;
        next?: string;
        onComplete?: () => unknown;
        onFrame?: (frame: number) => unknown;
        speed: number;
    }
    Index
    loop: boolean

    loop forever (default) or play once and hold the last frame.

    next?: string

    name of an animation to switch to when this one finishes.

    onComplete?: () => unknown

    called when the animation completes a cycle (each loop, or once if loop: false). A one-frame frame animation completes once its frame delay has elapsed when played with loop: false or next; a looping one-frame animation does not step, so it never calls onComplete.

    onFrame?: (frame: number) => unknown

    called with the index of each frame as playback reaches it, from frame 0 when the animation starts, and again at the start of each cycle. Frame animations only (a Sprite, a Sprite3d): a Mesh keyframe animation has no frames, and never calls it.

    speed: number

    playback rate multiplier (1 = authored speed).