MCPcopy Index your code
hub / github.com/daniel-lundin/dom-confetti

github.com/daniel-lundin/dom-confetti @v0.2.2

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.2.2 ↗ · + Follow
8 symbols 13 edges 3 files 0 documented · 0%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

dom-confetti

npm version

Trigger confetti explosions in the DOM.

import { confetti } from 'dom-confetti';

const button = document.querySelector(".my-button")
button.addEventListener("click", () => confetti(button))

This will trigger a confetti explosion every time a button is clicked.

Demo

https://daniel-lundin.github.io/react-dom-confetti/

Interface

confetti(root, config = {})

root should be the DOM element to start the explosion at, and config, if given, may be an object specifying the following options:

  • angle - direction of the explosion in degrees, defaults to 90.
  • spread - spread of the explosion in degrees, defaults to 45.
  • startVelocity - Initial velocity of the particles, defaults to 45.
  • width: - width of the confetti elements as css string, defaults to 10px.
  • height: - height of the confetti elements as css string, defaults to 10px.
  • perspective - perspective of root element.
  • height: - height of the confetti elements
  • elementCount - Number of particle elements, defaults to 50.
  • decay - deprecated - Decrease in velocity per frame, defaults to 0.9 (Use of this will disable dragFriction)
  • dragFriction - Decrease in velocity proportional to current velocity, default to 0.1
  • duration - Duration in milliseconds, defaults to 3000
  • stagger - Delay for each fetti in milliseconds, defaults to 0.
  • random - Randomization function, defaults to Math.random
  • colors - An array of color codes, defaults to ['#a864fd', '#29cdff', '#78ff44', '#ff718d' '#fdff6a']

Returns a promise that resolves once the confetti has completed its fade out.

License MIT, copyright Daniel Lundin 2019

Extension points exported contracts — how you extend this code

ConfettiConfig (Interface)
(no doc)
index.d.ts

Core symbols most depended-on inside this repo

createElements
called by 1
src/main.js
randomPhysics
called by 1
src/main.js
updateFetti
called by 1
src/main.js
animate
called by 1
src/main.js
backwardPatch
called by 1
src/main.js
update
called by 0
src/main.js
confetti
called by 0
src/main.js

Shape

Function 7
Interface 1

Languages

TypeScript100%

Modules by API surface

src/main.js7 symbols
index.d.ts1 symbols

For agents

$ claude mcp add dom-confetti \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page