karinac-Project-06

karinac-Project-06

//Karina Chiu
//Section C
//karinac@andrew.cmu.edu
//Project-06


function setup() {
    createCanvas(480, 480);
}

function draw() {
    background(0);
    angleMode(DEGREES);

    //Second Hand Rotation
    stroke(255);
    strokeWeight(1);
    noFill();
    ellipseMode(CENTER);
    ellipse(240,240,70,70);

    push();
    translate(width/2, height/2);
    rotate((second()*6)-90);
    noStroke();
    fill(156,144,94);
    ellipse(35,0,20,20);
    pop();

    //Minute Hand Rotation
    stroke(255);
    strokeWeight(1);
    noFill();
    ellipseMode(CENTER);
    ellipse(240,240,200,200);

    push();
    translate(width/2, height/2);
    rotate((minute()*6)-90);
    noStroke();
    fill(156,144,94);
    ellipse(100,0,35,35);
    pop();

    //Hour Hand Rotation
    stroke(255);
    strokeWeight(1);
    noFill();
    ellipseMode(CENTER);
    ellipse(240,240,350,350);

    push();
    translate(width/2, height/2);
    rotate((hour()*30)-90);
    noStroke();
    fill(156,144,94);
    ellipse(175,0,50,50);
    pop();

    //printed time
    noStroke();
    fill(255);
    textAlign(CENTER);
    text(hour(), 20, 20);
    text(minute(), 40, 20);
    text(second(), 60, 20);
}

I wasn’t exactly sure how I wanted to create this clock at first, so the end design really came up by trial and error.

I had a lot of difficulty with the movement of the ellipses. It took me a while to figure out how I could start at the top of the pathway and move counterclockwise. Overall, I am very excited to see how my clock turned out. I absolutely love the classy design and I believe it is something that I would actually use.

Leave a Reply