Particle[] particles = new Particle[5]; float angle; float friction = 1; PVector center; boolean showSphere = true; boolean drawMode = false; void setup() { size(600, 600, P3D); background(0); center = new PVector(0,0,0); for (int i = 0; i < particles.length; i++) { particles[i] = new Particle( random(-10, 10), random(-10, 10), random(-10, 10) ); } } void draw() { if (drawMode == false) { background(0); } // directionalLight(127, 127, 127, 0, 1, 0); // ambientLight(200,200,200); translate(width/2, height/2, -width/2); rotateX(cos(angle)*PI/2); rotateY(sin(angle)*PI/2); rotateZ(sin(angle)*PI/2); if (showSphere == true) { noFill(); stroke(255,50); sphere(400); } for (int i = 0; i < particles.length; i++) { particles[i].update(); particles[i].show(); } angle += 0.001; } void keyPressed() { if (key == 'R' || key == 'r') { println("changing the radius!"); for (int i = 0; i < particles.length; i++) { particles[i].radius = random(1, 50); } } if (key == 'S' || key == 's') { println("hiding/showing sphere"); showSphere = !showSphere; } if (key == ' ') { drawMode = !drawMode; println("draw mode is currently " + drawMode); if (drawMode == true) { showSphere = false; } } }