Socket
Socket
Sign inDemoInstall

party-popper

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

party-popper

Make a party popper blowing confetti.


Version published
Maintainers
1
Created
Source

Party Popper

Getting started

Install the module :

npm i party-popper

Import in any of your scripts:

import PartyPopper from 'party-popper'

You can import some SVGs aswell:

import customconfetti1 from './assets/confettis/1.svg'

Using PartyPopper


import PartyPopper from 'party-popper'
import confetti1 from './assets/confettis/1.svg'

document.addEventListener('DOMContentLoaded', () => {
  const opts = {
    // Use either an already-configured array of confettis...
    confettis: [
      { model: confetti1, x: -50, y:-10, width: 40, height: 40, originX: 0 },
      { model: confetti1, x: -20, y:-10, width: 15, height: 20 },
    ],
    // ... Or set some seeds and bias for random generation
    originX: 20,
    originY: 20,
    spreadDistance: { min: 20, max: 140 },
    spreadAngles: [[-30,30], [50,80]],
    confettiModels: [...svg1, svg2],
    confettiCount: 10
  }

  // Create your instance
  const pp = new PartyPopper(document.querySelector('.popper'), opts)

  // Set your confettis visible 
  pp.render()

  // use PartyPopper.fire() to animate !
  // Here, wait 1s between render and fire
  window.setTimeout(() => { pp.fire() }, 1000)
})

Keywords

FAQs

Package last updated on 14 Nov 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