Project 06: Abstract Clock

sketchDownload
// Jiyeon Chun
// Section C
// jiyeonch@andrew.cmu.edu 
// Project-06-A

var glowsize = 200; //sec
var waxDrip; //min
var candleHeight = 180; //hour

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

function draw() {
    background(136, 39, 39);

    //get current time
    var H = hour();
    var M = minute();
    var S = second();

//second to glow toggle
    if (S%2 == 0) {
        glowSize = 180;
    } else {
        glowSize = 200;
    }

//hour to candle height
    candleHeight = 180+(H*5);

//minute to wax drip
    waxDrip = candleHeight+30+M;

//glow
    noStroke();
    fill(255, 176, 0,50);
    ellipse(150,candleHeight-40,glowSize);
    
//candle
    noStroke();
    fill(198, 187, 141);
    rect(120,candleHeight,60,220);

//background
    noStroke();
    fill(136, 39, 39);
    rect(0,400,300,220);

//dish
    noStroke();
    fill(151, 127, 33);
    quad(80,390,100,430,200,430,220,390);

//dish handle
    strokeWeight(8);
    stroke(151, 127, 33);
    fill(136, 39, 39);
    ellipse(232,400,40);

//flame
    noStroke();
    fill(255, 176, 0);
    ellipse(150,candleHeight-40,40,50);
    triangle(131,candleHeight-48,150,candleHeight-95,169,candleHeight-48);

//wax
    strokeWeight(8);
    stroke(237, 229, 195);
    line(120,candleHeight,180,candleHeight);
    line(158,candleHeight,158,waxDrip); //longone
    line(170,candleHeight,170,waxDrip-20); //shortone

//bible verse
fill(241, 240, 217);
    noStroke();
    textSize(12);
    textAlign(CENTER);
    text("MATTHEW 25:13",246,470);
}

Leave a Reply