The Matter.Runner module is an optional utility which provides a game loop, that handles continuously updating a Matter.Engine for you within a browser. It is intended for development and debugging purposes, but may also be suitable for simple games. If you are using your own game loop instead, then you do not need the Matter.Runner module. Instead just call Engine.update(engine, delta) in your own loop.

See the included usage examples.

Hierarchy

  • default

Constructors

Properties

_cancelAnimationFrame: ((handle) => void) & ((handle) => void) = ...

Type declaration

    • (handle): void
    • Parameters

      • handle: number

      Returns void

Type declaration

    • (handle): void
    • Parameters

      • handle: number

      Returns void

_frameTimeout: Timeout
_requestAnimationFrame: ((callback) => number) & ((callback) => number) = ...

Type declaration

    • (callback): number
    • Parameters

      • callback: FrameRequestCallback

      Returns number

Type declaration

    • (callback): number
    • Parameters

      • callback: FrameRequestCallback

      Returns number

Methods

  • Creates a new Runner. The options parameter is an object that specifies any properties you wish to override the defaults.

    Parameters

    Returns IRunner

    Method

    create

  • Ends execution of Runner.run on the given runner, by canceling the animation frame request event loop. If you wish to only temporarily pause the runner, see runner.enabled instead.

    Parameters

    Returns void

    Method

    stop

  • A game loop utility that updates the engine and renderer by one step (a 'tick'). Features delta smoothing, time correction and fixed or dynamic timing. Consider just Engine.update(engine, delta) if you're using your own loop.

    Parameters

    Returns void

    Method

    tick

Generated using TypeDoc