Project 06 – Mike Pence and Fly Clock

I chose to represent time with the fly from the Vice Presidential debate that landed on Mike Pence’s head. The fly moves each second and crosses the canvas once per minute. Its vertical position represents what minute of the hour it is, and the number of time it says “vote” on the top of the canvas is the hour. If the background is darker than the text, it is PM, and vice versa.

mike pence fly
var FlyY = 5

function setup() {
    createCanvas(480, 480);
    background(220);
}
//draw the fly 
function Fly(){
		var x = 0
		push();
		fill(154, 137, 120);
		rotate(radians(-60));
		ellipse(x - 2, FlyY - 12, 7, 18);	//draw top wing
		rotate(radians(120));
		ellipse(x + 5, FlyY + 8, 7, 18);	//draw bottom wing
		pop();
		stroke(154, 137, 120);
		fill(0);
		circle(x, FlyY, 12);	//draw fly body
	}

//draw mike pence
function Mike(){
	noStroke()
	//shirt
	beginShape();
	fill(241, 237, 234);
	curveVertex(218,346);
	curveVertex(187,374);
	curveVertex(171,395);
	curveVertex(179,479);
	curveVertex(278,479);
	curveVertex(295,391);
	curveVertex(261,351);
	endShape(CLOSE);

	//left shoulder
	fill(0);
	beginShape();
	vertex(172,268);
	vertex(127,282);
	vertex(87,298);
	vertex(44,323);
	vertex(0,331);
	vertex(0,479);
	vertex(193,479);
	vertex(172,380);
	vertex(160,300);
	endShape(CLOSE);

	//right shoulder
	beginShape();
	vertex(325,286);
	vertex(334,294);
	vertex(351,312);
	vertex(396,330);
	vertex(448,354);
	vertex(479,368);
	vertex(479,479);
	vertex(258,479);
	vertex(289,402);
	vertex(316,304);
	endShape(CLOSE);

	//left ear
	fill(236, 166, 133);
	beginShape();
	curveVertex(185,145);
	curveVertex(175,127);
	curveVertex(167,133);
	curveVertex(165,149);
	curveVertex(165,177);
	curveVertex(165,201);
	curveVertex(168,214);
	curveVertex(175,217);
	endShape(CLOSE);

	//right ear
	beginShape();
	curveVertex(363,203);
	curveVertex(378,194);
	curveVertex(388,198);
	curveVertex(387,214);
	curveVertex(371,231);
	curveVertex(359,252);
	curveVertex(349,267);
	curveVertex(339,272);
	curveVertex(331,263);
	endShape(CLOSE);

	//neck
	beginShape();
	curveVertex(181,251);
	curveVertex(172,288);
	curveVertex(183,309);
	curveVertex(195,323);
	curveVertex(223,353);
	curveVertex(242,358);
	curveVertex(279,342);
	curveVertex(309,317);
	curveVertex(317,290);
	endShape(CLOSE);

	//right collar
	fill(255)
	beginShape();
	curveVertex(329,279);
	curveVertex(282,335);
	curveVertex(260,347);
	curveVertex(243,355);
	curveVertex(261,376);
	curveVertex(273,407);
	curveVertex(281,427);
	curveVertex(313,362);
	curveVertex(323,315);
	endShape(CLOSE);

	//face
	fill(244, 180, 150)
	beginShape();
	curveVertex(232,81);
	curveVertex(213,114);
	curveVertex(198,145);
	curveVertex(185,166);
	curveVertex(177,199);
	curveVertex(175,237);
	curveVertex(181,279);
	curveVertex(193,307);
	curveVertex(211,328);
	curveVertex(238,340);
	curveVertex(273,335);
	curveVertex(299,321);
	curveVertex(322,291);
	curveVertex(341,257);
	curveVertex(360,214);
	curveVertex(361,187);
	curveVertex(362,143);
	curveVertex(357,101);
	curveVertex(335,116);
	curveVertex(289,103);
	curveVertex(255,87);
	endShape(CLOSE);

	//right hair
	fill(241, 237, 234);
	beginShape();
	curveVertex(363,74);
	curveVertex(380,95);
	curveVertex(387,130);
	curveVertex(375,171);
	curveVertex(357,217);
	curveVertex(356,122);
	curveVertex(356,104);
	endShape(CLOSE);

	//left hair
	fill(255);
	beginShape();
	curveVertex(254,36);
	curveVertex(219,54);
	curveVertex(199,84);
	curveVertex(190,112);
	curveVertex(184,136);
	curveVertex(180,183);
	curveVertex(209,132);
	curveVertex(233,87);
	curveVertex(277,100);
	curveVertex(323,114);
	curveVertex(341,116);
	curveVertex(358,100);
	curveVertex(363,79);
	curveVertex(352,60);
	curveVertex(327,40);
	curveVertex(295,30);
	endShape(CLOSE);

	//collar
	beginShape();
	curveVertex(177,255);
	curveVertex(165,273);
	curveVertex(162,307);
	curveVertex(170,357);
	curveVertex(178,406);
	curveVertex(181,418);
	curveVertex(209,376);
	curveVertex(231,354);
	curveVertex(195,320);
	curveVertex(177,289);
	endShape(CLOSE);	

	//tie bottom
	fill(184, 14, 18);
	beginShape();
	curveVertex(223,394);
	curveVertex(209,430);
	curveVertex(196,478);
	curveVertex(261,479);
	curveVertex(257,433);
	curveVertex(239,392);
	endShape(CLOSE);

	//tie knot
	fill(229, 25, 30);
	beginShape();
	curveVertex(225,354);
	curveVertex(201,379);
	curveVertex(221,398);
	curveVertex(246,402);
	curveVertex(264,380);
	curveVertex(256,360);
	endShape(CLOSE);

}

