Created
October 31, 2011 21:12
-
-
Save atduskgreg/1328972 to your computer and use it in GitHub Desktop.
scrubbing a video file based on mouse movement
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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