using millis() to time and delay intermittent text / flashing background
in
Programming Questions
•
1 years ago
Trying to devise a way to flash the background for 5 seconds and then display a tweet text onscreen for 5 seconds sans the flashing background. I know I am close but I am entirely stumped as to how best tweak my second if statement so that it delays the flashing and lets the text from the tweet I am grabbing via DisplayTweets(); exist uninterrupted for five seconds and then repeat the whole process again. Thanks in advance for your ideas.
int timeDelay = 5000; //milliseconds in one minute
int lastTime = 0;
void setup() {
size(1024,780);
background(152,152,152);
connectTwitter();
getSearchTweets();
// DisplayTweets();
lastTime = millis();
rectMode(CORNER);
// noLoop();
}
void draw() {
if(millis()-lastTime<=timeDelay){
rectMode(CORNER);
float m = millis();
fill(m % 255);
rect(0, 0, 1024, 780);
lastTime=millis();
}
if(millis()-lastTime>=timeDelay){
// background(152,152,152);
DisplayTweets();
lastTime=millis();
}
}
int timeDelay = 5000; //milliseconds in one minute
int lastTime = 0;
void setup() {
size(1024,780);
background(152,152,152);
connectTwitter();
getSearchTweets();
// DisplayTweets();
lastTime = millis();
rectMode(CORNER);
// noLoop();
}
void draw() {
if(millis()-lastTime<=timeDelay){
rectMode(CORNER);
float m = millis();
fill(m % 255);
rect(0, 0, 1024, 780);
lastTime=millis();
}
if(millis()-lastTime>=timeDelay){
// background(152,152,152);
DisplayTweets();
lastTime=millis();
}
}
1