rrrr
YaBB Newbies
Offline
Posts: 41
clock image won't restart
Jan 20th , 2009, 10:25am
hi, i'm making a clock using the noise() function. i'm having trouble with having the separate images for the seconds, minutes, and hours loop back around. they are supposed to move from the left to the right of the screen, and start over when they have reached to right of the screen. so far, they just stop once they reach the end. does anyone know how to fix this? do i need to put them in classes? any help would be REALLY great! thanks! void setup(){ size(600, 200); background(#CCCCBB); } void draw(){ secdraw(); mindraw(); hourdraw(); } //NOT RESTARTING! void secdraw(){ float s = map(second(), 0, 60, 0, 600); float v = 0.0; float inc = 0.1; for (int i = 0; i < s; i = i+4){ fill(255); noStroke(); noiseSeed(0); float n = noise(v) * 70.0; //noise() function is used to create smoother transitions thatn the #s returned by random rect(i, 5 + n, 2, 10); v = v + inc; } } void mindraw(){ float m = map(minute(), 0, 60, 0, 600); float v = 0.0; float inc = 0.1; for (int j = 0; j < m; j = j+4){ fill(255); noStroke(); noiseSeed(0); float n = noise(v) * 70.0; //noise() function is used to create smoother transitions thatn the #s returned by random rect(j, 20 + n, 2, 55); v = v + inc; } } void hourdraw(){ float h = map(hour(), 0, 24, 0, 600); float v = 0.0; float inc = 0.1; for (int k = 0; k < h; k = k+4){ fill(255); noStroke(); noiseSeed(0); float n = noise(v) * 70.0; //noise() function is used to create smoother transitions thatn the #s returned by random rect(k, 80 + n, 2, 85); v = v + inc; } }