Refactor birthday, olympia, space, and sports animations; enhance symbol management and visual effects

- Updated birthday.js to improve balloon visuals and confetti effects, including new color schemes and enhanced pop animations.
- Removed legacy fallback logic in olympia.js and improved image error handling.
- Enhanced space.js with configurable counts for planets, astronauts, satellites, ISS, and rockets; improved shooting star animations and added random image swapping.
- Simplified sports.js by removing legacy emoji fallback logic and optimizing ball creation based on selected categories.
- Adjusted CSS styles across birthday, olympia, space, and sports for better visual consistency and performance.
[skip ci]
This commit is contained in:
CodeDevMLH
2026-02-27 01:18:08 +01:00
parent bdc7d2e325
commit 8f322fd6cf
10 changed files with 471 additions and 342 deletions

View File

@@ -10,49 +10,22 @@
contain: strict;
}
.birthday-garland {
position: absolute;
top: -1vh;
left: 0;
width: 100vw;
z-index: 55;
pointer-events: none;
/* optional: a little drop shadow for depth */
filter: drop-shadow(0 5px 8px rgba(0,0,0,0.5));
}
.birthday-garland img {
width: 100%;
height: auto;
object-fit: cover;
}
.birthday-cake {
position: absolute;
bottom: 2vh;
left: 50vw;
transform: translateX(-50%);
font-size: 8rem;
z-index: 50;
filter: drop-shadow(0 0 10px rgba(255,255,255,0.4));
pointer-events: auto;
}
.birthday-cake img {
height: 15vh;
width: auto;
object-fit: contain;
max-height: 150px;
}
.birthday-symbol {
position: absolute;
bottom: -10vh; /* balloons rise from bottom */
animation: birthday-rise linear infinite;
font-size: 3rem;
position: fixed;
top: 0;
left: 0;
animation: birthday-rise linear infinite forwards;
opacity: 0.95;
z-index: 40;
pointer-events: none; /* Container itself should not block clicks */
pointer-events: none;
}
.birthday-sway {
will-change: transform;
animation-name: birthday-sway;
animation-timing-function: ease-in-out;
animation-iteration-count: infinite;
animation-direction: alternate;
}
.birthday-inner {
@@ -61,62 +34,73 @@
display: inline-block;
}
/* MARK: Balloon Size */
.birthday-symbol img {
width: 6vh;
width: 18vh;
height: auto;
max-width: 60px;
max-width: 100px;
object-fit: contain;
}
.birthday-confetti-wrapper {
position: fixed;
top: 0;
left: 0;
z-index: 30;
will-change: transform;
animation-name: birthday-confetti-fall;
animation-timing-function: linear;
animation-iteration-count: infinite;
pointer-events: none;
}
.birthday-confetti {
position: absolute;
top: -5vh;
width: 8px;
height: 16px;
background-color: rgb(0, 0, 0);
will-change: transform;
animation-name: birthday-flutter;
animation-timing-function: linear;
animation-iteration-count: infinite;
}
.birthday-confetti.circle {
width: 8px;
height: 8px;
border-radius: 50%;
}
.birthday-confetti.square {
width: 8px;
height: 8px;
}
.birthday-confetti.triangle {
width: 10px;
height: 10px;
opacity: 0.9;
animation: birthday-confetti-fall linear infinite;
z-index: 30;
/* Mix of circles and squares by using CSS variables or random in JS. For simplicity, we make all slightly rounded rectangles */
border-radius: 2px;
clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
}
@keyframes birthday-rise {
0% {
transform: translateY(10vh) rotate(var(--start-rot, 0deg));
opacity: 0;
}
10% {
opacity: 1;
}
90% {
opacity: 1;
}
100% {
transform: translateY(-110vh) rotate(calc(var(--start-rot, 0deg) * -1));
opacity: 0;
}
0% { transform: translate3d(var(--x-pos, 0vw), 110vh, 0) rotate(var(--start-rot, 0deg)); opacity: 0; }
10% { opacity: 1; }
90% { opacity: 1; }
100% { transform: translate3d(var(--x-pos, 0vw), -20vh, 0) rotate(calc(var(--start-rot, 0deg) * -1)); opacity: 0; }
}
@keyframes birthday-confetti-fall {
0% {
transform: translateY(-5vh) rotateX(0deg) rotateY(0deg) rotateZ(0deg);
opacity: 0;
}
5% {
opacity: 1;
}
90% {
opacity: 1;
}
100% {
transform: translateY(105vh) rotateX(720deg) rotateY(360deg) rotateZ(180deg);
opacity: 0;
}
0% { transform: translate3d(var(--x-pos, 0vw), -10vh, 0); }
100% { transform: translate3d(var(--x-pos, 0vw), 110vh, 0); }
}
@keyframes birthday-sway {
0% { transform: rotate(-8deg) translateX(-5%); }
100% { transform: rotate(8deg) translateX(5%); }
0% { transform: translateX(calc(var(--sway-amount, 50px) * -1)); }
100% { transform: translateX(var(--sway-amount, 50px)); }
}
@keyframes birthday-flutter {
0% { transform: rotate3d(var(--rx, 1), var(--ry, 1), var(--rz, 0), 0deg); }
100% { transform: rotate3d(var(--rx, 1), var(--ry, 1), var(--rz, 0), var(--rot-dir, 360deg)); }
}
@keyframes birthday-pop {
@@ -125,12 +109,17 @@
100% { transform: scale(0); opacity: 0; filter: brightness(2); }
}
.birthday-burst-confetti {
.birthday-burst-wrapper {
position: absolute;
pointer-events: none;
z-index: 1000;
will-change: transform, opacity;
animation: birthday-burst-fall 1.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
animation: birthday-burst-y 1.2s cubic-bezier(0.42, 0, 1, 1) forwards;
}
.birthday-burst-confetti {
will-change: transform;
animation: birthday-burst-x 1.2s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}
.birthday-burst-confetti.circle {
@@ -138,25 +127,27 @@
}
.birthday-burst-confetti.triangle {
width: 0;
height: 0;
background-color: transparent !important;
border-left: 5px solid transparent;
border-right: 5px solid transparent;
border-bottom: 10px solid var(--shape-color, #ff0000);
width: 10px;
height: 10px;
clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
}
@keyframes birthday-burst-fall {
@keyframes birthday-burst-y {
0% {
transform: translate(0, 0) rotate3d(var(--rx), var(--ry), var(--rz), 0deg);
opacity: 1;
}
30% {
transform: translate(var(--burst-x), var(--burst-y)) rotate3d(var(--rx), var(--ry), var(--rz), calc(var(--rot-dir) * 0.3));
transform: translateY(0);
opacity: 1;
}
100% {
transform: translate(var(--burst-x), calc(var(--burst-y) + 150px)) rotate3d(var(--rx), var(--ry), var(--rz), var(--rot-dir));
transform: translateY(calc(var(--burst-y) + 150px)); /* Gravity pull downwards */
opacity: 0;
}
}
@keyframes birthday-burst-x {
0% {
transform: translateX(0) rotate3d(var(--rx), var(--ry), var(--rz), 0deg);
}
100% {
transform: translateX(calc(var(--burst-x) * 1.5)) rotate3d(var(--rx), var(--ry), var(--rz), var(--rot-dir));
}
}