sketch = function( p ) {
let inc = 0;
let range = 10;
let lw = 5;
let pg;
p.setup = function() {
p.createCanvas(p.windowWidth, 800);
pg = p.createGraphics(p.windowWidth/2, 800);
}
p.draw = function() {
p.background(0);
p.noFill();
p.stroke(255);
p.strokeWeight(lw);
p.beginShape();
for (let x = 0; x < p.width/2; x++) {
let nx = p.map(x, 0, p.width, 0, range) + inc;
let y = p.height * p.noise(nx);
p.vertex(x, y);
inc+=0.00001;
}
p.endShape();
if(p.frameCount % 10 == 0) {
pg.background(0);
pg.noFill();
pg.stroke(0, 0, 255);
pg.strokeWeight(lw);
pg.beginShape();
for (let x = 0; x < pg.width; x+=50) {
let y = pg.height * p.random();
pg.vertex(x, y);
}
pg.endShape();
}
p.image(pg, p.width/2, 0);
}
}