Skip to content

Instantly share code, notes, and snippets.

@atduskgreg
Created October 31, 2011 21:12
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save atduskgreg/1328972 to your computer and use it in GitHub Desktop.
Save atduskgreg/1328972 to your computer and use it in GitHub Desktop.
scrubbing a video file based on mouse movement
/* Scrub a video based on mouseX. */
import processing.video.*;
Movie myMovie;
void setup() {
size(640, 480, P2D);
background(0);
// Load the video and pause it
myMovie = new Movie(this, "station.mov");
myMovie.pause();
}
void draw() {
// queue the movie to the time corresponding to mouseX
float moviePosition = map(mouseX, 0, width, 0, myMovie.duration());
myMovie.jump(moviePosition);
// load up that frame and display it
myMovie.read();
image(myMovie,0, 0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment