xxxxxxxxxx
53
let ax, ay;
let bx, by;
let cx, cy;
let x, y;
function setup() {
createCanvas(500, 500);
ax = 450 / 2;
ay = 0;
bx = 0;
by = 450;
cx = 450;
cy = 450;
x = random(450);
y = random(450);
background(0);
translate(550, 100);
// stroke(255);
// strokeWeight(8);
// point(ax, ay);
// point(bx, by);
// point(cx, cy);
}
function draw() {
frameRate(20)
translate(20, 40);
//if(mouseIsPressed) noLoop();
for (let i = 0; i < 100; i++) {
strokeWeight(2);
point(x, y);
let r = floor(random(3));
if (r == 0) {
// the top one
stroke(128, 191, 255);
x = lerp(x, ax, 0.5);
y = lerp(y, ay, 0.5);
} else if (r == 1) {
// the bottom left one
stroke(153, 102, 255);
x = lerp(x, bx, 0.5);
y = lerp(y, by, 0.5);
} else if (r == 2) {
// the bottom right one
stroke(204, 51, 255);
x = lerp(x, cx, 0.5);
y = lerp(y, cy, 0.5);
}
}
}