xxxxxxxxxx
let p1;
let p2;
let p = [];
let num = 20;
function setup() {
createCanvas(windowWidth, 400);
noLoop();
strokeWeight(7);
p.push({x:0,y:height});
for (let i = 1; i < num; i++) {
p[i] = { x: (width / num) * i, y: height * random() };
}
p.push({x:width,y:height});
// p1 = { x: 0, y: height * random() };
// p2 = { x: 100, y: height * random() };
}
function draw() {
background(0);
fill(0,250,0);
noStroke();
beginShape();
vertex(p[0].x,p[0].y);
for (let i = 0; i < num; i++) {
//noFill();
bezierVertex(
p[i].x + 50,
p[i].y,
p[i + 1].x - 50,
p[i + 1].y,
p[i + 1].x,
p[i + 1].y
);
}
vertex(width,height);
endShape()
//bezier(p1.x, p1.y, p1.x + 50, p1.y, p2.x - 50, p2.y, p2.x, p2.y);
}