float boxSize = 40;
float margin = boxSize*2;
float depth = 400;
color boxFill;
void setup() {
size(640, 360, P3D);
noStroke();
}
void draw() {
background(651);
translate(width/8, height/8, -depth);
rotateY(frameCount * 0.01);
rotateX(frameCount * 0.75);
for (float i =- depth/2+margin; i <= depth/2-margin; i += boxSize){
pushMatrix();
for (float j =- height+margin; j <= height-margin; j += boxSize){
pushMatrix();
for (float k =- width+margin; k <= width-margin; k += boxSize){
boxFill = color(abs(i), abs(j), abs(k), 50);
pushMatrix();
translate(k, j, i);
fill(boxFill);
box(boxSize, boxSize, boxSize);
popMatrix();
}
popMatrix();
}
popMatrix();
}
}

Leave a comment