xxxxxxxxxx
// simple noise wave
// original at https://archive.p5js.org/examples/math-noise-wave.html
// schien@mail.ncku.edu.tw, DPD 2025
let yoff = 0.0; // 2nd dimension of perlin noise
function setup() {
createCanvas(710, 400);
}
function draw() {
background(51);
fill(255);
// We are going to draw a polygon out of the wave points
beginShape();
let xoff = yoff;
// Iterate over horizontal pixels
for (let x = 0; x <= width; x += 10) {
// Calculate a y value according to noise, map to
let y = map(noise(xoff), 0, 1, 200, 300);
// Set the vertex
vertex(x, y);
// Increment x dimension for noise
xoff += 0.05;
}
// increment y dimension for noise
yoff += 0.01;
vertex(width, height);
vertex(0, height);
endShape(CLOSE);
}