Performant confetti animations in the browser on a canvas
open sourceISCfree
canvas-confetti draws confetti animations in the browser on a canvas, with one function call. Options set the particle count, spread, angle, colours, gravity, origin and more, and the built-in shapes are squares, circles and stars; custom shapes come from SVG paths or text, including emoji confetti. confetti.create draws on a canvas of your own, and a disableForReducedMotion option respects users who prefer less motion. It installs from npm as a client-side component for a bundler, or loads from a CDN as a confetti function on window. It doesn't run in Node.
Problems it solves
- show a confetti burst when a user completes a purchase
- emoji confetti animation on my website
- a lightweight celebration animation in JavaScript without a framework
Features
- confetti bursts with options for count, spread, angle, colours and gravity
- square, circle and star shapes, plus custom SVG-path and emoji shapes
- draws on your own canvas with confetti.create
- a reduced-motion option
Limitations
- It's a client-side component that doesn't run in Node.1
Alternatives
The same job
These do what canvas-confetti does.
- Anime.js A fast, modular JavaScript animation engine for CSS, SVG, DOM and JavaScript objects
- GSAP A wildly robust JavaScript animation library built for professionals
- lottie-web Airbnb's JavaScript player that renders After Effects animations exported as Lottie JSON in the browser
