problems with if
in
Core Library Questions
•
1 year ago
Here I am again. I made this following code in Processing, but nothing occurs. I think it have something to do with the booleans. I think I did something wrong in the void captureSave, movieShades and showImage with the 'if's,' but I can't figure out what :(
This is the code:
____________________________________________________________________________________________
//Pre-setup
//Videos
import processing.video.*;
Movie Shades;
Capture myCapture;
//booleans
boolean a = false;
boolean b = false;
boolean c = false;
//Images
PImage d, e;
//Setup
void setup() {
//workspace
size(640, 480, P2D);
//loadimages
d = loadImage("bg.jpg");
e = loadImage("createimage.jpg");
//Capture setup
myCapture = new Capture(this, width, height, 30);
//Movie Shades setup
Shades = new Movie(this, "film.mov");
}
//Make the Capture
void captureEvent (Capture myCapture){
myCapture.read ();
}
//Draw
void draw(){
//Is always visable
image(d, 0, 0);
}
//Hide till mouse is pressed
//Webcam capture, save image
void captureSave(){
if (a = true);
image(myCapture, 0, 0);
saveFrame("data/createimage.jpg");
delay (300);
myCapture.stop();
}
//Show movie Shades
void movieShades(){
if (b = true);
image (Shades, 0, 0);
Shades.play();
}
//Show saved image with blend
void showImage(){
if (c = true);
blend(e, 0, 0, 640, 480, 0, 0, 640, 480, MULTIPLY);
}
//Mouse is pressed
void mousePressed(){
a = true;
b = true;
c = true;
}
//End code
This is the code:
____________________________________________________________________________________________
//Pre-setup
//Videos
import processing.video.*;
Movie Shades;
Capture myCapture;
//booleans
boolean a = false;
boolean b = false;
boolean c = false;
//Images
PImage d, e;
//Setup
void setup() {
//workspace
size(640, 480, P2D);
//loadimages
d = loadImage("bg.jpg");
e = loadImage("createimage.jpg");
//Capture setup
myCapture = new Capture(this, width, height, 30);
//Movie Shades setup
Shades = new Movie(this, "film.mov");
}
//Make the Capture
void captureEvent (Capture myCapture){
myCapture.read ();
}
//Draw
void draw(){
//Is always visable
image(d, 0, 0);
}
//Hide till mouse is pressed
//Webcam capture, save image
void captureSave(){
if (a = true);
image(myCapture, 0, 0);
saveFrame("data/createimage.jpg");
delay (300);
myCapture.stop();
}
//Show movie Shades
void movieShades(){
if (b = true);
image (Shades, 0, 0);
Shades.play();
}
//Show saved image with blend
void showImage(){
if (c = true);
blend(e, 0, 0, 640, 480, 0, 0, 640, 480, MULTIPLY);
}
//Mouse is pressed
void mousePressed(){
a = true;
b = true;
c = true;
}
//End code
1