xxxxxxxxxx
30
let s;
function setup() {
createCanvas(200, 200);
s = createSlider(0, 2 * PI, 1, 0.01);
}
function x(t) {
return 50 * cos(t);
}
function y(t) {
return 50 * sin(t);
}
function draw() {
{
push();
translate(width / 2, height / 2);
scale(1, -1);
background(10);
noStroke();
for (let t = 0; t < s.value(); t += 0.1) {
fill(255, 255, 255);
circle(x(t), y(t), 5);
}
pop();
}
fill(255);
textSize(20)
text("t = [0 ," + round(s.value() / PI, 2) + "π]", 10, height - 20);
}