Github GitHub - loonywizard/js-confetti: 🎉 Lightweight zero-config JS Confetti l...
source link: https://github.com/loonywizard/js-confetti
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
JavaScript Confetti library
Zero dependencies used
Works without any config
Has TypeScript typings
Confetti speed adapts to user screen width
Links: GitHub | Library Website | CodeSandbox Playground
Usage
Install library via yarn or npm
yarn add js-confetti
Initialize instance of JSConfetti class and call addConfetti method
import JSConfetti from 'js-confetti' const jsConfetti = new JSConfetti() jsConfetti.addConfetti()
Attencion new JSConfetti()
creates HTML Canvas element and adds it to page, so call it only once!
Customise confetties
addConfetti
method accepts args object with the following params:
jsConfetti.addConfetti({ confettiRadius: 8, confettiesNumber: 200, confettiColors: ['#fcf403', '#62fc03', '#f4fc03', '#03e7fc', '#03fca5', '#a503fc', '#fc03ad', '#fc03c2'] })
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK