Video Random Walk #processing #randomwalk #video #random
/*
First esperiment in random walk
applied to video
THIS IS A PROCESSING SKETCH
Change file suffix from .java to .pde
before running
*/
import processing.video.*;
Movie myMovie;
static float frameDuration = 0.1;
float maxJump = 2.0;
float jumpBias = .7;
void setup() {
size(320, 240);
myMovie = new Movie(this, "test.mp4");
myMovie.play();
image(myMovie, 0, 0);
}
void draw() {
float jump = ((randomGaussian() * maxJump) + jumpBias) * frameDuration;
float newtime = myMovie.time() + jump;
if(newtime < 0.0)
newtime = 1;
myMovie.jump(newtime);
}
void movieEvent(Movie m) {
m.read();
image(m, 0, 0);
}