sketchDownload
/*
* Amy Lee
* amyl2
* Section B
*/
var x = [];
var y = [];
function setup() {
createCanvas(400, 400);
// For the random placement of the stars
for (i = 0; i < 60; i++){
x[i] = random(10,390);
y[i] = random(10,200);
}
}
function draw() {
noStroke();
var h = hour();
var m = minute();
var s = second();
// Background color gets darker as seconds pass by
background (83 - (2*s), 143 - (2*s), 213 - (2*s));
// Drawing static hills
fill(122,172,136);
ellipse(80,435,300,440);
fill(122,172,136);
ellipse(width-80,435,300,440);
fill(161,206,148);
ellipse(200,440,500,400);
// New star appearing every minute
for(i = 0; i < m; i ++){
fill(252,255,149);
ellipse(x[i],y[i],7,7);
}
// Moon increasing size every second
var s1 = map(s, 0, 60, 0,200);
// Drawing Moon
stroke(242, 242, 242,40);
strokeWeight(10);
fill(220,220,220,50);
ellipse(50, 50, s1, s1);
// Drawing Sheep
noStroke();
// Legs
fill(92);
ellipse(175,315,15,50);
ellipse(225,315,15,50);
// Body
fill(255);
ellipse(200,310,50,50);
ellipse(170,280,50,50);
ellipse(200,270,50,50);
ellipse(230,280,50,50);
ellipse(170,300,50,50);
ellipse(230,300,50,50);
// Fur texture
fill(152);
ellipse(220,290,15,15);
fill(255);
ellipse(222,290,15,15);
fill(152);
ellipse(190,305,15,15);
fill(255);
ellipse(188,305,15,15);
fill(152);
ellipse(193,315,8,8);
fill(255);
ellipse(191,315,8,8);
fill(152);
ellipse(170,282,15,15);
fill(255);
ellipse(172,282,15,15);
// Face
fill(92);
ellipse(240,270,40,40);
// Making the eye close or open every hour
var eyeDiam = 20;
if ((h%2)>0){
eyeDiam = 20; //closed
}else if((h%2)==0){
eyeDiam = 0.1; //opened
}
// Ear
ellipse(220,275,20,10);
// Eye
fill(0);
ellipse(240,270,15,15);
fill(92);
ellipse(235,265,eyeDiam,eyeDiam);
// Tail
fill(255);
ellipse(140,290,20,10);
// Fence
fill(175,140,117);
rect(0,350,15,height);
rect(385,350,15,height);
rect(0,360,width,10);
rect(0,380,width,10);
}
For this project, I thought of how I used to try counting sheep to fall asleep when I was younger. Unfortunately, it usually didn’t work too well. As a result, I was inspired to create an abstract clock that depicts a sheep trying to sleep but waking up every hour. The moon expands and the night sky gets darker every second. A new star also appears every minute.