Fireworks.js
A simple fireworks library!
install with npm:
$ npm install fireworks-js --save
or with yarn:
$ yarn add fireworks-js
import { Fireworks } from 'fireworks-js'
const { Fireworks } = require('fireworks-js')
<script src="https://crashmax-off.github.io/fireworks-js/fireworks.js"></script>
const container = document.querySelector('.fireworks-container')
const fireworks = new Fireworks({
target: container,
hue: 120,
startDelay: 1,
minDelay: 20,
maxDelay: 30,
speed: 4,
acceleration: 1.05,
friction: 0.98,
gravity: 1,
particles: 75,
trace: 3,
explosion: 5,
boundaries: {
top: 50,
bottom: container.clientHeight,
left: 50,
right: container.clientWidth
},
sound: {
enable: false,
list: [
'explosion0.mp3',
'explosion1.mp3',
'explosion2.mp3'
],
min: 4,
max: 8
}
})
// start fireworks
fireworks.start()
// paused fireworks
fireworks.pause()
// cleared fireworks
fireworks.clear()
// stop and cleared fireworks
fireworks.stop()
Author: crashmax-off
Demo: https://crashmax-off.github.io/fireworks-js/
Source Code: https://github.com/crashmax-off/fireworks-js
#javascript