Lab2 - Analog Clock


void setup(){
  size(530,530);
}
void draw(){
  background(1);
  circle();
  point_clock();
  number();
  clock_hand();
  //Digital();
}

void circle(){
  noFill();
  int C=255; //Storke Color
  int B=(width-width/30); //Line
  for(int A=0;A<333;A++){
  stroke(C);
  ellipse(width/2,height/2,B,B);
  B--;
  C=C-3;
  if(C<1)C=1;}
}

void number(){
  stroke(255);
  //line(width/2,0,width/2,height);
  //line(0,height/2,width,height/2);

  textSize(height/10);
 text("12",width/2-width/16,height/10);
 text("3",width-width/12,height/2+height/25);
 text("6",width/2-width/32,height-height/25);
 text("9",width/35,height/2+height/25);
}

void point_clock(){
  stroke(#00FF00);
  //Dimeter
  float D=width-width/10;
  //Girth
  strokeWeight(5);

  for(int A=0;A<12;A++){
  if(A!=0 && A!=3 && A!=6 && A!=9){
  line (width/2+sin(radians(A*30))*D*2/5,
  height/2-cos(radians(A*30))*D*2/5,
  width/2+sin(radians(A*30))*D/2,
  height/2-cos(radians(A*30))*D/2);}}

  strokeWeight(2);
  stroke(255);
  int B=1;
  for(int A=1;A<24;A++){
  if(B!=0 && B!=6 && B!=12 && B!=18){
  line (width/2+sin(radians(B*15))*D*6/13,
  height/2-cos(radians(B*15))*D*6/13,
  width/2+sin(radians(B*15))*D/2,
  height/2-cos(radians(B*15))*D/2);}
  B=B+2;
}

}
void clock_hand(){
  float D=width-width/10;
  strokeWeight(13);
    stroke(#00BFFF);
  line (width/2,
        height/2,
        width/2+sin(radians(hour()*30))*D*2/13,
        height/2-cos(radians(hour()*30))*D*2/13);
   strokeWeight(5);
   stroke(255);
  line (width/2,
        height/2,
        width/2+sin(radians(minute()*6))*D*2/7,
        height/2-cos(radians(minute()*6))*D*2/7);
        strokeWeight(1);
  line (width/2,
        height/2,
        width/2+sin(radians(second()*6))*D/2,
        height/2-cos(radians(second()*6))*D/2);
   

}

void Digital(){
  fill(#00BFFF);

  textSize(height/10);
  int A=hour(),B=minute(),C=second();

 text(A+":"+B+":"+C,width/2-width*3/16,height*3/10);
fill(255  );
}