topical media & game development
graphic-processing-learning-16-example-16-5-example-16-5.pde / pde
// Learning Processing
// Daniel Shiffman
// http://www.learningprocessing.com
// Example 16-5: Scrubbing forward and backward in movie
// If mouseX is 0, go to beginning
// If mouseX is width, go to end
// And everything else scrub in between
import processing.video.*;
Movie movie;
void setup() {
size(320,240);
movie = new Movie(this, "cat.mov");
}
void draw() {
// Ratio of mouse X over width
float ratio = mouseX / (float) width;
// The jump() function allows you to jump immediately to a point of time within the video.
// duration() returns the total length of the movie in seconds.
movie.jump(ratio*movie.duration());
// Read frame
movie.read();
// Display frame
image(movie,0,0);
}
(C) Æliens
20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.