Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dom-confetti

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dom-confetti

confetti with dom elements

  • 0.0.15
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
64K
decreased by-13.64%
Maintainers
1
Weekly downloads
 
Created
Source

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
  • height: - height of the confetti elements
  • elementCount - Number of particle elements, defaults to 50.
  • decay - Decrease in velocity per frame, defaults to 0.9
  • duration - Duration in milliseconds, defaults to 3000
  • 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 is completely faded.

License MIT, copyright Daniel Lundin 2019

FAQs

Package last updated on 30 Jan 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc