Example 01 — 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
var sampler = Waves.createSampler({
shift: true, // auto-shift to random waves
amplitude: 100,
frequency: 0.6
});
// In draw — 10 lines, each with its own phase offset:
for (var i = 0; i < 10; i++) {
var phaseOff = i * 0.35;
stroke(40 + i * 14);
beginShape();
for (var y = 0; y <= height; y += 3) {
vertex(width/2 + sampler.sample(y + phaseOff*60, t + phaseOff*0.2), y);
}
endShape();
}