float a; // Angle of rotation
float offset = PI/180; // Angle offset between boxes
int num = 100; // Number of boxes
float offset = PI/180; // Angle offset between boxes
int num = 100; // Number of boxes
void setup() {
size(640, 360, P3D);
noStroke();
}
size(640, 360, P3D);
noStroke();
}
void draw() {
lights();
background(255, 200, 0);
translate(width/2, height/2);
for(int i = 0; i < num; i++) {
float gray = map(i, 0, num-1, 25, 150);
pushMatrix();
fill(gray);
rotateY(a + offset*i);
rotateX(a/2 + offset*i);
box(100);
popMatrix();
}
a += 0.05;
}
lights();
background(255, 200, 0);
translate(width/2, height/2);
for(int i = 0; i < num; i++) {
float gray = map(i, 0, num-1, 25, 150);
pushMatrix();
fill(gray);
rotateY(a + offset*i);
rotateX(a/2 + offset*i);
box(100);
popMatrix();
}
a += 0.05;
}
I adjusted the angle and speed of rotation, adding multiple boxes and adjusting the background to get a striking shape.
No comments:
Post a Comment