import processing.video.*; MovieMaker mm; Firefly[] fireflies = new Firefly[200]; void setup() { size(720,480); smooth(); //frameRate(30); mm = new MovieMaker(this, width, height, "fireflies.mov", 30); for(int i = 0; i < fireflies.length; i++) { fireflies[i] = new Firefly(random(-100,width+100), random(-100, height+100), random(5,20)); } } void draw() { background(0); for (int i = 0; i < fireflies.length; i++) { fireflies[i].move(); fireflies[i].display(); } // Add window's pixels to movie last command in draw function. mm.addFrame(); } void keyPressed() { if (key == ' ') { // Finish the movie if space bar is pressed mm.finish(); // Quit running the sketch once the file is written exit(); } }