function draw(){
	if(hour()>11){
		background(117, 129, 151);	//in PM, set background color to darker blue
	}
	else {
		background(158, 168, 186)	//in AM, set background color to lighter blue
	}
	
	push()
	for(var h = 0; h<(hour()%12); h++){	//this will write'vote' the number of the hour up on a 12 hour scale
		push()
		translate(40*h,0) //space out the'vote' evenly so 12 can fit on the top row
		if(hour()>11){
			fill(158, 168, 186)	//in PM, set text color to lighter blue
		}
		else{
			fill(117, 129, 151)	//in AM, set text color to darker blue
		}
		textFont('Georgia')
		textSize(20)
		text('vote', 2, 25)	//vote text
		pop()
    }
	pop()
	Mike();	//draw mike pence
	push();
	translate(map(second(), 0, 60, -15, width + 10), FlyY);	//translate so the fly moves each second and crosses the canvas once a minute
	translate(0, map(minute(), 0, 60, 0, height));	//translate so the y position of the fly corresponds with the minute of the hour, so the top will be the top of the hour and vice versa
	Fly();	//draw the fly
	pop();
	
}



Project – 06 – clock

Its spooky season so I decided to make a jack-o-lantern clock. With this clock the idea is that the stem counts down the seconds, every minute the knife on the table moves right and at 60 minutes the knife is far right off the screen as if someone picked it up. Every hour a line is carved into the pumpkin so it is like someone picked up the knife and made a cut the n the knife goes back to the left side of the table as if it was put back down. Every 12 hours the jack-o-lantern is fully carved! The background represents AM or PM.

pumpkinclockDownload
var knifeX; // changes knife position by min
var stemY; // height of stem
var H; //hour

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

function draw() {
    H = hour();
    knifeX = minute() * 8; // knife moves right every minute
    stemY = -220 + second();
    strokeWeight(1);
    noStroke();
    //set up background so that it changes from am to pm
	if(H < 12){ //am
        background(107, 144, 255);
        fill(237, 214, 100);
        circle(0, 0, 250);
    } else { //pm
        background(28, 37, 74);
        fill(177, 179, 186);
        circle(100, 55, 100);
        fill(28, 37, 74);
        circle(125, 55, 100);
    }
    //clouds
    fill(255);
    //right side cloud
    ellipse(400, 150, 200, 30);
    circle(400, 130, 50);
    circle(350, 125, 75);
    circle(430, 140, 25);
    //left side cloud
    ellipse(100, 250, 200, 30);
    circle(100, 230, 50);
    circle(150, 225, 75);
    circle(70, 240, 25);
	//table
	fill(125, 90, 29);
	rect(0, 350, width, height - 130);
	push();
    translate(240, 240); //changes to center
    stem()
    pumpkin();
    face()
    pop();
    knife();
}

function pumpkin(){
	stroke(214, 129, 58);
	fill(245, 147, 66); //orange
    ellipse(0,0, 300, 250); //pumpkin body
    //pumpkin details
    noFill();
    strokeWeight(5)
    ellipse(0, 0, 100, 250);
    ellipse(0, 0, 200, 250);
}

function stem(){
	//stem 
    noStroke();
    fill(18, 102, 13);
    triangle(-20, -125, 20, -125, 0, -150);
    rect(-15, stemY, 30, 250)
}

function knife(){
    noStroke();
    fill(10);
    rect(knifeX, 410, 6, 50); //knife handle
    fill(100);
    rect(knifeX, 370, 6, 40);
    arc(knifeX, 390, 20, 40, PI/2, (PI/2)*3)
}

function face(){
    H = hour()
    stroke(0);
    strokeWeight(5);
    if (H == 1 || H == 13){ //left eye
        line(-100, 0, -75, -50); // left diag
    } else if (H == 2 || H == 14){
        line(-100, 0, -75, -50);// left diag
        line(-75, -50, -50, 0); //right diag
    } else if (H == 3 || H == 15){
        fill(0);
        triangle(-100, 0, -50, 0, -75, -50); // left eye
    } else if (H == 4 || H == 16){
        fill(0);
        triangle(-100, 0, -50, 0, -75, -50); // left eye
        //right eye
        line(100, 0, 75, -50);// right diag
    } else if (H == 5 || H == 17){
        fill(0);
        triangle(-100, 0, -50, 0, -75, -50); // left eye
        //right eye
        line(100, 0, 75, -50);// right diag
        line(75, -50, 50, 0); //left diag
    } else if (H == 6 || H == 18){
        fill(0);
        triangle(-100, 0, -50, 0, -75, -50); // left eye
        triangle(100, 0, 50, 0, 75, -50); // right eye
    } else if (H == 7 || H == 19){
        fill(0);
        triangle(-100, 0, -50, 0, -75, -50); // left eye
        triangle(100, 0, 50, 0, 75, -50); // right eye
        //start mouth
        line(-120, 30, -75 , 30); // left straight line 
    } else if (H == 8 || H == 20){
        fill(0);
        triangle(-100, 0, -50, 0, -75, -50); // left eye
        triangle(100, 0, 50, 0, 75, -50); // right eye
        //start mouth
        line(-120, 30, -75 , 30); // left straight line 
        //tooth left
        line(-75 , 30, -75 , 50);
        line(-75, 50, -25, 50);
        line(-25, 30, -25, 50);
    } else if (H == 9 || H == 21){
        fill(0);
        triangle(-100, 0, -50, 0, -75, -50); // left eye
        triangle(100, 0, 50, 0, 75, -50); // right eye
        //start mouth
        line(-120, 30, -75 , 30); // left straight line 
        //tooth left
        line(-75 , 30, -75 , 50);
        line(-75, 50, -25, 50);
        line(-25, 30, -25, 50);
        // middle straight line
        line(-25, 30, 25, 30);
    } else if (H == 10 || H == 22){
        fill(0);
        triangle(-100, 0, -50, 0, -75, -50); // left eye
        triangle(100, 0, 50, 0, 75, -50); // right eye
        //start mouth
        line(-120, 30, -75 , 30); // left straight line 
        //tooth left
        line(-75 , 30, -75 , 50);
        line(-75, 50, -25, 50);
        line(-25, 30, -25, 50);
        // middle straight line
        line(-25, 30, 25, 30);
        //tooth right
        line(75 , 30, 75 , 50);
        line(75, 50, 25, 50);
        line(25, 30, 25, 50);
    } else if (H == 11 || H == 23){
        fill(0);
        triangle(-100, 0, -50, 0, -75, -50); // left eye
        triangle(100, 0, 50, 0, 75, -50); // right eye
        //start mouth
        line(-120, 30, -75 , 30); // left straight line 
        //tooth left
        line(-75 , 30, -75 , 50);
        line(-75, 50, -25, 50);
        line(-25, 30, -25, 50);
        // middle straight line
        line(-25, 30, 25, 30);
        //tooth right
        line(75 , 30, 75 , 50);
        line(75, 50, 25, 50);
        line(25, 30, 25, 50);
        // right straight line
        line(120, 30, 75 , 30);
    }else{
        fill(0);
        triangle(-100, 0, -50, 0, -75, -50); // left eye
        triangle(100, 0, 50, 0, 75, -50); // right eye
        //start mouth
        line(-120, 30, -75 , 30); // left straight line 
        //tooth left
        line(-75 , 30, -75 , 50);
        line(-75, 50, -25, 50);
        line(-25, 30, -25, 50);
        // middle straight line
        line(-25, 30, 25, 30);
        //tooth right
        line(75 , 30, 75 , 50);
        line(75, 50, 25, 50);
        line(25, 30, 25, 50);
        // right straight line
        line(120, 30, 75 , 30);
        //whole mouth
        arc(0, 30, 240, 120, 2 * PI, PI);
        fill(245, 147, 66)
        noStroke();
        rect(-75 , 25, 50, 20);
        rect(25, 25, 50, 20);
    }
}

