xxxxxxxxxx
44
let W=1920;
let H=1080;
let t=-0.5;
let pts=[]
let c=0;
let a=W/5;
function setup() {
createCanvas(W, H);
background(255,255,255);
}
function draw() {
background(255,255,255);
translate(W/2,H/2);
push();
stroke('GREEN');
strokeWeight(3);
for (i=0;i<pts.length;i++){
point(pts[i].x,pts[i].y);
}
pop();
line(0,-H/2,0,H/2);
line(-W/2,0,W/2,0);
push();
stroke('BLUE');
strokeWeight(2)
line(a*cos(t),0,0,a*sin(t));
pop();
if (c>50){
push();
stroke('RED');
strokeWeight(5)
point(2*a*cos(t)/3,a*sin(t)/3)
pts.push({x:2*a*cos(t)/3,y:a*sin(t)/3});
if(c>100) t=t+0.005;
pop();
}
if(t>2*PI-0.5){
noLoop();
}
c=c+1;
}