xxxxxxxxxx
51
/*
pseudo
> create first line, add it to a list?!
> move line
> alpha previous line!?
*/
td = 1;
t=0;
var x1,x2,y1,y2,a,b,c,d;
var lines = [];
function setup() {
createCanvas(400, 400);
a=random();
b=random();
c=random();
d=random();
lines.push( [100, 200, 300, 200] );
}
function draw() {
background(255);
[x1,y1,x2,y2] = lines[0];
x1 = x1 + map(noise(t*a), 0, 1, -1, 1.4);
y1 = y1 + map(noise(t*b), 0, 1, -1.4, 1);
x2 = x2 + map(noise(t*c), 0, 1, -1, 1);
y2 = y2 + map(noise(t*d), 0, 1, -1, 1);
fill(0,0,0);
line(x1,y1,x2,y2);
lines.push([x1,y1,x2,y2]);
for (var i = 1 ; i < lines.length; i++){
[x1,y1,x2,y2] = lines[i];
line(x1,y1,x2,y2);
}
if (lines.length > 5){
lines.splice(0,1);
}
t+=td;
}