Code is beautiful
let yOffset = 0;
function setup() {
let cnv = createCanvas(windowWidth, windowHeight);
cnv.parent("p5-container");
noStroke();
fill(0, 119, 190, 100);
}
function draw() {
background(240);
beginShape();
let xOffset = 0;
for (let x = 0; x <= width; x += 10) {
let y = map(noise(xOffset, yOffset), 0, 1, height / 2 - 100, height / 2 + 100);
vertex(x, y);
xOffset += 0.02;
}
vertex(width, height);
vertex(0, height);
endShape(CLOSE);
yOffset += 0.01;
}
- Mentionné dans
- Kernel