Abstract Clock – Oil Tanks

The idea for this project began as portraying time by building – I was going to use a system in which blocks fall into place to cover the entire screen at the end of the day. Realizing I didn’t know how to do this, I pivoted to something involving filling, so I made 24 tanks and had them increase in “Oil’ per minute and have the “drops” moving every second, so that they would all be filled at the end of the day. Then I wanted to add a psychological component. We experience the speed of time very relatively – the years in the beginning of your life are experienced as “slower” because you are comparing them to a smaller amount of previously lived years than say, an 80 year old. And so I applied this concept – the operation increases every second for each minute, and it also increases for every hour of the day. However, the tanks still fill up according to minutes – a reminder that everyone, no matter age, has the same 24 hours each day. This also serves for another metaphor – we put more work and effort into life (more drops, faster drops), as we are older, but it doesn’t change the amount of time we have. And lastly, I wanted to add an environmental undertone by using oil, a precious resource that is running out.

Oil Tanks
var w = [0,12,24,36,48,60,72,84,96,108,120,132,144,156,168,180,192,204,216,228,240,252,264,276];    //the containers filled with oil
var boxX = 1    //oil pipe fill rate start
var dropY = 1   //drip rate start
var ball = [9.5,21.5,33.5,45.5,57.5,69.5,81.5,93.5,105.5,117.5,129.5,141.5,153.5,165.5,177.5,189.5,201.5,213.5,225.5,237.5,249.5,261.5,273.5]   //reference balls
var d = [];   //amount of drops

function setup() {
    createCanvas(286, 60);    //light blue
    
}

function draw() {
  frameRate(second()+1);    //factory speeds up
  background(68-hour()*2,185-hour()*2,243-hour()*3);   //light blue, darkening with hours
  
    fill(189,189,189);  //light brown
        rect(0,4,500,3)   //oil pipe

for (x=0;x<285;x+=12){
    fill(169,136,80)    //light brown
       rect(x,30,9,30)     //oil tanks
}

 for (var i=0; i < w.length; i++) {
      fill(0)   //black
      if (hour()>i){
          rect(w[i],30,8,30)    //draw full oil tank
    }
    if (hour()==i){
      var oilLevel = height-minute()/2    //oil filling
          rect(w[i],oilLevel,8,oilLevel);   //draw oil tank filling
    }
  }
var faucetPos = hour()*11.875+6   //aligning faucet to be above corresponding tank


if(boxX>faucetPos){   //restart oil and drip when oil hits faucet
   boxX=0    //start of canvas
   dropY=5   //faucet spout level
}

boxX=boxX+faucetPos/60;   //travel rate
  rect(0,5,boxX,1)    //oil travelling in pipe
   

fill(0);    //black
ellipseMode(CORNER);


dropY = dropY+hour()/5;   //drop rate

    for (var i=0; i < 24; i++) {
        circle(faucetPos,dropY-d[i],1.3);     //drop tip
        triangle(faucetPos+.25,dropY-d[i],faucetPos+.6,dropY-d[i]-1,faucetPos+1.05,dropY-d[i]); 
           if(hour()>i){
               d.push(4*i*2);    //add a drop
    }
}


fill(255,0,0);    //red
    rect(0,.5,second()*5,2)   //reference bar at top

fill(150,150,150);    //medium gray
rectMode(CENTER);
    rect(faucetPos,5,10,5);   //faucet bottom
    rect(faucetPos,0,5,5);    //faucet top
rectMode(CORNER);


for (var i=0; i < ball.length; i++) {
  fill(0+second()*4.25,0,0)
      circle(ball[i],height/2+second()/2,2)
}
stroke(0)
 


}






 

Project 6: Abstract Clock

For this week’s project, I garnered inspiration from my current home desk set up, where you can often find my air pods, succulent, and phone playing music.

sketchDownload
// Susie Kim
// susiek@andrew.cmu.edu
// Section A
// Project-06

function setup() {
    createCanvas(480, 380);
    background(244, 212, 212);
}

