Transparency and Movies
in
Contributed Library Questions
•
2 years ago
Hi, I'm new to processing and I want to use the transparency option on two movies instead of two images. When I call the two movies, the transparency function works but only on one movie. (The movie that was called last.) So I get a transparency of one movie overlapping itself instead of the two different movies overlapping. I used the OpenCV library to bring in the videos. So if any one could help me figure out why the other movie doesn't display I would appreciate it very much.
Here is the code:
import hypermedia.video.*;
import processing.video.*;
OpenCV monCV;
OpenCV frogCV;
float offset;
void setup() {
size( 640, 480 );
frogCV = new OpenCV( this );
frogCV.movie( "Princess and the Frog.AVI", width, height );
monCV = new OpenCV( this );
monCV.movie( "Monsters Inc_xvid.avi", width, height );
}
void draw() {
frogCV.read();
monCV.read();
tint(255, 153);
image(monCV.image(), 0, 0);
float offsetTarget = map(mouseX, 0, width, -frogCV.width/2 - width/2, 0);
offset += (offsetTarget-offset)*0.05;
tint(255, 153);
image(frogCV.image(), offset, 0 );
}
void mousePressed() {
float time = mouseX/float(width);
if (mouseButton == LEFT ) {
monCV.jump( time );
}
else {
frogCV.jump(time);
}
}
In this case the movie Monster's Inc. shows up, but the Princess and the Frog doesn't because it was called first. If I switch the order of the movies under void set up, Princess and the Frog will show up and Monster's Inc will not. The transparency function works, but I either have two images of Monster's Inc. or two of Princess and the Frog.
1