xxxxxxxxxx
const w = 600;
const h = 600;
let inc = 0.01;
let start = 0;
let frameCounter = 0;
function setup() {
createCanvas(w, h);
}
function draw() {
background(0);
stroke(255);
strokeWeight(4);
noFill();
beginShape();
for (let x = 0; x < w; x++) {
let r = random(h); // Use random instead of noise
vertex(x, r);
}
endShape();
frameCounter++;
// Save the canvas every time the line has "travelled" across the canvas
if (frameCounter >= w) {
saveCanvas('random_line_' + frameCount, 'jpg');
frameCounter = 0; // Reset the counter
}
}