function draw() {
	// time variables
	var yr = year();
	var h = hour();
	var m = minute();
	var s = second();

	background(244, 212, 212);

	// iphone body
	fill(255);
	noStroke();
	rect(50, 40, 160, 305, 20);
	stroke(0);
	strokeWeight(0.2);
	fill(235);
	rect(57, 75, 147, 230);

	// time of day image
	if (h == 0 || h == 1 || h == 2 || h == 3 || h == 4 || h == 5 || h == 24) {
		// if between the hours of 12am and 5am, show night photo
		noStroke();
		fill(51, 83, 135);
		rect(77, 92, 105, 105);

		// moon
		fill(180);
		ellipse(140, 130, 35, 35);

		fill(130);
		ellipse(150, 132, 7, 7);
		ellipse(130, 130, 5, 5);
		ellipse(143, 121, 6, 6);
		ellipse(137, 139, 3, 3);

		// stars
		fill(255);
		ellipse(100, 110, 2, 10);
		ellipse(100, 110, 10, 2);
		ellipse(115, 150, 2, 8);
		ellipse(115, 150, 8, 2);
		ellipse(90, 160, 2, 12);
		ellipse(90, 160, 12, 2);
		ellipse(160, 100, 1, 7);
		ellipse(160, 100, 7, 1);
		ellipse(170, 155, 1, 7);
		ellipse(170, 155, 7, 1);

		// cloud 1
		ellipse(160, 175, 10, 10);
		ellipse(150, 170, 17, 17);
		ellipse(141, 173, 7, 7);
		ellipse(135, 175, 9, 9);
		rect(130, 171, 35, 10, 5);

		// cloud 2
		ellipse(110, 185, 8, 8);
		ellipse(105, 183, 5, 5);
		ellipse(101, 182, 7, 7);
		ellipse(97, 185, 6, 6);
		rect(93, 183, 20, 7, 4);

	} else if (h == 6 || h == 7 || h == 8 || h == 9 || h == 10 || h == 11) {
		// if between the hours of 6am and 11am, show dawn photo
		noStroke();
	    fill(255, 220, 131);
	    rect(77, 92, 105, 105);

	    // sun
	    fill(247, 167, 107, 100);
	    ellipse(115 , 160, 45, 45);
	    ellipse(115 , 160, 35, 35);
	    fill(247, 167, 107);
	    ellipse(115, 160, 25, 25);

	    // cloud 1
	    fill(255);
	    ellipse(165, 125, 10, 10);
		ellipse(155, 120, 17, 17);
		ellipse(146, 123, 7, 7);
		ellipse(140, 125, 9, 9);
		rect(135, 121, 35, 10, 5);

		// cloud 2
		ellipse(170, 175, 8, 8);
		ellipse(165, 173, 5, 5);
		ellipse(161, 172, 7, 7);
		ellipse(157, 175, 6, 6);
		rect(153, 173, 20, 7, 4);

		// cloud 3
		ellipse(100, 108, 12, 12);
		ellipse(92, 112, 9, 9);
		ellipse(108, 110, 7, 7);
		ellipse(115, 110, 10, 10);
		rect(87, 111, 35, 7, 4);

	} else if (h == 12 || h == 13 || h == 14 || h == 15 || h == 16 || h == 17) {
		// if between the hours of 12pm and 5pm, show day photo
		noStroke();
	    fill(179, 227, 250);
	    rect(77, 92, 105, 105);

	    // sun
	    fill(255, 220, 131, 100);
	    ellipse(130, 120, 45, 45);
	    ellipse(130, 120, 35, 35);
	    fill(255, 220, 131);
	    ellipse(130, 120, 25, 25);

	    // cloud 1
	    fill(255);
	    ellipse(100, 178, 12, 12);
		ellipse(92, 182, 9, 9);
		ellipse(108, 180, 7, 7);
		ellipse(115, 180, 10, 10);
		rect(87, 181, 35, 7, 4);

		// cloud 2
		ellipse(170, 165, 10, 10);
		ellipse(160, 160, 17, 17);
		ellipse(151, 163, 7, 7);
		ellipse(145, 165, 9, 9);
		rect(140, 161, 35, 10, 5);

	} else {
		// if between the hours of 6pm and 11pm, show dusk photo
		noStroke();
	    fill(108, 100, 173);
	    rect(77, 92, 105, 105);

	    // sun
	    fill(221, 216, 114, 100);
	    ellipse(150, 160, 40, 40);
	    ellipse(150, 160, 30, 30);
	    fill(221, 216, 114);
	    ellipse(150, 160, 20, 20);

	    // cloud 1
	    fill(255);
		ellipse(165, 115, 10, 10);
		ellipse(155, 110, 17, 17);
		ellipse(146, 113, 7, 7);
		ellipse(140, 115, 9, 9);
		rect(134, 111, 35, 10, 5);

		// cloud 2
		ellipse(110, 135, 8, 8);
		ellipse(105, 133, 5, 5);
		ellipse(101, 132, 7, 7);
		ellipse(97, 135, 6, 6);
		rect(93, 133, 20, 7, 4);s

		// cloud 3
		ellipse(100, 178, 12, 12);
		ellipse(92, 182, 9, 9);
		ellipse(108, 180, 7, 7);
		ellipse(115, 180, 10, 10);
		rect(87, 181, 35, 7, 4);

		// stars
		ellipse(115, 155, 2, 8);
		ellipse(115, 155, 8, 2);
		ellipse(100, 110, 2, 12);
		ellipse(100, 110, 12, 2);
		ellipse(140, 131, 1, 7);
		ellipse(140, 131, 7, 1);
	} 

	// minute line with marker
	stroke(0);
	strokeWeight(1);
	line(67, 215, 194, 215);
	fill(255);
	var mMapped = map(m, 1, 60, 67, 194);
	strokeWeight(.5);
	ellipse(mMapped, 215, 10, 10); // moving circle

	// seconds line with marker
	strokeWeight(1);
	line(67, 285, 194, 285);
	var sMapped = map(s, 1, 60, 67, 194);
	strokeWeight(.5);
	ellipse(sMapped, 285, 15, 15) // moving circle

	// show name of year on screen
	textSize(10);
	fill(0);
	text(yr + ' ~', 118, 235);

	// buttons and iphone details
	noStroke();
	fill(0);
	rect(125, 250, 3, 13); // pause button
	rect(132, 250, 3, 13);

	triangle(150, 250, 150, 263, 163, 257); // forward buttom
	triangle(156, 250, 156, 263, 168, 257); 

	triangle(104, 250, 104, 263, 92, 257); // backward buttom
	triangle(110, 250, 110, 263, 97, 257); 

	rect(115, 58, 30, 3); // top detail

	ellipse(105, 60, 6, 6); // top cameras
	ellipse(130, 50, 4, 4);

	noFill(); // home button
	stroke(0);
	strokeWeight(.5);
	ellipse(130, 325, 25, 25);

	// succulent pot
	fill(216, 186, 117);
	noStroke();
	circle(360, 285, 125, 125);
	fill(140, 122, 84);
	circle(360, 285, 100, 100);

    // succulent leaf # changes with hour, 12 leaves total
	if (h < 24 & h > 12) {
		h -= 12;
	}

    if (h == 0) {
	    h = 12;
    }
    
    // 8 big exterior leaves change
    for (var i = 0; i < h; i++) {
    	push();
    	translate(360, 285);
    	rotate(radians(45*i));
    	fill(139, 196, 118);
	    ellipse(0, 30, 25, 80);
	    pop();
    }

    // 4 interior leaves change
    for (var i = 8; i < h; i++) {
    	push();
    	translate(360, 285);
    	rotate(radians(90*i));
    	fill(174, 215, 152);
	    ellipse(0, 20, 15, 50);
	    pop();
    }

	// airpods case
	fill(255);
	push();
	rotate(radians(-20));
	rect(230, 160, 100, 107, 20);
	pop();
	strokeWeight(1);
	stroke(175);
	line(280, 100, 375, 65);

    // right airpod
    fill(255);
    noStroke();
	ellipse(435, 60, 30, 30);
	push();
	rotate(radians(30));
	rect(410, -170, 11, 45, 7);
	fill(175);
	ellipse(415, -128, 12, 8);
	fill(0);
	ellipse(404, -165, 10, 4);
	ellipse(396, -165, 3, 4);
	pop();

	// left airpod
	noStroke();
	ellipse(265, 180, 30, 30);
	push();
	rotate(radians(-30));
	rect(125, 285, 11, 45, 7);
	fill(175);
	ellipse(130, 325, 12, 9);
	fill(0);
	ellipse(142, 287, 10, 4);
	ellipse(150, 287, 3, 4);
	pop();
}

	

