// Example using a FOR loop to make a movie by adding different images to a framesequences // // Jay Summet - Georgia Tech // Released to the public domain: Aug 2009 // public class MovieExample { public static void main( String [] args ) { // Ask the user to pick a background. "Beach.jpg" or "Jungle.jpg" are good choices String myBackground = FileChooser.pickAFile(); // p2 is modified. p is used to store the unmodified background // and is copied to make new P2's so that the sprite // will have a fresh background each time Picture p = new Picture(myBackground); Picture p2 = p.copy(); // The following line will only work correctly if you have ALREADY set the // default Media Path using a command such as: // FileChooser.setMediaPath( FileChooser.pickADirectory() ); Picture sprite = new Picture("rose.jpg"); sprite = sprite.scale(0.50); // Change this TEMP directory to something that works for your computer! FrameSequencer mfs = new FrameSequencer("/tmp"); int stepSize = p.getWidth() / 10; for(int i = 0; i < p.getWidth(); i = i + stepSize ) { sprite.compose(p2, i, 0); mfs.addFrame(p2); p2 = p.copy(); // Try leaving this line out and see what happens! } // end for mfs.show(); } // End of main } // end of class Example