# Project 06 – Abstract Clock

For my abstract clock, I chose to create an illustration of chickens in honor of a bunch of chickens I saw sitting in a pine tree the other day. I had a lot of trouble with this project because I’m still not very good at using arrays and loops yet, but I think the end result is pretty cute.

• Random pieces of corn sprinkle per second.
• The eating chicken moves every second and crosses the screen every minute.
• The standing chicken moves every minute and crosses the screen every hour.
• The background gets darker/more purple every hour into the night and lighter/more green every hour into the day.
Maggie – Abstract Clock
``````//Maggie Ma
//Section D

var x=0; //x position of walking chicken
var y=140; //y position of walking chicken
var eaty=40; //y position of eating chicken
var h; //hours
var m; //minutes
var s; //seconds

function setup() {
createCanvas(480, 480);
noStroke();
frameRate(1);
}

function draw() {

h=hour();
m=minute();
s=second();

//background changes color every hour and gets darker at night
if(h<12) {
background(80,20*h,50);
} else {
background(80,255-20*(h-12),50);
}
//corn that don't move
fill(255,221,21);
ellipse(115,376,8);
ellipse(280,421,8);
ellipse(422,359,8);
ellipse(138,362,8);
ellipse(73,301,8);
ellipse(108,433,8);

//chicken standing walks across screen every hour
push();
translate(map(m,0,60,-80,width+50), y);
WalkingChicken();
pop();

//pieces of corn pop up every second
fill(255,221,21);
ellipse(random(3,477),random(250,477),8);
ellipse(random(3,477),random(250,477),8);
ellipse(random(3,477),random(250,477),8);
ellipse(random(3,477),random(250,477),8);
ellipse(random(3,477),random(250,477),8);

//chicken eating walks across screen every minute
push();
translate(map(-s, 0,20,200,width-70), eaty);
EatingChicken();
pop();
}

function EatingChicken(x,y) {
push();
translate(x,y);
//beak
fill(254,183,20);
//feet
stroke(254,183,20);
strokeWeight(4);
line(362,334,352,361);
line(379,327,366,361);
line(331,361,381,361);
//crown
noStroke();
fill(198,56,68);
//back tail wing
fill(50);
//body
fill(245);
circle(250,335,40);
//front wing
fill(50);
//front tail wing
fill(245);
triangle(264,349,264,334,288,341);
//gobbler thing
fill(198,56,68);
ellipse(273,353,15.903,15.903);
triangle(252,354,271,361,271,345);
//eye
fill(0);
circle(244,347,4.771);
pop();
}

function WalkingChicken(x,y) {
push();
translate(x,y);
//crown
fill(198,56,68);
//beak
fill(254,183,20);
//feet
stroke(254,183,20);
strokeWeight(4);
line(0,90,0,134);
line(-12,134,16,134);
line(15,78,44,78);
line(44,78,45,100);
line(45,100,32,109);
line(32,109,25,103);
//back tail
noStroke();
fill(231,231,233);
//body
fill(209,210,212);
rect(2,-88,45,30,10);
//tail
//front wing
fill(231,231,233);