The base class for canvas helpers, which also defines a common interface.

Derivates of the class might chose to leave implementations of individual methods empty, if it fits their pattern better. For example, one canvas might wrap its context and applications using that canvas will only interact with its interface. Another canvas implementation might expose the context and all give the application full control over the rendering cycle.

Hierarchy (View Summary)

Constructors

Properties

The canvas element we're interacting with.

Accessors

Methods

  • Clear the canvas with the given color.

    Parameters

    • color: number

      The color to clear the canvas with.

    Returns void

  • Rebuild rendering pipeline in reaction to a change in the canvas. Usually, when the canvas was resized.

    Returns void

  • Draw FPS information onto the canvas.

    Parameters

    • frameTimes: number[]

      Durations of previous frame draws.

    • frameTime: number

      The duration of the previous frame draw.

    • timeDelta: number

      The time elapsed since the last frame.

    Returns void

  • Handle any internal update calls that would be required to present a new frame. Not all implementations will need this.

    Returns void