For the hour, I decided to use the number of leaves of the succulent to indicate the hour between 1 and 12. However, since there were only 12 leaves, and not 24, I gave context clues as to whether it was the am or pm of that hour using the picture on the phone.

Additionally, the phone indicates the year in text, and shows passage of minutes using the the top line and circular marker and passage of seconds using the bottom line and circular marker.

Here are some of the visual variations of my clock:

10am in the morning
12am at night
2pm in the day

Lastly, here are some of my sketches, both from illustrator and my sketchbook!

illustrator sketch showing all 4 time of day options
initial sketch from my sketchbook

Project – 06: Abstract Clock

For my abstract clock, I was inspired by scenes of rainy days. First, I did a rough sketch of the various visual elements that I wanted to comprise the scene. Then, I made notes on the sketch of various elements that I wanted to be reactive to time. I decided that the color of the clouds should be reactive to the hour; as such, the cloud color gets darker with each hour of the day. Additionally, I made the sky change color for a range of hours during the day. The rain is generated depending on how many seconds have elapsed in the minute (e.g. 30 seconds into a minute, 30 lines of rain appear). Lastly, the width of the umbrella increases with each minute and resets at the start of each hour.

sketchDownload

var rainX = [];
var rainY = [];
var buildingStart = [];

function setup() {
    createCanvas(480, 480);
    background(220);
    text("p5.js vers 0.9.0 test.", 10, 15);
    for (i = 0; i < 10; i++){
    	buildingStart[i] = random(height/7,height/2);
    }
}

function draw() {
	noStroke();
	if (hour() < 6){
		background(117,128,181);
	} else if(hour() >= 6 & hour() < 19){
		background(68,117,181);
	} else if (hour() == 19 ){
		//sunset colors
		background(160,24,85); 
		noStroke();
		fill(237,100,21,150);
		rect(0,0,width,3*height/4);
	} else {
		background(8,6,48);
	}
	cityscape();
	//ground
	fill(76,75,62);
	rect(0,360,width,height);
	fill(0,100);
	rect(0,360,width,110);
	baby();
	rock();
	rain();
	cloud();
	push();
	translate(130,330);
	rotate(radians(-30));
	umbrella();
	pop();
}

function cloud() {
	fill(255 - (10*(hour())));
	var circleX = 0;
	var circleY = 0;
	noStroke();
	//cloud gets darker with each hour
	ellipse(width/2,0,width,height/8);
	//for loop was slowing down browser so I wrote out each circle
	circle(circleX,circleY,height/3);
	circle(circleX + 48,circleY - 10,height/3);
	circle(circleX + 48*2,circleY,height/3);
	circle(circleX + 48*3,circleY,height/3);
	circle(circleX + 48*4,circleY,height/3);
	circle(circleX + 48*5,circleY + 10,height/3);
	circle(circleX + 48*6,circleY + 20,height/3);
	circle(circleX + 48*7,circleY + 10,height/3);
	circle(circleX + 48*8,circleY,height/3);
	circle(circleX + 48*9,circleY,height/3);
	circle(circleX + 480,circleY - 15,height/3);
	
	
}

function rain() {
	for(i = 0; i <= second(); i++){ 
		rainX[i] = random(0,480);
		rainY[i] = 0;
		stroke(175,199,216);
		line(rainX[i],rainY[i],rainX[i],height - 10);
	}

}

function baby() {
	//shadow
	fill(0,200);
	ellipse(90,430,220,50);
	//swaddling 
	fill(221,173,218);
	rect(80,400, 60, 40);
	circle(80,420,40);
	circle(140,420,40);
	//face
	fill(173,156,133);
	circle(130,420,38);
	//eyes
	if (hour() >= 20){
		stroke(0);
		strokeWeight(1.5);
		line(130,405,130,415);
		line(130,425,130,435);
	} else {
		fill(0);
		circle(130,410,5);
		circle(130,430,5);

	}

}

function umbrella() {
	//top of umbrella
	fill(102,24,33);
	arc(0,0,150 + minute(),90,PI,0,CHORD); //umbrella width increases with each minute
	fill(25,16,10);
	rect(0,0,3,100);
	//handle
	beginShape();
		vertex(0,100);
		curveVertex(0,110);
		curveVertex(-5,115);
		vertex(-10,105);
		vertex(-10,108);
		curveVertex(-5,118);
		curveVertex(3,110);
		vertex(3,100);
	endShape(CLOSE);
	//top
	triangle(-1,-40,0,-60,1,-40);

}

