xxxxxxxxxx
62
let t = 0;
let x, y;
let v = 2;
let col = 240;
let stop = false;
function setup() {
createCanvas(windowWidth, windowHeight);
}
function keyPressed() {
if (keyCode === 32) {
if (stop == true) {
stop = false;
} else if (stop == false) {
stop = true;
}
}
}
function draw() {
background(255);
if (stop == false) {
t = t + 10;
v = v + 10;
} else {
t = t;
v = v;
}
// x = width/2 + 1/Math.tan(t/v) * 30*Math.cos(t);
// y = width/2 + Math.tan(t/v) * 30*Math.sin (t);
//fill(col);
// ellipse(x,y,10,20)
stroke(255);
strokeWeight(1);
fill(0);
// beginShape();
// for (let i = 0; i < 1000; i++) {
// vertex(
// width / 2 + (1 / Math.tan(i / v)) * 200 * Math.cos(i),
// width / 2 + Math.tan(i / v) * 200 * Math.sin(i)
// );
// }
// endShape();
for (let i = 0; i < 5000; i++) {
ellipse(
width / 2 + (1 / Math.tan(i / v)) * 100 * Math.cos(i),
height / 2 - Math.tan(i / v) * 100 * Math.sin(i),
60,
60
);
}
// if(t<10){
// saveCanvas('myCanvas'+'t', 'jpg')
// }
}