We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpVideo Capture,  Movie Playback,  Vision Libraries › video progressively appearing in the background
Page Index Toggle Pages: 1
video progressively appearing in the background (Read 831 times)
video progressively appearing in the background
Jun 30th, 2009, 8:48am
 
I would like to have a video running in the background which is not seen at the start of the sketch but is slowly appearing as an ellipse is moved through the screen. I can do it with an image using a blend():
Code:

 PImage a;
 
 float xpos, ypos, pxpos, pypos;
 
// lets user control DisplayItems properties, value output and drawing attributes

void setup(){
 a = loadImage("DSC00617.JPG");
 background(0);
 // set size and framerate
 frameRate(10);

 size(1580, 1050);
}

void draw(){
 xpos = mouseX;
 ypos = mouseY;
 noStroke();
  ellipse(xpos, ypos, 50, 50);
  blend(a, 0,0,width,height,0,0,width,height, DARKEST);
 
}

But when I use a video instead I get all the images of the video superimposed on top of one another:
Code:

import processing.video.*;
 Movie myMovie;
 PImage a;
 
 float xpos, ypos, pxpos, pypos;
 
// lets user control DisplayItems properties, value output and drawing attributes

void setup(){

 background(0);
 // set size and framerate
 frameRate(10);

 size(640, 480, P2D);

 myMovie = new Movie(this, "station.mov");
 myMovie.loop();
}
void movieEvent(Movie myMovie) {
 myMovie.read();
}
void draw(){
 xpos = mouseX;
 ypos = mouseY;
 noStroke();
  ellipse(xpos, ypos, 50, 50);
  blend(myMovie, 0,0,width,height,0,0,width,height, DARKEST);
 
}

It is also possible to get similar effect with a copy(), but then I can do it only with squares:
Code:

import processing.video.*;
 Movie myMovie;
 // lets user control DisplayItems properties, value output and drawing attributes

void setup(){

 
 // set size and framerate
 frameRate(10);

 size(150, 150, P2D);

 myMovie = new Movie(this, "station.mov");
 myMovie.loop();
 image(myMovie,0,0) ;
 background(0);
}
void movieEvent(Movie myMovie) {
 myMovie.read();


}
void draw(){

 copy(myMovie,mouseX, mouseY,10, 10,mouseX, mouseY,10, 10);
}

How can I transform these squares into a circles?
Or modify my sketch with the blend() in order to get only one video?
Thanks!
Re: video progressively appearing in the background
Reply #1 - Jul 2nd, 2009, 9:09am
 
personally i would play the video on the background, then i'd create a transparent layer over it with createGraphics(), then i would fit into the transparent PGraphics a function that tracks the mouse position and colors black evey pixel with a distance>radius from the mouse position.
Re: video progressively appearing in the background
Reply #2 - Jul 6th, 2009, 9:40pm
 
have you tried ussing a mask?
Page Index Toggle Pages: 1