Jess Medenbach – Abstract Clock

abstractclock Experimenting with the colors and ellipses with the time functions.

function setup() {
  createCanvas(300, 300);
  background(240);
  
 
}
var sAngle = 6; 
var mAngle = 6;
var hAngle = 30;


function draw() {
    var s =  second();
    var m = minute();
    var h = hour();
    var centerx = width / 2;
    var centery = height / 2;
    var radius = 125;
    background(255);

    //circle
    fill(0,0,200);
    strokeWeight(10);
    ellipse(width/2,height/2,250,250);
    

    // minute hand
    fill(255,200,0);
    var y = cos(radians(mAngle*m*-1)) * radius;
    var x = sin(radians(mAngle*m)) * radius;
    stroke(5);
    ellipse(centerx, centery, centerx + x, centery - y);

    //second hand 
    fill(255);
    var y = cos(radians(sAngle*s*-1)) * radius;
    var x = sin(radians(sAngle*s)) * radius;
    strokeWeight(1);
    ellipse(centerx, centery, centerx + x, centery - y);

    // hour hand
    fill(200,0,0);
    var y = cos(radians(hAngle*h*-1)) * radius;
    var x = sin(radians(hAngle*h)) * radius;
    strokeWeight(5);
    ellipse(centerx, centery, centerx + x, centery - y);



   }

Leave a Reply