'How to show and hide PImages in an 'if' statement
So I have waves appearing in sequence according to framerate and I want to show and hide them so that the images don't overlap. How would I implement a show boolean into my if statement? I appreciate the help alot
I'll paste the code below
class Waves {
float x, y;
Waves(float _x, float _y) {
x = _x;
y = _y;
}
void waveShow() {
boolean show = true;
//this is what I can't figure out
}
void waveDisplay() {
PImage[] waves = new PImage[3];
waves[0] = loadImage("wave1.png");
waves[1] = loadImage("wave2.png");
waves[2] = loadImage("wave3.png");
if (frameCount < 15) {
image(waves[0], 0, 0);
}
else if (frameCount > 15 & frameCount < 30) {
image(waves[1], 0, 0);
}
else if (frameCount > 30 & frameCount < 45) {
image(waves[2], 0, 0);
}
else if (frameCount > 45) {
background(scenes[stepperValue]);
frameCount = 0;
}
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