function rock() {
	fill(31,31,35);
	quad(0,430,10,400,45,380,60,430);
	fill(255,30);
	triangle(10,400,45,380,30,420);


}

function cityscape() {
	for(i = 0; i < 10; i++){
		fill(0,100);
		rect(48*i,buildingStart[i], 48, height);
	}
}
Process Sketch

Project-06: Abstract Clock

sketchDownload
 /*
Nicholas Wong
Section A
*/


var d; //Days
var h; //Hours
var m; //Minutes
var s; //Seconds

var angle; //Angle for sin-wave frequency for pulse

function setup()
{
    createCanvas(480,480);
    angleMode(DEGREES); //Degrees instead of radians (makes mapping easier)
}
 
function draw() 
{
	translate (width/2,height/2) //Make origin at center
	rotate(-90) //Rotate -90 so starting points for most circle counters face up

	background(0); //Black background

	//Day circle (Outer circle)
	dayCircle();

	//Detail circles
	push();
	fill(0)
	strokeWeight(1)
	stroke(250,0,0);
	circle(0,0,200);
	pop();

	//Dark red circles
	push();
	noFill();
	stroke(1)
	stroke(50,0,0)
	circle(0,0)
	circle(0,0,65)
	circle(0,0,80);
	circle(0,0,100);
	circle(0,0,150);
	pop();


	//Hour circle (Second outer ring)
	hourCircle();

	//Minute circle (Tertiary rings)
	minuteCircle();

	//Second circle (Dotted inner ring)
	secondCircle();

	//Center-most pusling circle
	secondPulse();
    angle += (360/60) / 2; //1 period is 360/framerate, half makes 1 pulse/s

    
}

//Circle of 31 arcs
function dayCircle()
{
	var d = day();

	//Loop runs 31 times, the maximum number of days for any month
	for (let i=1; i<=31; i++)
	{

		push();
		noStroke();
		fill(50,0,0)
		arc(0,0,250,250,(i-1)*360/31,(i-1)*360/31 + 10.5); //Make 31 arcs

		//If the day is today, make the arc red
		if(i == d)
		{
			fill(250,0,0)
		}
		else //If not today, make arc dark red
		{
			fill(70,0,0)
		}

		//First day of month is slightly brighter red arc
		if(i==1)
		{
			fill(90,0,0)
		}

		arc(0,0,235,235,(i-1)*360/31,(i-1)*360/31 + 10.5); //Outer arc for aesthetics
		pop();

		//Additional circles for aesthetics
		noFill();
		stroke(255,0,0);
		circle(0,0,250);
		circle(0,0,200);
	}
}

//Circle with 24 segments
function hourCircle()
{
	var h = hour();

	//Loop is run for the amount of hours passed today
	for (let i=0; i<=h; i++)
	{

		push();
		noFill();
		
		stroke(200,0,0);
		strokeWeight(3)

		arc(0,0,150,150,i*15,i*15 + 6); //Add arcs for every hour that has passed today

		strokeWeight(0.35)

		push(0);
		rotate(-90)
		line(75*sin((-i*15)),75*cos((-i*15)),100*sin((-i*15)),100*cos((-i*15))) //Line drawn from arcs for aesthetics
		pop();

		stroke(255)
		strokeWeight(1)
		arc(0,0,140,140,i*15,i*15 + 6); //Secondary arc for aesthetics
		pop();
	}
}

//Circle of variable arc lengths that show minutes in an hour
function minuteCircle()
{
	var m = minute();

	let m_circle = map(m,0,60,0,360); //Map minutes in an hour to angles on a circle
    push();
    noFill();

    strokeWeight(2);
    stroke(200,0,0);

    //Creates an arc with arc length representing how many minutes has passed in this hour
   	arc(0,0,100,100,0,m_circle);

   	strokeWeight(2);
   	stroke(250,100,100);
   	arc(0,0,80,80,0,m_circle); //Aeshtetic secondary arc

   	pop();
}

//Circle of 60 segments that show seconds in a minute
function secondCircle()
{
	var s = second();

	//Loop runs for the amount of seconds passed in this minute
	for (i=0; i<=s; i++)
	{
		push();
		noFill();
		stroke(255,150,150);
		strokeWeight(1)
		arc(0,0,65,65,i*6,i*6 + 1); //Creates an arc for every second that has passed in this minute
		pop();
	}
}

//Circles in center that pulse every second
function secondPulse()
{

   	if (frameCount/60 == 1) //If the frame count is divisible by 60 (is a second)
   	{
   		angle = 180; //Angle is set to 180
   	}

    let s_diam = sin(angle) * 40; //Pulse maximum diameter

    push();

    noFill();
    strokeWeight(1)
    stroke(250,150,150)

    circle(0,0,s_diam); //Draw circle with variable diameter

    stroke(250,250,250)

    circle(0,0,s_diam * 0.75); //Second circle for aesthetics

    pop();
}
TECH-A Rainmeter Theme
Mk2 tony diy arc reactor lamp stainless steel kit illuminant led flash  light set Sale - Banggood.com

Inspired by tech stuff. Mostly Iron Man, I just re-watched Endgame.

Project-06: Abstract Clock

This project posed a large challenge in how I was going to sync up each lightning strike on the minute, but it turned out to be a really simple solution once I sat down to get it. On each minute, lightning strikes as a line and strokeWeight decreases over the minute, causing it to fade like a real strike. Every hour, another cloud is added until it resets at 00:00.

cloud

var cloudx = [] //where to draw each cloud
var cloudy = []
var strikeTime; //the timing of the lightning strike







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

function draw() {
    numClouds = hour() //adds a cloud for every hour
    strikeTime = ((60 - second()) / 10) //lightning strikes on the minute and fades
    background(48, 4, 181)
        for (m = 0; m <= numClouds; m ++) { //randomly determines cloud coordinates and sends to array
        		cloudx.push(random(40, 440))
        		cloudy.push(random(40, 440))
}
        for (i = 0; i < numClouds; i++) { //draws cloud and lightning
        	cloud(cloudx[i], cloudy[i], 15)
        	strike(cloudx[i], cloudy[i])
        	         }
}

