This reference is for Processing 3.0+. If you have a previous version, use the reference included with your software in the Help menu. If you see any errors or have suggestions, please let us know. If you prefer a more technical reference, visit the Processing Core Javadoc and Libraries Javadoc.
Name | movieEvent() |
||||
---|---|---|---|---|---|
Examples | import processing.video.*; Movie myMovie; void setup() { size(200, 200); myMovie = new Movie(this, "totoro.mov"); myMovie.loop(); } void draw() { image(myMovie, 0, 0); } // Called every time a new frame is available to read void movieEvent(Movie m) { m.read(); } import processing.video.*; Movie myMovie, yourMovie; void setup() { size(200, 200); myMovie = new Movie(this, "totoro.mov"); yourMovie = new Movie(this, "catbus.mov"); myMovie.play(); yourMovie.play(); } void draw() { image(myMovie, 0, 0); image(yourMovie, 100, 0); } void movieEvent(Movie m) { if (m == myMovie) { myMovie.read(); } else if (m == yourMovie) { yourMovie.read(); } } | ||||
Description |
This event function is run when a new movie frame is available. Use the read() method to capture this frame. If there is more than one movie in the program, movieEvent() is called each time any of the movies has a new frame available. Use an if to determine which movie is triggering the event. See the above example for implementation details.
This function is for people who want to process the image data separately from drawing (and as quickly as possible.) You cannot draw to the screen inside the movieEvent() function. If you want to draw immediately based on the new image, then use the Movie.available() method. |
||||
Syntax | void movieEvent(Movie which) { statements } | ||||
Parameters |
| ||||
Related | Movie |
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.