Fade in and fade out within an array of Strings
in
Programming Questions
•
1 years ago
I am trying to fade in and fade out each String of an array on its own. I have a simple way to do the fade outs but I need a simple way to switch to fade in mode when the opacity reaches 0. There must be a simple way to do this with conditionals but I am a bit lost right now. I can't see the forest for the trees... I am using two variables to control this: fOpacity and transparency
float transparency;
float [] fOpacity;
transparency = 255;
fOpacity=new float [numberOfGraffiti];
void display () {
for (int n = 0; n < numberOfGraffiti; n ++ ) {
if (transparency > 0) {
transparency += 0.25;
}
else if (transparency == 0) {
transparency = 255;
}
textFont(fontA, 48); // Set the font type and size at 48 and random types
fill(fClr[n], fOpacity[n]-transparency);
for (int i = 0; i < retrieve.length; i ++ ) {
text (retrieve[n], wordsPosX[n], wordsPosY[n]);
}
}
float transparency;
float [] fOpacity;
transparency = 255;
fOpacity=new float [numberOfGraffiti];
void display () {
for (int n = 0; n < numberOfGraffiti; n ++ ) {
if (transparency > 0) {
transparency += 0.25;
}
else if (transparency == 0) {
transparency = 255;
}
textFont(fontA, 48); // Set the font type and size at 48 and random types
fill(fClr[n], fOpacity[n]-transparency);
for (int i = 0; i < retrieve.length; i ++ ) {
text (retrieve[n], wordsPosX[n], wordsPosY[n]);
}
}
1