Wraps timer, computing a value based on its elapsed value. fn creates this value.
timer
fn
const t = timerWithFunction(v=>v/2, relativeTimer(1000));t.compute(); Copy
const t = timerWithFunction(v=>v/2, relativeTimer(1000));t.compute();
In the above case, relativeTimer(1000) creates a timer that goes from 0..1 over one second. fn will divide that value by 2, so t.compute() will yield values 0..0.5.
relativeTimer(1000)
t.compute()
Returns true if this timer has completed.
Wraps
timer
, computing a value based on its elapsed value.fn
creates this value.In the above case,
relativeTimer(1000)
creates a timer that goes from 0..1 over one second.fn
will divide that value by 2, sot.compute()
will yield values 0..0.5.