xxxxxxxxxx
24
let path = [];
function setup() {
createCanvas(600, 600);
//generate path here all at once
path = [[width/2,height/2]] //sample code
}
function draw() {
background(255);
//generate path here step by step
path.push([random()*width,random()*height]); //sample code
drawPath(); //draws the path
}
function drawPath(){
stroke(0);
for(let i=1;i<path.length;i++){
line(path[i-1][0],path[i-1][1],path[i][0],path[i][1]);
}
}