Skip to content

Timing and units

One clock, two speed controls that run in opposite directions, and the unit each part of toon measures in.

Edit this page

All Canvas motion runs on the ticker (toon’s shared clock, Toon.ticker). Draw with stage.loop(fn) so a canvas stops drawing while it’s scrolled out of view.

In CSS, --toon-tempo multiplies duration, so higher is slower. In JavaScript, ticker.timeScale multiplies time, so higher is faster. Setting ticker.timeScale = 0.25 slows everything down, which helps when you’re checking timing. See Timing.

await tween({...}) and sequence(...) let you write a whole action as a script. See Anticipation.

Each part of toon measures time in one unit:

Where Unit
tween, wait, poses, stagger milliseconds
Ticker callbacks and physics seconds
Velocities pixels per second