Each wave has its own character. Hover to see it up close. Every shape is periodic — it repeats, but each one repeats differently.
Pick a wave, drag the sliders, see the code update live.
One flag. The library picks a random wave, holds it, then smoothly morphs into the next one. Different every time you load the page.
Two independent wave samplers drive X and Z height. Drag to rotate.
Add the script tag. Call the function. Done.
<script src="p5.waves.js"></script>
function draw() {
for (let x = 0; x < width; x += 3) {
let y = Waves.wave(x, {
wave: 'mountain peaks',
t: millis() / 1000,
amplitude: 80
});
point(x, height / 2 + y);
}
}