We are about to switch to a new forum software. Until then we have removed the registration on this forum.
So basically i have 2 layers of images the top layer changes the tint / transparancy then when it = 0 the next image loads (starting on image 1) the bottom layer is a solid image that changes to the next image when the other one changes (starting on image 2) so it gives the illusion of the images fading into each other there is a loop so it does begin again by itself but i want to be able to manually reset the code with a mouse click help please!
int sWidth = 1000;
int sHeight = 600;
String[] imgNames = {
"closedbox.jpeg", "1.jpeg", "2.jpeg"
};
PImage img1, img2;
int start = 0;
int next = 1;
int startTime = millis();
int tintVal = 255;
void setup() {
size(sWidth, sHeight);
img1 = loadImage(imgNames[start]);
img2 = loadImage(imgNames[next]);
}
void draw() {
background(0);
int currentTime = millis();
int lapsedTime = currentTime - startTime;
println(lapsedTime);
if (lapsedTime > 16.9412)
startTime = millis();
}
println(tintVal);
tint(255, 255);
image(img2, 10, 10);
tint(255, tintVal);
image(img1, 10, 10);
if (tintVal<0) {
tintVal = 255;
start++;
if (start>2) {
start = 0;
}
next++;
if (next>2) {
next = 0;
}
img1 = loadImage(imgNames[start]);
img2 = loadImage(imgNames[next]);
}
}__
Answers
Add a mouseClicked() function, where you reset the global variables to their initial values.