Ciao good folks,
For an art installation, I'm working with PS3 eye webcam + processing.
My goal is to have the live view of the webcam, but when the button"S" is pressed the code should:
save the frame --> load a white image to simulate the flash effect, freeze the frame for 1 second, return to live view.
Instead what my code does when button "s" is pressed is:
save frame--> 1 sec freeze image --> white image --> return to live view.
I can not understand what's wrong in my code and how can I change the order of events as whish.
here the code:
import java.util.ArrayList;
import com.thomasdiewald.ps3eye.PS3Eye;
import com.thomasdiewald.ps3eye.PS3EyeP5;
PS3EyeP5 ps3eye;
PImage flash;
int counter = 0;
void setup() {
size(640, 480);
smooth(0);
flash = loadImage("white.jpg");
ps3eye = PS3EyeP5.getDevice(this);
ps3eye.init(60, PS3Eye.Resolution.VGA);
ps3eye.start();
frameRate(1000);
}
void draw() {
if (ps3eye !=null) {
ps3eye.start();
image(ps3eye.getFrame(), 0, 0, width, height);
}
}
void keyPressed() {
if ( key == 's' ) {
String s = "print/" + "microbe" + nf(counter, 4) +".jpg";
save(s);
counter++;
flash();
}
}
void flash() {
image(flash, -5, 0);
ps3eye.stop();
delay(1500);
}