I created an ice cream clock. The scoops run on standard time rather than military time so for every hour, a scoop is added. At 12 pm there is no scoop and it resets. For every second, a new sprinkle falls to the bottom and the chocolate ice cream slowly changes to a raspberry color. With every minute, the ice cream puddle at the bottom of the canvas gets larger ( as if its rising).
sketch
// SRISHT BHAVSAR
// SECTION C 15-104
// PROJECT 6
var diam = 30; // scoop diam
var h; //hours
var m; //min
var s; //second
var c = [];
function setup() {
createCanvas(200, 20);
background(220);
text("p5.js vers 0.9.0 test.", 10, 15);
for (var i=0; i < 60; i++) {
c[i] = color(random(255), random(255), random(255));
}
}
function draw() {
createCanvas(480, 480);
background('lightblue'); // light blue
let h = hour();
let m = minute();
let s = second();
//minutes equals height of puddle
translate(0,0)
stroke(210, 180, 140);
fill('beige');
rect(0,480,480,-(m));
push()
noStroke();
translate(500,510);
rotate(radians(180));
for (var i = 0; i < diam ; i+= diam) {
for (var j = 0; j < (h-12) * diam ; j+= diam) { // instead of military time, it is 12 hr time
if ( j % 4 == 0) {
fill(98 + s,52,18+s); // chocolate// changes color by second
}
if ( j % 4 == 1) {
fill('beige'); // vanilla
}
if ( j % 4 == 2) {
fill('lightpink'); // strawberry
}
circle(250,j+150,diam); // scoop
}
}
pop();
// ice cream cone w month and date
push();
fill(210, 180, 140);
strokeWeight(5);
stroke('beige');
translate(150,320);
scale(.5);
triangle(155,100,203,300,245,100);
pop();
// ice cream sprinkles are seconds
push();
fill(c[i])
scale(0.8);
for(var i =0; i < 4; i+= 4){
for(var j = 0; j < (s*10); j+= 7) {
ellipse(310, j, 3, 5);
}
}
pop();
frameRate(1);
}