Party Popper
Getting started
Install the module :
npm i party-popper
Import in any of your scripts:
import PartyPopper from 'party-popper'
You can import some SVGs aswell:
import customconfetti1 from './assets/confettis/1.svg'
Using PartyPopper
import PartyPopper from 'party-popper'
import confetti1 from './assets/confettis/1.svg'
document.addEventListener('DOMContentLoaded', () => {
const opts = {
confettis: [
{ model: confetti1, x: -50, y:-10, width: 40, height: 40, originX: 0 },
{ model: confetti1, x: -20, y:-10, width: 15, height: 20 },
],
originX: 20,
originY: 20,
spreadDistance: { min: 20, max: 140 },
spreadAngles: [[-30,30], [50,80]],
confettiModels: [...svg1, svg2],
confettiCount: 10
}
const pp = new PartyPopper(document.querySelector('.popper'), opts)
pp.render()
window.setTimeout(() => { pp.fire() }, 1000)
})