.fireworks { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 10; /* activate the following for fixed positioning */ /*position: fixed;*/ /*overflow: hidden;*/ } .rocket-trail { position: absolute; left: var(--trailX); top: var(--trailStartY); width: 4px; /* activate the following for rocket trail */ height: 60px; background: linear-gradient(to bottom, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0)); filter: blur(2px); /* activate the following for rocket trail as a point */ /*height: 4px;*/ /*background: white;*/ /*border-radius: 50%; box-shadow: 0 0 8px 2px white;*/ animation: rocket-trail-animation 1s linear forwards; } @keyframes rocket-trail-animation { 0% { transform: translateY(0); opacity: 1; } 100% { transform: translateY(calc(var(--trailEndY) - var(--trailStartY))); opacity: 0; } } /* Animation for the particles */ @keyframes fireworkParticle { 0% { opacity: 1; transform: translate(0, 0); } 100% { opacity: 0; transform: translate(var(--x), var(--y)); } } .firework { position: absolute; width: 5px; height: 5px; background: white; border-radius: 50%; animation: fireworkParticle 1.5s ease-out forwards; filter: blur(1px); }