xxxxxxxxxx
40
function circle_pt(t) {
let x = 1, y = 1;
if(t > 0.75) {
y = -1;
t = 1 - t;
}
else if(t > 0.5) {
x = -1;
y = -1;
t = t - 0.5;
}
else if(t > 0.25) {
x = -1;
t = 0.5 - t;
}
t = t * 2;
x *= 5 / (t*t + 1) - 4;
t = t - 0.5;
y *= 5 / (t*t + 1) - 4;
return [x, y];
}
function setup() {
createCanvas(400, 400);
background(220);
}
function draw() {
let t = random();
let [x, y] = circle_pt(t);
point( width/2 + 150*x,
height/2 - 150*y);
if(frameCount > 100) noLoop();
}