We are about to switch to a new forum software. Until then we have removed the registration on this forum.
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?
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
yes. try the copy() command.
http://processing.org/reference/copy_.html
copy the slice of the movie from from 0 to (width - mouseX) to mouseX. copy the slice of the movie frame from (width - mouseX) to width to 0