Animazione di fuochi d'artificio con JavaScript e Canvas

Blog

Animazione di fuochi d'artificio con JavaScript e Canvas

Fuochi d'artificio.js



Una semplice libreria di fuochi d'artificio!

Installazione

installa con npm:



$ npm install fireworks-js --save

o con filato:

$ yarn add fireworks-js

utilizzo

import { Fireworks } from 'fireworks-js' const { Fireworks } = require('fireworks-js') 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()

Scarica i dettagli:

Autore: crashmax-off



Dimostrazione: https://crashmax-off.github.io/fireworks-js/

Codice sorgente: https://github.com/crashmax-off/fireworks-js

#javascript