← The API

Phaser AE

API docs

v3.0.0-1187 exports in 24 modulesreleased October 14, 2026

ContentsClock

Need to get started? Install the Phaser AE CLI →

Time and flow

Clock

The fixed-step clock, pause, time scale, hold and advance; the TickSource that fires frames

engine/kernel/src/clock.ts

Classes

ManualTicker

class ManualTicker implements ManualTickSource

From @phaser-ae/kernel

A tick source driven by hand, for headless runs, tests and replays: tick(dt) runs one frame dt seconds after the last. Its time is synthetic and starts at 0; start runs one tick straight away, so the clock has its starting point.

  • start(onTick: (now: Seconds) => void): void — Begin calling onTick with a monotonic wall time in seconds. Calling it again replaces the previous callback.
  • stop(): void — Stop calling onTick; the game calls it from stop().
  • tick(dt: Seconds): void — Advance the synthetic time by dt seconds and run one frame.

RafTickSource

class RafTickSource implements TickSource

From @phaser-ae/kernel

The browser's tick source: one tick per requestAnimationFrame, with its timestamp in seconds. Restartable.

  • start(onTick: (now: Seconds) => void): void — Begin calling onTick with a monotonic wall time in seconds. Calling it again replaces the previous callback.
  • stop(): void — Stop calling onTick; the game calls it from stop().

Types

Clock

interface Clock

From @phaser-ae/kernel

The single time authority: all game time flows from here. The tick source says "now"; the clock decides how much simulation that is — a fixed-step accumulator with pause, time scale and a catch-up clamp — and the interpolation alpha every world draws at.

  • readonly step: Seconds — Fixed simulation step, seconds. Set at createGame; constant thereafter.
  • readonly time: Seconds — Simulation time elapsed since boot, advancing only by whole steps.
  • readonly frame: number — Steps run so far. With the rng seed, this locates any moment for replay.
  • readonly alpha: number — Fraction of a step left over after the last one, 0..1: how far render lerps from the previous state to the current one.
  • readonly dt: Seconds — Wall-clock delta of the most recent tick, after the clamp. Informational.
  • timeScale: number — 1 = real time; 0.2 = slow motion; 0 holds the simulation while frames still draw. A hitstop dips it.
  • catchUpClamp: Seconds — The most wall time one tick may turn into simulation, seconds. Default 0.1 (six steps at 60 Hz): a hitch catches up, a backgrounded tab does not flood.
  • readonly paused: boolean — True while paused, by pause() or by a hidden page under backgroundPolicy: 'pause': no steps run, alpha freezes, the world input layer is suspended.
  • pause(): void — Hold the simulation. Frames still render; the shell and ui input layers stay live.
  • resume(): void — Resume. The first tick after is a zero-length one, so the time paused never becomes a catch-up burst.
  • advanceSteps(n?: number): void — While paused: run n fixed steps (default 1) on the next frame, a frame advance. Ignored when not paused.
  • readonly held: boolean — True while held: the wall clock no longer moves the game; only game.advance(seconds) does.
  • hold(): void — Take the game off the wall clock: no step, no frame and no draw happens until game.advance(seconds) runs them, as fast as the machine can. For tools that drive the game (a test, an agent playing it, a recorder), never for gameplay: a player's pause is pause(). Input that arrives while held is stamped with the game's time, so a press and release with advance(0.1) between them is a 0.1 s press.
  • release(): void — Back on the wall clock from now. The time spent held never becomes a catch-up burst.

ManualTickSource

interface ManualTickSource extends TickSource

From @phaser-ae/kernel

A tick source the caller drives by hand, one frame at a time. Deterministic.

  • tick(dt: Seconds): void — Advance the synthetic time by dt seconds and run one frame.

TickSource

interface TickSource

From @phaser-ae/kernel

What fires frames: it says "now", and the clock decides how much simulation that is. The kernel ships two: RafTickSource (requestAnimationFrame, the default in a browser) and ManualTicker (driven by hand: headless runs, tests, replays). A host may supply its own through GameOptions.tick.

  • start(onTick: (nowSeconds: Seconds) => void): void — Begin calling onTick with a monotonic wall time in seconds. Calling it again replaces the previous callback.
  • stop(): void — Stop calling onTick; the game calls it from stop().