xxxxxxxxxx
52
let ax,ay;
let bx,by;
let cx, cy;
let x,y;
function setup() {
createCanvas(windowWidth, windowHeight);
ax = random(width);
ay = random(height);
bx = random(width);
by = random(height);
cx = random(width);
cy = random(height);
dx = random(width);
dy = random(height);
x = random(height)
y = random(width)
background(0);
stroke(255,0,255);
strokeWeight(2);
point(ax,ay);
point(bx,by);
point(cx,cy);
point(dx,dy);
}
function draw() {
for(let i =0; i<100; i++){
point(x,y);
let r = floor(random(4))
if(r == 0){
stroke(255,0,0,80);
x = lerp(x,ax,0.5);
y = lerp(y,ay,0.5);
} else if (r == 1){
stroke(0,255,0,80);
x = lerp(x,bx,0.5);
y = lerp(y,by,0.5);
} else if (r == 2){
stroke(0,0,255,80);
x = lerp(x,cx,0.5);
y = lerp(y,cy,0.5);
} else if (r == 3){
stroke(0,255,255,80);
x = lerp(x,dx, 0.5);
y = lerp(y,dy, 0.5);
}
}
}