From afca93e6cffb62f425580820a2bc8c2785fc080d Mon Sep 17 00:00:00 2001 From: MrLetsplay Date: Sun, 29 Dec 2024 23:11:34 +0100 Subject: [PATCH] Update new year, Fix font --- fnont/comic.css | 2 +- special/new-year.js | 26 ++++++++++++++------------ 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/fnont/comic.css b/fnont/comic.css index 47d9695..321f1d1 100644 --- a/fnont/comic.css +++ b/fnont/comic.css @@ -5,6 +5,6 @@ @font-face { font-family: "Comic Mono"; - font-weight: boldM + font-weight: bold; src: url('ComicMono-Bold.ttf') format('truetype'); } diff --git a/special/new-year.js b/special/new-year.js index 1202b86..134da36 100644 --- a/special/new-year.js +++ b/special/new-year.js @@ -72,15 +72,15 @@ setInterval(() => { nextYear.setFullYear(theTime.getFullYear() + 1); const timeUntilMidnight = Math.floor((nextYear - theTime) / 1000); - if(timeUntilMidnight < 4 * 60 * 60) { + if (timeUntilMidnight < 4 * 60 * 60) { state = STATE_COUNTDOWN; - }else { + } else { state = STATE_NONE; } } if (state == STATE_FIREWORKS) { - rockets.push({ x: Math.random() * canvas.width, y: canvas.height, life: (Math.random() * 0.75 + 0.25) * canvas.height, color: HSVtoRGB(Math.random(), 1, 1) }); + rockets.push({ x: Math.random() * canvas.width, y: canvas.height, life: (Math.random() * 0.75 + 0.25) * canvas.height, color: HSVtoRGB(Math.random(), 1, 1), rounds: Math.random() * 3 }); return; } else { rockets = []; @@ -123,10 +123,10 @@ setInterval(() => { ctx.font = "bold 30px Comic Mono"; let text = "The new year is approaching 👀"; - if(hours < 1) { + if (hours < 1) { text = "The final hour has started ⏱️"; - if(minutes == 0 && seconds < 60) { + if (minutes == 0 && seconds < 60) { text = "It's the final countdown 😳"; } } @@ -150,14 +150,16 @@ setInterval(() => { const size = explosionTime * EXPLOSION_SIZE; for (let i = 0; i < NUM_PARTICLES; i++) { - const angle = i / NUM_PARTICLES * Math.PI * 2; - const px = Math.cos(angle) * size; - const py = Math.sin(angle) * size; + for (let j = 0; j < rocket.rounds; j++) { + const angle = i / NUM_PARTICLES * Math.PI * 2 + j * 5; + const px = (j + 1) * Math.cos(angle) * size; + const py = (j + 1) * Math.sin(angle) * size; - ctx.fillStyle = rocket.color; - ctx.beginPath(); - ctx.arc(rocket.x + px, rocket.y + py, 5, 0, Math.PI * 2, true); - ctx.fill(); + ctx.fillStyle = rocket.color; + ctx.beginPath(); + ctx.arc(rocket.x + px, rocket.y + py, 5, 0, Math.PI * 2, true); + ctx.fill(); + } } } else { rocket.y -= SPEED;