Seamless movie offset

edited October 2013 in How To...

Hi, I'm studying processing and I'm trying to make a simple project in processing. I have a 1920x400 movie and I display it in a 640 x 400 window so that it is cropped to the left and the right. The x position of the movie is controlled by mouseX. At the moment if the 0,0 coordinates of the movie are offset I can see the sketch background. I would like the end of the movie to repeat instead... I post a picture of what I'm trying to achieve... How can I achieve that without loading the movie several times? Can I repeat the pixels of the movie instead?

Untitled-2-01

import processing.video.*;
Movie myMovie;

// initian position of the movie
int x = 0;
int y = 0;

void setup() {
  size(640, 480, P2D);
  myMovie = new Movie(this, "pano.mp4");
  int x = myMovie.height;

  myMovie.play();
  myMovie.loop();
}

void draw() {
  // tint(255, 20);
  background (0);
  image(myMovie, x, y);
  if (mouseX > width / 2) 
  {
    x++;
  } else 
{ x--; 
}

}

// Called every time a new frame is available to read
void movieEvent(Movie m) {
  m.read();
}

Answers

Sign In or Register to comment.