- Show Sketch
/** @peep sketchcode */
void setup(){
size(720,720);
stroke(250);
}
void draw(){
strokeWeight(85);
noFill();
background(0);// clearing the canvas
//geting current time
int s = second(); // Values from 0 - 59
int m = minute(); // Values from 0 - 59
int h = hour(); // Values from 0 - 23
String state = "PM";
//AM or PM state check
if (h > 12){
h -= 12;
state = "PM";
}else{
state = "AM";
}
if(h == 12){
state = "PM";
}
// time to pi ratio calculator
float sd = (((s+0.1)*2)*100/60)+150;
float md = (((m+0.1)*2)*100/60)+150;
float hd = (((h+0.1)*2)*100/12)+150;
stroke(61,15,18);
arc(width/2, width/2, 560, 560, 1.5*PI,3.5*PI);
stroke(52,66,16);
arc(width/2,width/2, 380, 380, 1.5*PI,3.5*PI);
stroke(11,77,99);
arc(width/2,width/2, 200, 200, 1.5*PI,3.5*PI);
//clock hands
stroke(254,63,73);
arc(width/2, width/2, 560, 560, 1.5*PI,(hd/100)*PI);
stroke(192,243,60);
arc(width/2,width/2, 380, 380, 1.5*PI,(((sd/100)/60)+(md/100))*PI);
stroke(29,194,252);
arc(width/2,width/2, 200, 200, 1.5*PI,(sd/100)*PI);
// shaded circles
noStroke();
fill(173,43,50);
// ellipse(width/2,60,100,100);
fill(139,176,43);
// ellipse(width/2,160,100,100);
fill(20,132,171);
// ellipse(width/2,260,100,100);
textSize(45);
//time Labels
noStroke();
fill(254,52,115);
text("HOURS", (width/2)-205, 95);
fill(203,243,30);
text("MINUTES", (width/2)-245, 190);
fill(12,235,252);
text("SECONDS", (width/2)-258, 280);
fill(0);
text(h, (width/2)-25, 95);
text(m, (width/2)-28, 190);
text(s, (width/2)-28, 280);
fill(255);
text(state, (width/2)-28, 375);
}
Nothing in the gallery yet!
Comments
Nobody has said anything yet.