mask on a videoloop is blinking
in
Core Library Questions
•
6 months ago
posted this again because i think this has to be in the forum Programming Questions but the post went into Core Library Questions:
hi there i got a problem with my videoloops that are masked with a jpg.
at the end of the loop when the video is jumping to the beginning for one frame the mask is not working
and the unmasked video is blinking for one frame...
anybody knows that problem?
heres the code
- import processing.video.*;
- Movie myMovie;
- int a = 0;
- //// Arrays für eye movie & Circle Class
- Movie [] eye = new Movie [16];
- Circle [] circles = new Circle[16];
- void setup()
- {
- //// Zuweisung der Filme zu den Arrays
- eye[0] = new Movie(this, "eye.mov");
- eye[0].loop();
- eye[1] = new Movie(this, "eye2.mov");
- eye[1].loop();
- eye[2] = new Movie(this, "eye.mov");
- eye[2].loop();
- eye[3] = new Movie(this, "eye2.mov");
- eye[3].loop();
- eye[4] = new Movie(this, "eye.mov");
- eye[4].loop();
- eye[5] = new Movie(this, "eye2.mov");
- eye[5].loop();
- eye[6] = new Movie(this, "eye.mov");
- eye[6].loop();
- eye[7] = new Movie(this, "eye2.mov");
- eye[7].loop();
- eye[8] = new Movie(this, "eye.mov");
- eye[8].loop();
- eye[9] = new Movie(this, "eye2.mov");
- eye[9].loop();
- eye[10] = new Movie(this, "eye.mov");
- eye[10].loop();
- eye[11] = new Movie(this, "eye2.mov");
- eye[11].loop();
- eye[12] = new Movie(this, "eye.mov");
- eye[12].loop();
- eye[13] = new Movie(this, "eye2.mov");
- eye[13].loop();
- eye[14] = new Movie(this, "eye.mov");
- eye[14].loop();
- eye[15] = new Movie(this, "eye2.mov");
- eye[15].loop();
- /** eye[16] = new Movie(this, "eye.mov");
- eye[16].loop();
- eye[17] = new Movie(this, "eye2.mov");
- eye[17].loop();
- eye[18] = new Movie(this, "eye2.mov");
- eye[18].loop();
- eye[19] = new Movie(this, "eye.mov");
- eye[19].loop();
- eye[20] = new Movie(this, "eye2.mov");
- eye[20].loop();
- **/
- size(1920,1000);
- smooth();
- /// if schleife welche die Circles erstellt
- for (int i = 0; i < circles.length; i++)
- {
- circles[i] = new Circle();
- }
- }
- void draw()
- {
- background(0);
- for (int i = 0; i < circles.length; i++)
- {
- circles[i].display();
- }
- }
- //funktion welche die objekte draggable machen
- void mouseDragged()
- {
- for (int i = 0; i < circles.length; i++)
- {
- circles[i].move();
- }
- }
- // die Circle Klasse
- class Circle
- {
- float r;
- float xpos;
- float ypos;
- int eyer=0;
- Circle()
- {
- xpos = random(width);
- ypos = random(height);
- noFill();
- r = 50;
- }
- void display()
- {
- noStroke();
- //fill(255,80);
- if (a == eye.length){
- a = 0;
- }
- if (a==5){
- rectMode(CENTER);
- PImage img, maskImg;
- maskImg = loadImage("mask-bg.jpg");
- eye[a].mask(maskImg);
- image(eye[a],xpos,ypos,304,224);
- }else{
- PImage img, maskImg;
- maskImg = loadImage("mask-bg.jpg");
- eye[a].mask(maskImg);
- image(eye[a],xpos,ypos,200,150);
- imageMode(CENTER);
- }
- a++;
- // rect(xpos,ypos,r*2,r*2);
- loop();
- }
- void move()
- {
- if(dist(mouseX,mouseY,xpos,ypos)<r)
- {
- xpos = mouseX;
- ypos = mouseY;
- if (xpos>width || ypos>height) {
- xpos = 0;
- ypos = 0;
- }
- }
- }
- }
- void movieEvent(Movie m) {
- m.read();
- }
1