44 lines
950 B
CSS
44 lines
950 B
CSS
/* container for fireworks */
|
|
.fireworks {
|
|
pointer-events: none;
|
|
position: fixed;
|
|
top: 0;
|
|
left: 0;
|
|
width: 100%;
|
|
height: 100%;
|
|
overflow: hidden;
|
|
z-index: 10; /* put it on top */
|
|
}
|
|
|
|
/* every firework particle */
|
|
.firework {
|
|
position: absolute;
|
|
width: 6px;
|
|
height: 6px;
|
|
border-radius: 50%;
|
|
background: rgba(255, 255, 255, 0.9); /* standard colors */
|
|
animation: explode 1s ease-out forwards;
|
|
transform-origin: center;
|
|
}
|
|
|
|
/* animation for the explosion */
|
|
@keyframes explode {
|
|
0% {
|
|
transform: scale(0.5);
|
|
opacity: 1;
|
|
}
|
|
100% {
|
|
transform: translate(var(--x), var(--y)) scale(0.3);
|
|
opacity: 0;
|
|
}
|
|
}
|
|
|
|
/* optional: different colors for odd and even fireworks */
|
|
.firework:nth-child(odd) {
|
|
background: rgba(255, 100, 100, 0.9); /* red */
|
|
}
|
|
|
|
.firework:nth-child(even) {
|
|
background: rgba(100, 100, 255, 0.9); /* blue */
|
|
}
|
|
|