Tempo helps you create synchronized and rhythmic animations.
Construct a new Tempo instance by beats-per-minute. Alternatively, you can use Tempo.fromBeat
to create from milliseconds.
beats per minute
Milliseconds per beat (Note that this is derived from the bpm value).
IPlayer interface. Not implementated.
IPlayer interface. Internal implementation that calls track( time )
.
This is a core function that let you specify a rhythm and then define responses by calling the start
and progress
functions from the returned object. See Animation guide for more details.
The start
function lets you set a callback on every start. It takes a function (ITempoStartFn
).
The progress
function lets you set a callback during progress. It takes a function (ITempoProgressFn
). Both functions let you optionally specify a time offset and a custom name.
See Animation guide for more details.
a rhythm in beats as a number or an array of numbers
an object with chainable functions
tempo.every(2).start( (count) => ... )
, tempo.every([2,4,6]).progress( (count, t) => ... )
Create a new Tempo instance by specifying milliseconds-per-beat.
milliseconds per beat
IPlayer interface. Not implementated.
Remove a start
or progress
callback function from the list of callbacks. See Tempo.every
for details
a name string specified when creating the callback function.
Usually you can add a tempo instance to a space via Space.add
and it will track time automatically.
But if necessary, you can track time manually via this function.
current time in milliseconds