Class Sprite

Constructors

  • Parameters

    • id: string
    • spriteSheet: ImageBitmap
    • hFrameOffset: number

      Distance between each frame (horizontally)

    • vFrameOffset: number

      Distance between each frame (vertically)

    Returns Sprite

Accessors

  • get context(): CanvasRenderingContext2D
  • Get output buffer context

    Returns CanvasRenderingContext2D

Methods

  • Play a single animation

    Parameters

    • id: string
    • nbLoop: number

    Returns void

  • Stop the current animation. The pending queue is preserved so run() can restart it: a looping sequence re-queues its current animation as it plays, but a non-looping one has already shifted it out, so put it back at the head of the queue for the restart.

    Returns void

  • Is the sprite currently animating ?

    Returns boolean

    boolean

  • Set the End of queue listener that will be called when current queue is empty

    Parameters

    • listener: ((id) => void)
        • (id): void
        • Parameters

          • id: string

          Returns void

    Returns void