int d=180, num=250, l=100, v=3; PVector[] location = new PVector[num]; PVector[] velocity = new PVector[num]; float r=-.25, sz=15; void setup() { size(500, 500, P3D); colorMode(HSB, 360, 100, 100); smooth(8); sphereDetail(30); for (int i=0; id-sz) velocity[i].x *= -1; if (location[i].y<-d+sz || location[i].y>d-sz) velocity[i].y *= -1; if (location[i].z<-d+sz || location[i].z>d-sz) velocity[i].z *= -1; noStroke(); fill(random(180,360), 90, 90); //fill(255); lights(); sphere(sz); popMatrix(); } r += 0.005; //saveFrame("image-###.tif"); //if (frameCount>130) noLoop(); }