Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Loop

Hierarchy

  • Loop

Index

Constructors

constructor

  • new Loop(init: Function): Loop
  • new Loop(init: Function, update: Function): Loop

Properties

Protected currentFrameRate

currentFrameRate: number

Keeps track of current frame rate.

init

init: Function

Initialization function defined by user.

Protected lastUpdateTime

lastUpdateTime: number

Last time that update was called.

Protected loopRunning

loopRunning: boolean

Keeps track of whether the loop is running. Use running method to set. Defaults to true if update is defined in constructor. Otherwise false.

Protected targetLoopTime

targetLoopTime: number

The target time between update being called. Milliseconds.

update

update: Function

Update function defined by user.

Methods

frameRate

  • frameRate(): number
  • frameRate(targetFrameRate: number): number

Protected loop

  • loop(): void

Protected runInit

  • runInit(): void

Protected runLoop

  • runLoop(): void

running

  • running(loopRunning: boolean): void
  • Sets the loopRunning variable and restarts loop if it was stopped.

    Parameters

    • loopRunning: boolean

    Returns void

setUpdate

  • setUpdate(update: Function): void
  • Used to set update function if not set in the constructor.

    Parameters

    • update: Function

    Returns void

Generated using TypeDoc