Core guide

Game timing

Drive deterministic update and draw loops with bounded deltas.

Live example

See Game timing in action

Watch motion advance from frame deltas supplied by the scheduler.

live rendering loading ticks 0

How it works

The scheduler supplies monotonic time to update callbacks. The frame loop clamps large deltas, resets timing after suspension, and does not advance simulation while paused.

Public types

  • FrameScheduler
  • UpdateTime
  • FrameLoopState
  • max_delta_seconds

Minimum viable example

const scheduler: FrameScheduler = {
  request_frame: requestAnimationFrame,
  cancel_frame: cancelAnimationFrame,
  now_seconds: () => performance.now() / 1000,
};

Scope and limitations

Fixed-step simulation and scheduler integrations beyond the browser frame API are deferred.