A javascript animation experiment

What's this all about? (AKA, "Holy pointless lightshow, Batman!")

Fireworks.js is a bit of Javascript that creates starburst-type explosions in a web document; in short, it's a fireworks effect someone could theoretically use on their site. And come on, who doesn't want something like that? As far as appropriateness is concerned, this effect could be compared to the dripping-blood-line, skull and fireball animated .GIF images so popular on the web in 1997. Exploding firework animations are hot, the new black, the script equivalent of the blink tag. Mmm, blink tag.

Nonetheless, Fireworks has been published here for fun, experimenting a bit with simple trigonometry and math, and those who are perhaps interested in javascript animation, object-oriented code or script-driven sound. It also serves as a dirty browser performance test of sorts, as a large number of elements are dynamically created, moved and destroyed on this page as the script runs.

Demo Controls

Why explain through reading when you can demonstrate by example? Try playing around with the sliders below for a wide range of visual effects. Not all combinations will look good, but the idea is to experiment.

Drag the sliders (or click a point on the bar) to set the various parameters available such as blast radius and the number of particles per explosion, then click "fire" to see the results.

The code required to generate the current effect is dynamically updated as you adjust the controls; refer to the createFirework() API call below.

Fireworks Parameters

Blast Radius
% of window size
Explosion elements
..per explosion
Burst Type
(Base colour)
Start X
% of window
Start Y
% of window
Explode X
% of window
Explode Y
% of window

Additional Options

Randomize explosion pattern
Obey window boundaries

Hide content (may increase performance)

API call for current parameters


Note: Random values will be substituted for null arguments and options that are not applied.

Demo Presets

Don't want to play with sliders? Here are a few canned effects that I thought were neat. Refer to the code for the parameters used to make the effect.


Fireworks does the following nifty things:

* (I tried, but no guarantees. May drip a bit.)

Known Bugs ("Unintended features")


Download, extract and view. Some basic examples are given that show the minimal requirements (Javascript/CSS references etc.) for the script to work. The code base also includes SoundManager, a Javascript API which allows ECMAscript (Javascript)-controlled sound effects reliably on IE and Mozilla across the Windows and Linux platforms.


Fireworks v0.9.1.20110703
  • Upgraded audio to SoundManager 2, now works in more places
  • Basic code clean-up, appease the JSLINT gods
  • Also on Github
Fireworks v0.9.20050609
  • Initial build
  • Public release
  • Likely the first and last, but hey!

Related reading