Processing > Minuterie
Contents (hide)
int timeStamp; int interval; void setup() { size(200, 200); smooth(); interval = 2000; } void draw() { background(0); if ( millis() - timeStamp >= interval ) { timeStamp = timeStamp + interval; // Faire qqch ici. } }
int timeStamp; int interval; void setup() { size(200, 200); smooth(); interval = 2000; } void draw() { background(255); fill(0); text("millis(): "+millis(), 10,20); text("timestamp: "+timeStamp,10,40); text("interval: "+interval,10,60); text("millis()-timestamp: "+(millis()-timeStamp),10,80); if ( millis() - timeStamp >= interval ) { timeStamp = timeStamp + interval; background(0); // Faire qqch ici. } }
int timeStamp; int interval; color c; void setup() { size(200,200); smooth(); c = color(random(256),random(256),random(256)); interval = 2000; } void draw() { background(c); // Changer la couleur a chaque intervalle if ( millis() - timeStamp >= interval ) { timeStamp = timeStamp + interval; c = color(random(256),random(256),random(256)); } }
int timeStamp; int interval; color c; void setup() { size(200,200); smooth(); c = color(random(256),random(256),random(256)); interval = 2000; } void draw() { background(c); // Changer la couleur a chaque intervalle if ( millis() - timeStamp >= interval ) { timeStamp = timeStamp + interval; interval = int(random(500,4000)); c = color(random(256),random(256),random(256)); } }
int timeStamp; int interval; color c; void setup() { size(200, 200); smooth(); c = color(random(256), random(256), random(256)); interval = 2000; } void draw() { background(c); // Changer la couleur si la souris est maintenue 2 secondes if ( mousePressed ) { if ( millis() - timeStamp >= interval ) { timeStamp = timeStamp + interval; c = color(random(256), random(256), random(256)); } } else { timeStamp = millis(); } }
int[] timeStamp; int[] interval; color[] c; final int TAILLE = 100; float[] tableauDeX; float[] tableauDeY; void setup() { size(400, 400); smooth(); tableauDeX = new float[TAILLE]; tableauDeY = new float[TAILLE]; interval = new int[TAILLE]; timeStamp = new int[TAILLE]; c = new color[TAILLE]; for ( int i=0; i < TAILLE ; i = i + 1 ) { tableauDeX[i] = random(0, width); tableauDeY[i] = random(0, height); c[i] = color(random(256), random(256), random(256)); interval[i] = int( random(500, 5000) ); } } void draw() { background(0); for ( int i=0; i < TAILLE ; i = i + 1 ) { if ( millis() - timeStamp[i] >= interval[i] ) { timeStamp[i] = timeStamp[i] + interval[i] ; c[i] = color(random(256), random(256), random(256)); } fill(c[i]); ellipse(tableauDeX[i], tableauDeY[i], 50, 50); } }
int term; int interval; color c; void setup() { size(200, 200); smooth(); interval = 2000; c= color(random(256), random(256), random(256) ); } void draw() { background(c); if ( millis() > term ) { term = term + interval; c= color(random(256), random(256), random(256) ); } }
int term; int interval; color c; void setup() { size(200, 200); smooth(); interval = 2000; c= color(random(256), random(256), random(256) ); } void draw() { background(c); if ( millis() > term ) { interval = int( random(500,4000) ); term = term + interval; c= color(random(256), random(256), random(256) ); } }