Get started with canvas-confetti CDN

ISC licensed

Canvas-Confetti is a lightweight library for creating confetti effects on the HTML5 Canvas element.

Tags:
  • canvas
  • confetti

Stable version

Copied!

How to start using canvas-confetti CDN


// Include the library
const Confetti = require('canvas-confetti');

// Create a button to trigger confetti
const button = document.createElement('button');
button.innerText = 'Throw Confetti';
button.addEventListener('click', () => {
  Confetti.stars(100, { startVelocity: 30, spread: 160, max: 100 });
});
document.body.appendChild(button);

// Trigger confetti on button click
Copied!
Copied!

All versions