Daily Creative Coding

元「30 min. Processing」。毎日、Creative Codingします。

球を箱状に並べる

/**
* 3D Box Spheres
*
* @autor aa_debdeb
* @date 2015/09/22
*/

void setup(){
  size(500, 500, P3D);
  smooth();
  background(255);
  sphereDetail(40);

  lights();
  camera(0, 0, 0, width / 2, height/2, 100, 0, 1, 0);
  
  noStroke();
  for(int xi = 0; xi < 10; xi++){
    fill(255 * (xi / 10.0));
    for(int yi = 0; yi < 10; yi++){
      for(int zi = 0; zi < 10; zi++){
        pushMatrix();
        translate(150 + xi * 20, 150 + yi * 20, zi * 20);
        sphere(10);
        popMatrix();
      }
    }
  }
}

void draw(){

}