loonywizard / js-confetti

JS Confetti library that supports emojis 🦄 🎉 ⚡️
https://loonywizard.github.io/js-confetti/
MIT License
1.08k stars 45 forks source link

How to clean up? #46

Closed lifenautjoe closed 1 year ago

lifenautjoe commented 2 years ago

Hi @loonywizard !

Thanks for the nice library!

Question I couldn't find anywhere, how do I clean up the created canvas? Is this done automatically?

Thanks!

loonywizard commented 2 years ago

Hi @lifenautjoe !

At the present moment, there is no way to clear a canvas from confetties Canvas is cleared when all confetties fall down

Do you need such a method? like

const confetti = new JSConfetti()

confetti.addConfetti()
// ... 

// --->
confetti.clearCanvas()
stepanjakl commented 2 years ago

Hi, confetti.clearCanvas() would be useful. Essentially, there just need to be an id on the canvas and then it can easily be removed from the active DOM.