Function timeModulator

Creates an modulator based on clock time. Time starts being counted when modulate function is created.

timeModulator allows you to reset and check for completion. Alternatively, use time which is a simple function that just returns a value.

import { timeModulator } from "https://unpkg.com/ixfx/dist/modulation.js";
const fn = (t) => {
// 't' will be a value 0..1 representing time elapsed. 1 being end of period.
return t*Math.random();
}
const t = timeModulator(fn, 5*1000); // Will take 5 seconds to complete
...
t.compute(); // Get current value of modulator
t.reset(); // Reset to 0
t.isDone; // _True_ if finished