Update new year, Fix font

This commit is contained in:
MrLetsplay 2024-12-29 23:11:34 +01:00
parent 2d7c83cea1
commit afca93e6cf
Signed by: mr
SSH Key Fingerprint: SHA256:92jBH80vpXyaZHjaIl47pjRq+Yt7XGTArqQg1V7hSqg
2 changed files with 15 additions and 13 deletions

View File

@ -5,6 +5,6 @@
@font-face { @font-face {
font-family: "Comic Mono"; font-family: "Comic Mono";
font-weight: boldM font-weight: bold;
src: url('ComicMono-Bold.ttf') format('truetype'); src: url('ComicMono-Bold.ttf') format('truetype');
} }

View File

@ -72,15 +72,15 @@ setInterval(() => {
nextYear.setFullYear(theTime.getFullYear() + 1); nextYear.setFullYear(theTime.getFullYear() + 1);
const timeUntilMidnight = Math.floor((nextYear - theTime) / 1000); const timeUntilMidnight = Math.floor((nextYear - theTime) / 1000);
if(timeUntilMidnight < 4 * 60 * 60) { if (timeUntilMidnight < 4 * 60 * 60) {
state = STATE_COUNTDOWN; state = STATE_COUNTDOWN;
}else { } else {
state = STATE_NONE; state = STATE_NONE;
} }
} }
if (state == STATE_FIREWORKS) { 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; return;
} else { } else {
rockets = []; rockets = [];
@ -123,10 +123,10 @@ setInterval(() => {
ctx.font = "bold 30px Comic Mono"; ctx.font = "bold 30px Comic Mono";
let text = "The new year is approaching 👀"; let text = "The new year is approaching 👀";
if(hours < 1) { if (hours < 1) {
text = "The final hour has started ⏱️"; text = "The final hour has started ⏱️";
if(minutes == 0 && seconds < 60) { if (minutes == 0 && seconds < 60) {
text = "It's the final countdown 😳"; text = "It's the final countdown 😳";
} }
} }
@ -150,15 +150,17 @@ setInterval(() => {
const size = explosionTime * EXPLOSION_SIZE; const size = explosionTime * EXPLOSION_SIZE;
for (let i = 0; i < NUM_PARTICLES; i++) { for (let i = 0; i < NUM_PARTICLES; i++) {
const angle = i / NUM_PARTICLES * Math.PI * 2; for (let j = 0; j < rocket.rounds; j++) {
const px = Math.cos(angle) * size; const angle = i / NUM_PARTICLES * Math.PI * 2 + j * 5;
const py = Math.sin(angle) * size; const px = (j + 1) * Math.cos(angle) * size;
const py = (j + 1) * Math.sin(angle) * size;
ctx.fillStyle = rocket.color; ctx.fillStyle = rocket.color;
ctx.beginPath(); ctx.beginPath();
ctx.arc(rocket.x + px, rocket.y + py, 5, 0, Math.PI * 2, true); ctx.arc(rocket.x + px, rocket.y + py, 5, 0, Math.PI * 2, true);
ctx.fill(); ctx.fill();
} }
}
} else { } else {
rocket.y -= SPEED; rocket.y -= SPEED;
ctx.fillStyle = "black"; ctx.fillStyle = "black";