wave<V>(lo: V, hi: V, t: number, func?: (x: number)=>number): V

Interpolate back and forth between 2 values. (Optionally takes a custom periodic function, which default to a sine wave.).

// bounce color between 2 values as time goes on
onUpdate("colorful", (c) => {
    c.color.r = wave(0, 255, time())
    c.color.g = wave(0, 255, time() + 1)
    c.color.b = wave(0, 255, time() + 2)
})

groupMath

kaplay logo

Misc

Layer