Hi,
I need to receive a random one video mixed with another when it ends. One to another transition by level mixing. I do not understand how to make the mixing depended the duration video.and how to make a mix m1 goes from high to complete absence and m2 inverse
import processing.video.*;
Movie [] m1 = new Movie [15];
Movie [] m2 = new Movie [15];
int movieIndex=0;
float totalTime = 0.10;
int numPixels;
int typeBlend = ADD;
void setup() {
size( 1920, 1080 );
//here you need to randomly loaded
//where one ends and another has entered so in the loop
for (int i = 0; i < m1.length; i ++ ) {
m1 = new Movie( this, random("1" + "i" + ".mov") );
//m1.loop();
for (int i = 0; i < m2.length; i ++ ) {
m2 = new Movie( this, random("1" + "i" + ".mov" ));
// m2.loop();
//m2.speed( 0.5 );
numPixels = m1.width * m1.height;
}
void movieEvent(Movie m) {
m.read();
}
void draw()
//then it is necessary that the mixing depended the duration video and
//as one approaches the end of the following mixing started
//and mixing a m1 goes from high to complete absence
//m2 invert m1
{
m1.loadPixels();
m2.loadPixels();
float blendThresh = map(mouseX, 0, width, 0, 255);
for (int i = 0; i < numPixels; i++) {
float b = brightness(m1.pixels[i]);
if ( b > blendThresh ) {
m1.pixels[i] = lerpColor(m1.pixels[i], m2.pixels[i], map(b, 0, 255, 0, 1));
}
}
m1.updatePixels();
image(m1[movieIndex], 0, 0, width, height );
blend(m2[movieIndex], 0, 0, width, height, 0, 0, width, height, typeBlend );
if (typeBlend == SUBTRACT) typeBlend = LIGHTEST;
movieIndex = (movieIndex + 1) % m1.length;
movieIndex = (movieIndex + 1) % m2.length;
}