Cooperunionstud
YaBB Newbies
Offline
Posts: 1
with with a clock program
May 6th , 2005, 6:42am
Hi..i am a student of pitaru. the programmer who wrote the sonia plugin for processing. i am having a bit of trouble with the clock i am making..basically i want to introduce some kinda of fog or alpha channel that would lighten the text as it is being rotated to the back so that the front can be read more easily. thanks for your help PFont f; float ang; float cubeSize = 80; String [] timeZone = new String[4]; void setup(){ size(400,400); f = loadFont("Bauhaus-Heavy-Bold-48.vlw"); textFont(f, 24); textMode(ALIGN_CENTER); rectMode(CENTER); smooth(); timeZone[0] = "New York"; timeZone[1] = "California"; timeZone[2] = "Lebanon"; timeZone[3] = "Beijing"; } void draw(){ background(255); //ang += 0.01; ang %= TWO_PI; // loop ang value between 0 and two_pi // rotate the cube translate(width/2, height/2); rotateY(ang + Xnorm()); // rotateX(ang + Ynorm()); for(int i = 0; i < 4; i++) { drawWall(i); } } //if (mousePressed = "false") {mouseX = 0;} // mpas range of mouseX to 0->two-pi float Xnorm() { float x_0_to_1 = mouseX/float(width); float x_0_to_2PI = x_0_to_1 * TWO_PI; return x_0_to_2PI; } // float Ynorm(){ // float y_0_to_1 = mouseY/float(height); // float y_0_to_2PI = y_0_to_1 * TWO_PI; // return y_0_to_2PI; // } // draws one face of our cube void drawWall(int i){ int s = second(); // Values from 1 - 31 int m = minute(); // Values from 1 - 12 int h = hour(); // 2003, 2004, 2005, etc. int g = 3; push(); rotateY(HALF_PI*i); translate(0,0,cubeSize); //fill(255); //rect(0,0,cubeSize*2,cubeSize*2); fill(0); translate(-115,0); String c = String.valueOf(h); textMode(ALIGN_LEFT); text(c, 40, 0, 1); text(":", 70, -2, 1); c = String.valueOf(m); text(c, 80, 0, 1); text(":", 110, -2, 1); c = String.valueOf(s); text(c, 120, 0, 1); if (h<12) { text("AM", 150,0,1); } else {text("PM", 150,0,1); } //textMode(ALIGN_LEFT); text(timeZone[i],60,30,1); pop(); }