Project06_Jiyoung Ahn_Abstract clock

sketch

//Jiyoung Ahn
//Section A
//jiyounga@andrew.cmu.edu
//Assignment -06-project


var cX = 0; //center x
var cY = 0; // center y
var dif = 100; //width difference


function setup() {
    createCanvas(500, 300);
}

function draw() {
  background(250);

  var Hr = hour ();
  var Min = minute ();
  var Sec = second ();  
  noStroke ();  
  translate (250, 300);
  

  //second-red
  fill ('#f92b09');
  arc (cX, cY, width, width, PI, PI + (Sec%60)/60*PI);
  
  //second-orange
  fill ('#f9823e');
  arc (cX, cY, width-dif, width-dif, PI, PI + (Sec%60)/60 *PI);

  //minute - yellow
  fill ('#ede995');
  arc (cX, cY, width-2*dif, width-2*dif, PI, PI+(Min%60)/60 *PI);

  //minute - green
  fill ('#70cb95');
  arc (cX, cY, width-3*dif, width-3*dif, PI, PI+(Min%60)/60 *PI);

  //hour - blue
  fill ('#70afd7');
  arc(cX, cY, width-4*dif, width-4*dif, PI, PI + (Min%60)/60 *PI);

  //hour - navy
  fill ('#3d64d2');
  arc(cX, cY, width-5*dif, width-5*dif, PI, PI + (Hr%12)/12 *PI);
  
  //hour - purple
  fill ('#7f7ed0');
  arc(cX, cY, width-6*dif, width-6*dif, PI, PI + (Hr%12)/12 *PI); 

}

I tried to create a clock with a shape of a rainbow. I divided 7 colors of rainbow by sec, min, hr. Though I took a simple concept of clock, it was quite a challenge for me to present different sizes of half ellipse.

Leave a Reply