remember that draw() runs 60 times per second approx.; so it runs very fast, displays the letter throughout, and only every 1 and 3 seconds changes a letter
Remark
To get better initial letters move this
c += random(93);
d += random(93);
into setup() - I haven’t done this.
Remarks
This works without frameRate (4);
This looks better with 1000 and 3500 as values, because then the 2 letters don’t change at the same time (3000 would be divisible by 1000 (values now)). - I haven’t done this.
Full Sketch
char c = 33;
char d = 33;
int timerc, timerd;
void setup() {
size(500, 500);
background(0);
// frameRate (4);
textSize(128);
}
void draw() {
background(0);
if (millis() - timerc > 1000) {
c=33;
c += random(93);
timerc=millis();
}
if (millis() - timerd > 3000) {
d=33;
d += random(93);
timerd=millis();
}
text(c, 150, 250);
text(d, 300, 250);
text(":", 250, 250);
}
You could just use modulo with frame count, change the 60 and 180 to what ever you want, i just set them as that for 1 second for c and 3 seconds for d
if (frameCount % 60 == 0) c += random(93);
if (frameCount % 180 == 0) d += random(93);
Much simpler than using variables to track
An example…
char c = 33;
char d = 33;
void setup(){
size(500,500);
}
void draw(){
background(0);
if (frameCount % 20 == 0) c += random(93);
if (frameCount % 60 == 0) d += random(93);
fill(255);
textSize(50);
text(c, 150, 250);
text(d, 300, 250);
}