npm install canvas-confetti
Create a composable in your composables
directory. You can name it useConfetti.ts
.
Add this to the file:
/**
* Easily add confetti effects to your Nuxt application
*
* @see https://github.com/catdad/canvas-confetti
*/
import useConfetti from "canvas-confetti";
export default useConfetti;
We can just call the useConfetti
method to trigger the confetti.
This is how you can shoot confetti off in a random direction.