【Processing】綿棒っぽいモノ

 

ツイッターのタイムラインで見かけたので書いた。

昔のキネティックアートみたいっすね。

 

float a = 0;
int b = 12; 
float c = 0.1;
int re = 100;
  
void setup(){
size(500,500,P3D);
}


void draw(){
background(255);
  translate(width/2,height/2);
  for(int i = 0;i<360;i+=5){
  pushMatrix();
  rotateY(radians(i+a));
  
  translate(0,0,100);  
  rotateX(radians((i+a)*b));
  strokeWeight(2);

  line(0,re,0,0,-re,0);
  
  
  translate(0,re,0);
  fill(0);
  sphere(3);
  translate(0,-re*2,0);
  fill(0);
  sphere(3); 
  
  popMatrix();
  }
  
  camera(0,-50,-10,
         width/2,height/2,0,
          0,1,0);
  a+=c;
}