we always think too much about how time passes by too quickly. don’t be obsessed with aging, and just think about the good that comes with your birthday!
the background indicates to minute (to some extent). at the start of the hour, the background will be pink. it will become increasingly bluer the greater the minute is.
the number of strawberries on the cake indicate the hour of the day in a 12-hour cycle. to distinguish am and pm, the fruit will turn into blueberries in the am and strawberries in the pm.
the number of candles indicates the month and the number of gifts indicates the day.
sketch
let redValue, blueValue, greenValue;
let strawberryFill;
let giftCounter;
let giftDraw;
function setup() {
createCanvas(480, 480);
let h = hour();
let m = minute();
let d = day();
let mon = month();
redValue = 248;
blueValue = 226;
greenValue = 226;
giftCounter = 0;
}
function draw() {
let redMinute = 1.25;
let blueMinute = 0.633;
let greenMinute = 0.1167;
background(redValue - (redMinute*minute()), blueValue - (blueMinute*minute()), greenValue - (greenMinute*minute()));
let cakeColor = color(255, 214, 148);
let icingColor = color(246, 158, 178);
let tableColor = color(112, 77, 36);
let candleColor = color(247, 200, 238);
let outerFire = color(245, 154, 142);
let innerFire = color(255, 202, 150);
let giftColor = color(171, 156, 217);
let ribbonColor = color(248, 239, 233);
table(150, height - 105, 275, 190, tableColor); cakeBase(150, height - 160, 150, 75, cakeColor);
cakeBase(150, height - 230, 100, 50, cakeColor);
for (i = 1; i <= month()%12; i++) {
if (i <= 6) {
candle(i*15 + 96, 205, 8, 32, candleColor);
} else {
candle(i*20 - 45, 255, 10, 40, candleColor); }
}
giftDraw = true;
giftCounter = 0;
for (i = 0; i < 7; i++) {
for (j = 0; j < 5; j++) {
if (giftCounter >= day()) {
giftDraw = false;
} gift(280 + 30*i, 470 - 30*j, 25, 25, giftColor, ribbonColor, giftDraw);
giftCounter += 1;
}
}
print (giftCounter);
if (hour() <= 12) {
strawberryFill = color(73, 104, 152);
} if (hour() > 12) {
strawberryFill = color(231, 84, 128);
}
for (i = 1; i <= hour()%12; i ++) {
if (i <= 6) {
strawberry(i*16 + 92, 220, 15, 25, strawberryFill);
} else {
strawberry(i*22 - 60, 270, 15, 25, strawberryFill); }
}
textSize(20);
textAlign(CENTER);
text('life is too short to worry about time. eat some cake!', 220, 180, 300, 200);
}
function cakeBase(x, y, w, h, color) { var r = (w / 6);
noStroke();
fill(color);
rectMode(CENTER);
rect(x, y, w, h);
arc(x - w/2 + r/2, y - h/2, r, r, radians(180), radians(270));
arc(x + w/2 - r/2, y - h/2, r, r, radians(270), radians(360));
line(x - w/2 + r/2, y - 2*r, x + w/2 - r/2, y - 2*r);
rect(x, y - 7*r/4, w - r, r/2);
}
function table(x, y, w, h, color) { fill(color);
rectMode(CENTER);
noStroke();
rect(x - 3*w/10, y + 3*h/10, w/12, h/2); rect(x + 3*w/10, y + 3*h/10, w/12, h/2);
rect(x, y, (3*w)/4, (h/6)); rect(x, y - h/12, w, h/12);}
function gift(x, y, w, h, boxColor, ribbonColor, draw) {
if (!draw) {
return false;
}
rectMode(CENTER);
noStroke();
fill(boxColor)
rect(x, y, 4*w/5, 4*h/5); rect(x, y - 2*h/5, w, h/10);
stroke(ribbonColor);
strokeWeight(w/10);
noFill();
circle(x - w/8, y - h/2, w/4);
circle(x + w/8, y - h/2, w/4);
fill(ribbonColor);
noStroke();
rectMode(CENTER);
rect(x, y, w/5, 8*h/10);
}
function candle(x, y, w, h, color) { rectMode(CENTER);
fill(color);
strokeWeight(1);
stroke(150);
rect(x, y, w, 4*h/5);
fill(255, 0, 0, 150); noStroke();
ellipse(x, y - 3*h/5, 4*w/5, 3*h/10);
fill(255, 165, 0, 150);
ellipse(x, y - 11*h/20, 3*w/5, h/5);
}
function strawberry(x, y, w, h, color) { fill(color);
noStroke();
arc(x, y, w, h, radians(180), radians(0));
arc(x, y, w, h/10, radians(0), radians(180));
}
function icing(x, y, w, h, color) {
push();
translate(x, y);
fill(color);
stroke(color);
x += cos(radians(x));
y += sin(radians(y));
point(x, y);
pop();
}