function cloud(cloudx, cloudy, cloudsize){ //instructions for each cloud
	push()
	translate(cloudx, cloudy)
	fill(40, 40, 40, 188)
	ellipse(-10, 0, cloudsize)
	ellipse(0, -10, cloudsize)
	ellipse(0, 0, cloudsize)
	ellipse(10, 0, cloudsize)
	pop()
}



function strike(cloudx, cloudy){ //instructions for lightning
    push()
	translate(cloudx, cloudy)
	strokeWeight(strikeTime)
	stroke(255, 255, 0)
	line(0, 0, 10, 10)
	line(10, 10, -20, 20)
	line(-20, 20, 15, 30)
	pop()
}

PROJECT-06 (clock)

move your mouse around to stabilize the clock!

sketch
// SEAN CHEN
// 15-104 A

function setup() {
    createCanvas(600, 600);
    background(255);
}

function randomizer() { // giving the design "chaos"
    var diff = dist(width/2, height/2, mouseX, mouseY);
    if (diff > 25) {
        // more random shifting based on dist from center to mouse
        var chaos = random(-1, 1) * (diff-25)/25;
    } else {
        var chaos = random(-1, 1) * 0.175; // mini shifts for "texture"
    }
    return chaos;
}

function border() { // border ring including seconds hand
    textAlign(CENTER, BOTTOM);
    for (var i = 0; i < 60; i++) {
        push();
        textSize(9);
        if (second() == i) { // if second matches rotation, display sec location
            rotate(radians(6*i+randomizer()));
            textStyle(ITALIC);
            textStyle(BOLD);
            textAlign(LEFT, CENTER);
            rotate(radians(-90)); 
            text(' second ' + second(), 250+randomizer(), 0);
        } else { // say border otherwise
            rotate(radians(6*i+randomizer()));
            text('border', 0, -250+randomizer());
        }
        pop();
    }

}

function face() { // clock face
    push();
    textAlign(CENTER, BOTTOM);
    var diff = dist(width/2, height/2, mouseX, mouseY);
    fill(color(constrain(200-diff, 0, 200)));
    for (var thick = 0; thick < 25; thick++){
        for (var i = 0; i < 60; i++) {
            push();
            rotate(radians(6*i));
            textSize(9);
            text('face', 0, -10*(thick+randomizer()));
            pop();
        }
    }
    pop();
}

function minHand() { // minute hand
    push();
    rotate(radians(6*minute()+randomizer()));
    textSize(9);
    textStyle(ITALIC);
    textStyle(BOLD);
    textAlign(LEFT, CENTER);
    for (var num = 0; num < 7; num++) { // length of hand
        push();
        rotate(radians(-90+randomizer()));
        if (num < 6) {
            text('minute', 30*num+20, 0);
        } else {
            text('minute '+ minute(), 30*num+20, 0);
        }
        pop();
    }
    pop();
}

function hrHand() { // hour hand
    var hr;
    if (hour() > 12) { // convert 24 hr to 12 hr
        hr = hour()-12;
    } else {
        hr = hour();
    }
    push();
    rotate(radians(30*hr+randomizer()));
    textSize(9);
    textStyle(ITALIC);
    textStyle(BOLD);
    textAlign(LEFT, CENTER);
    for (var num = 0; num < 7; num++) { // length of hand
        push();
        rotate(radians(-90+randomizer()));
        if (num < 6) {
            text('hour', 20*num+20, 0);
        } else {
            text('hour '+hr, 20*num+20, 0);
        }
        pop();
    }
    pop();
}

function logo() { // how to operate clock
    push();
    strokeWeight(2);
    var diff = dist(width/2, height/2, mouseX, mouseY);
    ellipse(mouseX, mouseY, 5*diff/10, 2.5*diff/10);
    textStyle(ITALIC);
    textAlign(CENTER, CENTER);
    textSize(8*diff/100);
    text('clock', mouseX, mouseY);
    textSize(3*diff/100);
    textAlign(CENTER, CENTER);
    text('\n(move to stablize)', mouseX, mouseY+7);
    pop();
}

function draw() {
    background(255);
    push();
    translate(width/2+randomizer(), height/2+randomizer()); 
    border();
    face();
    minHand();
    hrHand();
    pop();
    logo();
}

Project-06-Abstract-Clock

The Flower Clock

My idea is to represent time through the growth of an Equinox Flower. This kind of flower is associated with final goodbyes, and legend has it that these flowers grow wherever people part ways for good. In old Buddhist writings, the Equinox Flower is said to guide the dead through samsara, the cycle of rebirth.

The size of the pedals is associated with the unit of time they represent. For example, the inner circle of pedals change their size according to seconds went by.

sketch

var x;
var y;
//r represent how far each pedal is from the center
var r=80;
var l=r/2*3;
var angle=0;
var size;
function setup() {
    createCanvas(400, 600);
    angleMode(DEGREES);

    
}

function draw() {
	background(0,19,30);
    var s=second();
    var m=minute();
    var h=hour();
    
    //draw the stem first;
    stem();
    //move the center of the flower to the center;
	translate(width/2,height/2-50);
	push();
		

	//the size of this set of Equinox pedal represents the hour
		if(!h%24==0){
			r=120;
			size=map(hour(),0,60,2,3.5);
			for(var i=0;i<=5;i++){
			  angle+=60;
			  Equinox(r*cos(angle),r*sin(angle),l,size,132);
		    }
		}
		
    //the size of this set of Equinox pedal represents the second
		if(!s%60==0){
			r=60;
			size=map(second(),1,60,0.2,1.5);
			for(var i=0;i<=5;i++){
			  angle+=60;
			  Equinox(r*cos(angle),r*sin(angle),l,size,236);
			
		    }
		}
	//the size of this set of Equinox pedal represents the mintue
		if(!m%60==0){
			r=80;
			size=map(minute(),0,60,1.5,2.0);
			for(var i=0;i<=5;i++){
			angle+=60;
			Equinox(r*cos(angle),r*sin(angle),l,size,181);
		}
		
		pop();
	}


 }
    
