10. November 2010
Der erste Block sind die Stunden, dann folgen Minuten und Sekunden.//SetUp void setup() { //System size(770,210); smooth(); noStroke(); frameRate(1); } //Draw Cycle void draw() { //Background background(50); //Draw Elements grid(20,20,4,6,hour()+1); grid(150,20,10,6,minute()+1); grid(460,20,10,6,second()+1); } //Draw a Grid void grid(int posx, int posy, int cols, int rows, int value) { //Set Count int count = 1; //Loop for(int x=0; x<cols; x++) { for(int y=0; y<rows; y++) { if(count < value) { fill(255); rect(x*30+posx,y*30+posy,20,20); } else { fill(0); rect(x*30+posx,y*30+posy,20,20); } //Count Up count++; } } }