mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
Tweaks to the Movie examples
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Frames.
|
||||
* by Andres Colubri
|
||||
* Frames
|
||||
* by Andres Colubri.
|
||||
*
|
||||
* Moves through the video one frame at the time by using the
|
||||
* arrow keys. It estimates the frame counts using the framerate
|
||||
|
||||
@@ -22,7 +22,7 @@ boolean once = true;
|
||||
void setup() {
|
||||
size(640, 360);
|
||||
background(0);
|
||||
mov = new Movie(this, "transit.mov");
|
||||
mov = new Movie(this, "transit.mkv");
|
||||
mov.play();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
/**
|
||||
* Scratch.
|
||||
* by Andres Colubri
|
||||
* Scratch
|
||||
* by Andres Colubri.
|
||||
*
|
||||
* Move the cursor horizontally across the screen to set
|
||||
* the position in the movie file.
|
||||
*/
|
||||
|
||||
|
||||
import processing.video.*;
|
||||
|
||||
Movie mov;
|
||||
@@ -22,19 +22,18 @@ void setup() {
|
||||
mov.pause();
|
||||
}
|
||||
|
||||
void movieEvent(Movie m) {
|
||||
m.read();
|
||||
}
|
||||
|
||||
void draw() {
|
||||
// A new time position is calculated using the current mouse location:
|
||||
float f = constrain((float)mouseX / width, 0, 1);
|
||||
float t = mov.duration() * f;
|
||||
if (mov.ready()) {
|
||||
|
||||
if (mov.available()) {
|
||||
mov.read();
|
||||
// A new time position is calculated using the current mouse location:
|
||||
float f = map(mouseX, 0, width, 0, 1);
|
||||
float t = mov.duration() * f;
|
||||
mov.play();
|
||||
mov.jump(t);
|
||||
mov.pause();
|
||||
}
|
||||
}
|
||||
|
||||
image(mov, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* GSVideo movie speed example.
|
||||
* Speed.
|
||||
*
|
||||
* Use the Movie.speed() method to change
|
||||
* the playback speed.
|
||||
@@ -15,8 +15,6 @@ void setup() {
|
||||
background(0);
|
||||
mov = new Movie(this, "transit.mov");
|
||||
mov.loop();
|
||||
|
||||
textSize(18);
|
||||
}
|
||||
|
||||
void movieEvent(Movie movie) {
|
||||
|
||||
Reference in New Issue
Block a user