function stem(){
	
    push();
    fill(88,122,72,60);
    translate(width/2,250);
    noStroke();
    //this for loop draws the growing calyx at the center
    for (var r = 0; r < 10; r++) {
        if (frameCount <= 180) {
         ellipse(0, 6 + frameCount / 20, 6 + frameCount / 40, 12 + frameCount / 20);
        }
        if (frameCount > 180) {
        frameCount=0;
        }
         rotate(360 / 5);
    }
    pop();
    //main stem
	stroke(88,122,72,120);
	strokeWeight(5);
	line(width/2-20,600,width/2,250);
		
		
	
}
//x and y represent the location; l is the distance to the center; s is the size; c is the color
function Equinox(x,y,l,s,c){
	var w=105;
	var h=50;
	var start=135;
	var end=225;
	push();
//locate each unit's position
	translate(x,y);
	scale(size);
//c is the shade of red each layer has
	stroke(c,50,50);
	strokeWeight(0.5);
	noFill();
//move each unit further from the center
	translate(-l,-105/2);
	rotate(-90);
	for(var i=0;i<7;i++){
      arc(0,l, w,h,start,end);
      w=w*Math.pow( 1.001, 10 );
      h+=8;
      start-=5;
      end+=5;

	}

	
	pop();

	}
	


Equinox Flower
Sketch of ideas for flower clock

Project 06 – Abstract Clock

I took inspiration from cuckoo clocks to make an abstract clock based on a face. The clock gets increasingly fatigued as its tongue inches out with every minute– its cheeks flush and the background also becomes redder with every hour. Saliva drip documents seconds.

sketch
Concept sketch
Illustrator sketch


function setup() {
  createCanvas(480, 480);
  // time
    var minShift= 2 * minute();
}

function draw(){
  
  //background
  var top = color(200, 219, 162); // pale green
  var bottom = color(124 +3*hour(), 124-hour(), 232- 3*hour()); // purple, turns redder with hours
  setGradient(top, bottom); // background gradient
    //offwhite wall
    noStroke();
    fill(240, 244, 237); //offwhite
    rect(368, 0, 124, height);
  clock();
  
}

function setGradient(color1, color2) { //background gradient
    for(var a = 0; a <= height; a++) {
      var amount = map(a, 0, height, 0, 1);
      var back = lerpColor(color1, color2, amount);
      stroke(back);
      line(0, a, width, a);
    }
}

function clock(){
  //base face
  fill(67, 40, 144);
  rect(0, 58, 265, 330, 0, 110, 0, 0);
  //face side panel
  fill(234, 249, 48); //neon yellow
  rect(-161, 58, 265, 330, 0, 110, 0, 0);
  //pendulum
  fill(208, 216, 91); //darker yellow
  rect(120, 388, 5, 92);
  rect(145, 388, 5, 92);
  //mouth opening
  rect (181, 300, 75, 50, 24, 0, 0, 0);
  //teeth
  fill(240, 244, 237);
  rect (228, 300, 13, 10);
  rect (243, 300, 13, 10);
  //eyes
  eyes();
  //blush
  blush();
  //nose
  fill(170, 192, 255); //lavender
  rect(177, 163, 24, 120);
  triangle(201, 164, 201, 284, 256, 284);
  fill (234, 249, 48); //neon yellow
  triangle(177, 164, 177, 284, 232, 284);
  //lines
  stroke(234, 249, 48);
  strokeWeight(0.75);
  line (83, 163, 248, 163);
  line (177, 141, 177, 379);
  //tongue
  tongue();
  
}

function eyes(){
  //whites
  push();
  fill(240, 244, 237);
  stroke(255, 73, 165);
  strokeWeight(3);
  strokeCap (SQUARE);
  arc(134, 228, 80, 80, PI, TWO_PI, OPEN);
  arc(230, 215, 61, 61, PI, TWO_PI, OPEN);
  //pupils
  fill(255, 73, 165); //pink
  ellipse(153, 213, 22);
  ellipse( 240, 203, 19);
  pop();
}

function blush(){
  fill(255, 73, 165 - 2*hour()); //pink becomes more red with hours
  ellipse(247, 247, 48+ hour());// blush increases with hours
  ellipse(111, 277, 74 + hour());
}

function tongue(){
  fill(255, 73, 165); //pink
  noStroke();
  var minShift= 2*minute();
  rect (181, 334, 154 + minShift, 16, 0, 15, 0, 0); //tongue length increases with minutes
  bird();
  
  // saliva drips by seconds and follows tongue
  fill(170, 192, 255); //lavender
  ellipse(307+ minShift, 376+ second(), 18); 
  triangle(300 + minShift, 370+ second(), 314+ minShift, 370+ second(), 307 + minShift, 360+ second());
  fill(170, 206, 255); //lighter lavender
  ellipse(287+ minShift, 364+ 2*second(), 26); 
  triangle(277 + minShift, 356+ 2*second(), 297+ minShift, 356+ 2*second(), 287 + minShift, 340+ 2*second());
}

function bird(){
  var minShift = 2* minute();
  //feet
  fill(208, 216, 91); //darker yellow
  rect(296 + minShift, 331, 15, 4, 0, 3, 0, 0);
  //legs
  stroke(208, 216, 91); //darker yellow
  strokeWeight(2);
  line(297 + minShift, 306, 297 + minShift, 334);
  line(301 + minShift, 306, 301 + minShift, 334);
  
  //body
  fill(255, 73, 165); //pink
  noStroke();
  ellipse(297 + minShift, 293, 42);
  triangle(280 + minShift, 280, 267+ minShift, 314, 297+ minShift, 314);
  push();
  fill(170, 192, 255); //lavender
  arc(298 + minShift, 293, 42, 42, -QUARTER_PI, HALF_PI, OPEN); //belly
  pop()
  //wing
  fill(240, 244, 237);
  arc(275 +minShift, 295, 43, 43, -QUARTER_PI, HALF_PI, OPEN);
  //head
    //beak
    fill(208, 216, 91); //darker yellow
    triangle (320 + minShift, 260, 320 + minShift, 271, 339 + minShift, 266);
    //head
    fill(255, 73, 165);
    ellipse(313 + minShift, 266, 23);
    //eye
    fill(234, 249, 48); //neon yellow
    ellipse(316 + minShift, 265, 6);

}