RAFTimer

View source

ExtendsTimer

Timer resource used by diagnostic tools to track completed frame-rate cycles.

RAFTimer extends Timer and provides the timing behavior used by diagnostic consumers.

Examples

import { RAFTimer } from '@wimaengine/diagnostic'

function readFpsCycle(world) {
  const timer = world.getResource(RAFTimer)

  if (timer.cycleStarted()) {
    console.log('a diagnostic timer cycle completed')
  }
}

Constructor


constructor(options?: TimerOptions)

View source

Creates a timer with an optional duration, mode, speed, and paused state.

Parameters

NameDescriptionDefault
options?—{}