npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

Iโ€™ve always been into building performant and accessible sites, but lately Iโ€™ve been taking it extremely seriously. So much so that Iโ€™ve been building a tool to help me optimize and monitor the sites that I build to make sure that Iโ€™m making an attempt to offer the best experience to those who visit them. If youโ€™re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, ๐Ÿ‘‹, Iโ€™m Ryan Hefnerย  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If youโ€™re interested in other things Iโ€™m working on, follow me on Twitter or check out the open source projects Iโ€™ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soonโ€“ish.

Open Software & Tools

This site wouldnโ€™t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you ๐Ÿ™

ยฉ 2026 โ€“ย Pkg Stats / Ryan Hefner

spawn-confetti

v2.0.3

Published

๐ŸŽ‰ Lightweight JavaScript confetti effect that spawns at the mouse position on demand.

Readme

๐ŸŽ‰ Confetti Effect

npm license downloads

A lightweight and highly configurable JavaScript library that spawns confetti on demandโ€”perfect for adding celebration effects to buttons, clicks, or custom triggers on your website.

Demo

๐Ÿš€ Installation:

Option 1: via npm

npm  install  spawn-confetti

Option 2: Vanilla JS

  1. Download confetti.js and add it to your project folder
  2. Include it in your HTML as a module:
<script  src="path/to/confetti.js"  type="module"></script>

๐ŸŽฎ Usage and Configuration

Function Arguments:

The spawnConfetti() function has the following arguments:

  • amount(number) โ€“ Number of confetti particles to spawn. Default: 30

  • x, y(number | string) โ€“ Spawn coordinates. Default: mouse coordinates Accepted string values:

    • mouse โ€“ spawn at mouse coordinate
    • center โ€“ spawn at center coordinate of page
    • max โ€“ spawn at max coordinate of page
  • velXRange, velYRange(array) โ€“ Initial velocity range. Default: [-5, 5], [-8, 0]

  • angVelXRange, angVelZRange(array) โ€“ Constant rotational velocity range. Default: [0, 0], [6, 12]

  • lifetime(number) โ€“ Lifetime of particles in milliseconds. Default: 2000

Example:

// Spawn 30 confetti particles at the current mouse position
	spawnConfetti();

// Custom configuration
	spawnConfetti({
		amount: 75,
		x: 'center',
		y: 'max',
		velXRange: [-20, 20],
		velYRange: [-10, -3],
		angVelXRange: [1, 0],
		angVelZRange: [5, 15],
		lifetime: 500
	});

Global Configuration:

There are a few global configurations that you can modify:

  • acceleration(vector) โ€“ Controls gravity direction. Default: (0, 0.25) โžœ To edit values, assign like: acceleration.x = ..., acceleration.y = ...
  • maxVel(vector) โ€“ Sets maximum velocity. Default: (1.5, 10) โžœ To edit values, assign like: maxVel.x = ..., maxVel.y = ...
  • drag(vector) โ€“ Affects air resistance. Lower values = more drag. Default: (0.98, 1), must be โ‰ค 1 โžœ To edit values, assign like: drag.x = ..., drag.y = ...
  • colors(array) โ€“ List of colors to randomly assign to particles. Default: #f44a4a, #fb8f23, #fee440, #7aff60, #00f5d4, #00bbf9, #9b5de5, #f15bb5
  • shapes(array of svg strings) โ€“ Shapes for particles to randomly select from. Default:
    <rect x="5" y="0" width="6" height="16"/>,
    <path width="16" height="16" d="M0,12 Q4,4 8,12 Q12,20 16,12" stroke-width="5" fill="none"/>,
    <circle cx="9" cy="9" r="5.5"/>,
    <polygon points="9,2.072 17,15.928 1,15.928"/>

    โ— Note: When adding new custom SVG shapes, ensure that any <path> elements include fill="none" to render correctly.

License: MIT Contributing: Contributions welcome! Please feel free to submit a Pull Request.