塵芥回顧録

なるべく更新していきたいが、ネタがない。

回る円(processing)

回る円(processing)
f:id:nupepon:20210225003126p:plain

int l = 100; //丸の移動距離
int n = 6; //丸の個数
int s = 10; //円のサイズ
int i = 0;

void setup() {
  size(300, 300);
  colorMode(RGB, 10);
  frameRate(60);
  
}

void draw() {
  ellipseMode(CENTER);
  background(10);
  translate(width/2, height/2);
  fill(0); 
  noStroke();
  float x;
  for (int j=0; j<n; j++) {
    x = l * cos(radians(i+j*180/n));
    ellipse(0, x, s, s);
    rotate(radians(180/n));
  }
  i++;
  if (i==360) i=0;
}