float angle; void setup() { size(800, 400, P3D); fill(255); noStroke(); } float d = 32; void draw() { float camZ = (height/2) / tan(PI*60/360); camera(mouseX, mouseY, camZ, width/2, height, 0, 0, 1, 0); translate(width/2, height/2, 0); rotateY(mouseX*PI/width); //rotateY(angle); lights(); //ambientLight(102, 102, 102); //directionalLight(102, 102, 102, 1, 1, 0); //pointLight(255, 255, 255, 500*cos(angle), 0, 500*sin(angle)); spotLight(0, 255, 0, 500*cos(angle), 500*cos(angle), 500*sin(angle), 1, 1, 1, PI, 2); background(0); for (int i = -height/2; i < height/2; i+=d*1.2) { for (int j = -height/2; j < height/2; j+=d*1.2) { pushMatrix(); translate(i,j,-j); box(d, d, d); popMatrix(); } } angle+=0.04; if (angle>2*PI) angle=0; }