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/04 09:55]
tomliar0
part_12-_video [2007/08/30 13:53] (current)
Line 2: Line 2:
 === Part 12: Video === === Part 12: Video ===
 == -12.1: Frame-Based Animation == == -12.1: Frame-Based Animation ==
-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 problem. I'll look more at this.+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"​ folder. See 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.
  
-=== AppendixAn Abbreviated Reference Guide ===+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.1180968927.txt.gz · Last modified: 2007/08/30 13:53 (external edit)