Class: Ticker

Ticker


new Ticker(start, opts)

Executes callback based on given fps and requestAnimationFrame

Parameters:
Name Type Argument Description
start Boolean <optional>

Whether to start on instantiate. Default is true

opts Object <optional>

Options

Properties
Name Type Argument Description
window Object <optional>

window object for testing

document Object <optional>

document object for testing

Author:
  • Chris Peters
Source:
Requires:
  • module:Radio

Requires

  • module:Radio

Methods


_update()

Calculates whether or not to call Ticker#onTick based on Ticker#_fps.
If the correct amount of time has passed the Ticker#onTick callback will fire and
the tick event will be dispatched via the document object.

Source:

onPostTick(delta, ticks)

A callback executed post tick.

Parameters:
Name Type Description
delta Integer

The time elapsed between ticks.
Multiply against gameplay elements for consistent
movement.

ticks Integer

The amount of ticks that have accumulated

Source:

onPreTick(delta, ticks)

A callback executed pre each tick.

Parameters:
Name Type Description
delta Integer

The time elapsed between ticks.
Multiply against gameplay elements for consistent
movement.

ticks Integer

The amount of ticks that have accumulated

Source:

onTick(delta, ticks)

A callback executed on each tick.

Parameters:
Name Type Description
delta Integer

The time elapsed between ticks.
Multiply against gameplay elements for consistent
movement.

ticks Integer

The amount of ticks that have accumulated

Source:

start()

Starts the ticker

Source: