blinking random text - noob
in
Programming Questions
•
2 years ago
Hey everybody, so I've been trying to get processing to display random words at a fixed interval of about 4 seconds on the screen, then about 1 second blank, then a different word from the index shows up, etc. I'm stuck with figuring out the proper coordination of the timer and all it's doing is displaying the word "dude" in little blips every 4 seconds. Anything would help, thanks!
import fullscreen.*;
FullScreen fs;
int savedTime;
int totalTime = 5000;
String[] terms = {
"Dude" ,
"Brother" ,
"Friend" ,
"Bro" ,
"Buddy" ,
"Son" ,
"Pops",
"Baby" ,
"Man" ,
};
PFont f;
float x;
int index = 0;
void setup() {
size(2160,1640);
f = loadFont( "PerpetuaTitlingMT-Light-200.vlw" );
textFont(f,200);
fs = new FullScreen(this);
fs.enter();
x = width/2;
}
void draw() {
background(0);
fill(255);
textFont(f,250);
textAlign (CENTER);
int passedTime = millis() + savedTime;
if (passedTime > 1000) {
text(terms[index],width/2,height/2);
int index = int(random(terms.length));
println(terms[index]);
savedTime = millis();
}
}
import fullscreen.*;
FullScreen fs;
int savedTime;
int totalTime = 5000;
String[] terms = {
"Dude" ,
"Brother" ,
"Friend" ,
"Bro" ,
"Buddy" ,
"Son" ,
"Pops",
"Baby" ,
"Man" ,
};
PFont f;
float x;
int index = 0;
void setup() {
size(2160,1640);
f = loadFont( "PerpetuaTitlingMT-Light-200.vlw" );
textFont(f,200);
fs = new FullScreen(this);
fs.enter();
x = width/2;
}
void draw() {
background(0);
fill(255);
textFont(f,250);
textAlign (CENTER);
int passedTime = millis() + savedTime;
if (passedTime > 1000) {
text(terms[index],width/2,height/2);
int index = int(random(terms.length));
println(terms[index]);
savedTime = millis();
}
}
1