/* built with Studio Sketchpad:
* https://sketchpad.cc
*
* observe the evolution of this sketch:
* https://studio.sketchpad.cc/sp/pad/view/ro.HA$mD-K0SRD/rev.873
*
* authors:
* Pavel Mitrofanov
* license (unless otherwise specified):
* creative commons attribution-share alike 3.0 license.
* https://creativecommons.org/licenses/by-sa/3.0/
*/
float f = 0.0;
float step = TWO_PI/360/3;
int numBoxes = 10;
int[][] boxes = new int[6][numBoxes];
void setup() { // this is run once.
size(500, 500, P3D);
noFill();
smooth();
for (int i = 0; i < numBoxes; i++) {
boxes[i] = new int[6];
boxes[i][0] = 100+random(300);
boxes[i][1] = 100+random(300);
boxes[i][2] = 100+random(200);
boxes[i][3] = random(360);
boxes[i][4] = random(200);
boxes[i][5] = 10+random(30);
}
}
void draw() { // this is run repeatedly.
background(255,255,255);
//beginCamera();
//camera();
//rotateX(-PI/6);
//endCamera();
for (int i = 0; i < numBoxes; i++) {
pushMatrix();
translate(boxes[i][0], boxes[i][1], boxes[i][2]);
rotateY(PI*360/boxes[i][3]+f);
fill(boxes[i][4]);
box(boxes[i][5]);
popMatrix();
}
translate(50, 50, 0);
rotateY(PI/3+f);
box(45);
f=f+step;
}