Image-base animation model.

Type Parameters

  • T

Implements

Constructors

Methods

  • Get the index of the current frame displayed by the animation

    Returns number

    newFrame The index of the frame being displayed

  • Return true if animation has ended. The animation had ended if:

    • it's not configured as a loop;
    • the current frame is the last frame;
    • the last frame has been displayed long enough.

    Returns boolean

  • Returns boolean

    Deprecated

    Return true if animation has ended. Prefer using hasAnimationEnded. This method returns true as soon as the animation enters the last frame, not at the end of the last frame.

  • Change the current frame displayed by the animation

    Parameters

    • newFrameIndex: number

      The index of the frame to be displayed

    Returns boolean

  • Change the angle (or direction index) of the object

    Parameters

    • oldValue: number

      The old angle

    • newValue: number

      The new angle (or direction index) to be applied

    Returns null | number

    Deprecated

  • Register a listener to frame changes.

    It's useful for custom objects as they don't drive this class themselves.

    Parameters

    • callback: (() => void)

      Called each time getCurrentFrame changes.

        • (): void
        • Returns void

    Returns void

  • Update the current frame of the object according to the elapsed time on the scene.

    Parameters

    • timeDelta: number

      in seconds

    Returns boolean