Skip to content

Commit df4b8f5

Browse files
feat: added nubs to each candle base
1 parent eade5ab commit df4b8f5

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

project1/sketch.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,16 +59,18 @@ function drawClockState(hr, min, sec) {
5959
}
6060

6161
// Draw 12 evenly spaced wicks right-to-left
62-
for (let w = 0; w < numActive; w++) {
62+
for (let w = 0; w < 12; w++) {
6363
// Calculate the offset from the left. We account for the total space
6464
// each candle takes, adding an offset to place it roughly in the center
6565
let offsetPercent = 100 * ( (12-w) / 12);
6666

6767
if (state.recharge == 0) {
6868
if (w == numActive-1) { // last wick, getting 'consumed'
6969
drawWick(min, sec, offsetPercent, 1);
70-
} else {
70+
} else if (w < numActive) {
7171
drawWick(0, 0, offsetPercent, 0);
72+
} else {
73+
drawWick(60, 60, offsetPercent, 0);
7274
}
7375
} else { // recharge routine
7476
state.minute_change_chime = 1;
@@ -103,5 +105,10 @@ function drawWick(min, sec, horizOffsetPercent, noisy) {
103105
let c = color(225, 225, 225);
104106
fill(c);
105107
noStroke();
106-
rect(buffer + offset - 8, 0, 16, config.HEIGHT * 0.9 * percentRemaining);
108+
rect(buffer + offset - 4, 0, 8, config.HEIGHT * 0.9 * percentRemaining);
109+
110+
// draw the base
111+
let basec = color(205,133,63);
112+
fill(basec);
113+
ellipse(buffer + offset, 0, 30, 6);
107114
}

0 commit comments

Comments
 (0)