【Processing】5択でジェネる

 

 

 

 

以前書いたコードを改変した。

94.hatenadiary.jp

 

void setup(){
size(800,800,P3D);
  background(0);
  frameRate(20);
}

void draw(){
  translate( width/2, width/2,-100);
  rotateZ(radians(frameCount/3));
  
  background(0);
  int grid = (int)random(5,500);
  for(int x = - width; x < width; x += grid){
      for(int y = - width; y < width; y += grid){
          int a = int(random(1,6));//5択
          if(a == 1){
            strokeCap(ROUND);
            strokeWeight(a);
            stroke(0,250,00);
            line(x,y,x+grid,y+grid);
          }else if(a == 2){
            strokeWeight(a);
            stroke(250,200,2);
            line(x,y,x+grid,y);
          }else if(a == 3){
            strokeWeight(a);
            stroke(2,200,250);
            line(x+grid,y,x,y+grid);
           }else if(a == 4){
            strokeWeight(a);
            stroke(255,2,20);
            line(x-grid,y,x,y+grid);
          }else if(a == 5){
            strokeWeight(a);
            stroke(255);
            line(x+grid,y,x,y-grid);
          }
      }
  }
}