xxxxxxxxxx
36
let n = 0.0;
let m = 0.0;
let pts = [];
function setup() {
createCanvas(400, 400);
stroke(64, 64, 64, 50);
for (let y=0; y<=height; y+=50){
pts.push([]);
for (let x=0; x<=width*2; x+=50){
let newy = y + noise(y + (x / 100)) * (height - y)
pts[pts.length-1].push({x:x, y:newy});
}
}
console.log(pts)
}
function draw() {
background(220);
translate(width * -0.5, 0)
for (let i=0; i<pts.length; i++) {
beginShape();
curveVertex(0, height);
for (let j=0; j<pts[i].length; j++) {
translate(map(mouseX, 0, width, width * -0.05, width * 0.05), 0);
curveVertex(pts[i][j].x, pts[i][j].y);
}
curveVertex(width*2, height);
curveVertex(width*2, height);
curveVertex(0, height);
endShape(CLOSE);
}
n += 0.005;
}