xxxxxxxxxx
43
let index = 0;
let radiuses = []
function setup() {
createCanvas(windowWidth,windowHeight);
angleMode(DEGREES);
translate(windowWidth / 2, windowHeight / 2);
noFill();
background(255)
frameRate(50);
strokeWeight(3);
// drawcircle()
}
function draw() {
if(index < 360){
background(255)
radiuses.push(100);
index = index + 1;
textSize(20);
fill(0)
text("angle: " + index, 10, 30);
text("radius: " + radiuses[index - 1], 10, 60);
// text("radiuses = [" + radiuses.slice(0, index-1) + "]", 10, 100)
noFill();
beginShape();
radiuses.forEach((radius,index) => {
let x = radius * Math.cos(radians(index)) + windowWidth / 2;
let y = radius * Math.sin(radians(index)) + windowHeight / 2;
vertex(x, y);
})
endShape();
}
else{
radiuses = [];
index = 0;
}
}