【p5.js】cycle

function setup() {
  createCanvas(400, 400);
  background(255);
  noStroke();
  fill(0);

  let x, y;

  for (let a = 0; a <= width/2; a+=40) {
    for (let i = 0; i < 360; i+=10) {
      x = a * cos(map(i, 0, 360, 0, PI*2)) + width/2;
      y = a * sin(map(i, 0, 360, 0, PI*2)) + height/2;
      ellipse(x, y, 5, 5);
    }
  }

  save('cycle.png');
}
タイトルとURLをコピーしました