Everett - I

By Everett Pelayo
void setup() { size (400, 400); smooth(); } void draw() { //draws a simplified big ben clock background(0, 0, 255); bigben (100, 70, 10, 50); bigben (200, 70, 30, 20); bigben (300, 70, 50, 40); bigben (100, 170, 50, 20); bigben (200, 170, 40, 100); bigben (300, 170, 20, 90); bigben (100, 320, 60, 20); bigben (200, 320, 80, 70); bigben (300, 320, 100, 30); } // big ben void bigben (float x, float y, float area, float insideColor) { //set x pos, y pos, area, color rectMode(CENTER); // places the rectangles based on the center fill(0 + insideColor,255 - insideColor, insideColor); // color generated by the variable rect (x, y, area, (area*2.5)); //rectangle is 1:1.5 //clock circle fill(255); //always a white clock noStroke(); ellipse(x, y, area-(area/4), area-(area/4)); float s = map(second(), 0, 60, 0, TWO_PI) - HALF_PI; float m = map(minute(), 0, 60, 0, TWO_PI) - HALF_PI; float h = map(hour() % 12, 0, 12, 0, TWO_PI) - HALF_PI; //clock hands // creates the hands based on the size of the circle stroke(0); line(x, y, cos(s) * (area/8) + x, sin(s) * (area/8) + y); line(x, y, cos(m) * (area/4) + x, sin(m) * (area/4) + y); line(x, y, cos(h) * (area/3) + x, sin(h) * (area/3) + y); }

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*