User Tools

Site Tools


part_12-_video

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
part_12-_video [2007/06/03 09:50]
tomliar0
part_12-_video [2007/08/30 13:53] (current)
Line 1: Line 1:
 ===== Processing Tutorial ===== ===== Processing Tutorial =====
 === Part 12: Video === === Part 12: Video ===
-Video works well with the book's classes. ​You have to include almost every file- does the .jar cut it? It only works on Windows for me- could be a PATH problemI'll look more at this.+== -12.1: Frame-Based Animation == 
 +We can do frame-based animation, but we have to use the Book's classes. 
 + 
 +If we are to use the book's classes, we have to have them as tabs in the current sketchbook **or** put them in the "​code"​ folderSee the //Bugs and Workarounds//​ section of [[Reports]] for more. This can get messy, but it works. ​It's safe to include them all __except__ SoundTest.java. 
 + 
 +An example: 
 +  import java.awt.*;​ 
 +   
 +  //public class MovieMaker_java {  //As an application 
 +  public class MovieMaker_java extends PApplet{ //As a sketch 
 +   
 +    //public void makeRectangleMovie ​ //As an application 
 +    void makeRectangleMovie(String directory) //As a sketch 
 +    {  
 +      int framesPerSecond = 30; 
 +      Picture p; 
 +      Graphics g = null; 
 +      FrameSequencer frameSequencer = new FrameSequencer(directory);​ 
 +     
 +      for(int i=0; i<​framesPerSecond;​ i++) 
 +      { 
 +        p = new Picture(640,​480);​ 
 +        g = p.getGraphics();​ 
 +        g.setColor(Color.RED);​ 
 +        g.fillRect(i*10,​i*5,​50,​50);​ 
 +        frameSequencer.addFrame(p);​ 
 +      } 
 +       
 +      frameSequencer.show();​ 
 +      frameSequencer.play(framesPerSecond);​ 
 +    } 
 +     
 +    //public static void main(String[] args)  //As an application 
 +    void setup() //As a sketch 
 +    { 
 +      MovieMaker_java movieMaker = new MovieMaker_java();​ 
 +      String dir = "​C:​\\";​ 
 +      movieMaker.makeRectangleMovie(dir);​ 
 +    } 
 +  } 
 + 
 +\\ 
 +Next: [[Part 13- Abbreviated Reference Guide]] 
 + 
 +Last: [[Part 11- Sound]] 
part_12-_video.1180882257.txt.gz · Last modified: 2007/08/30 13:53 (external edit)