createSampler({ shift: true })
Wave Shift
A curtain of wave lines that auto-shift between random formulas. Each line has its own phase offset, creating an organic ripple. Pass shift: true - the library handles timing, picking, and easing.
Core snippet
const sampler = Waves.createSampler({
shift: true, // auto-shift to random waves
amplitude: 70,
frequency: 0.6
});
// In draw - 10 horizontal lines, each with its own phase offset:
const t = millis() / 1000;
for (let i = 0; i < 10; i++) {
const phaseOff = i * 0.35;
stroke(40 + i * 14);
beginShape();
for (let x = 0; x <= width; x += 4) {
vertex(x, height/2 + sampler.sample(x + phaseOff*60, t + phaseOff*0.2));
}
endShape();
}