Fireworks — the audio-reactive pyrotechnic show
The Fireworks scene is Scenifly's most spectacular. Rockets launch into the sky and explode in showers of colored particles, triggered by beats detected in your YouTube music. Each explosion is unique, physically simulated, with luminous trails that linger in the night.
Beat detection
A beat detection algorithm continuously analyzes the bass frequencies of the audio signal. When energy exceeds an adaptive threshold (based on the amplitude difference between two consecutive frames), a rocket is launched. The stronger the beat, the higher the rocket climbs before exploding. A 300ms cooldown prevents multiple rapid-fire launches.
Fireworks physics
Each rocket rises from the bottom of the screen, trailing embers. Upon reaching its apex (calculated from beat intensity), it explodes into 150 to 300 particles that scatter in all directions. Each particle undergoes gravity, loses speed through friction, and its brightness naturally fades until it extinguishes.
Colors are randomly selected from a classic fireworks palette: golden red, sparkling white, emerald green, royal blue, silver, royal violet. Particles glow through a Gaussian halo on CanvasTexture, creating the illusion of real sparkle.
Scenifly's night sky
The background is a night sky dotted with fixed stars that serve as depth markers. Explosions momentarily illuminate this sky, creating halos of diffuse light. When multiple rockets explode simultaneously — during musical crescendos — the sky ignites in a pyrotechnic barrage.
Technology
Each rocket: 40-point trail with Gaussian halo CanvasTexture. Each explosion: 150–300 additional particles. Beat detection: (bass - prevBass > 0.12) AND (bass > 0.25) with 300ms cooldown. Physics: Euler integration with constant gravity and multiplicative friction per frame. DynamicDrawUsage BufferGeometry for per-frame GPU updates. Apex computed as distance = apexY - startY, duration = 40–70 frames.