Skip to content

Repository files navigation

react-use-firework 🎆

npm versionnpm version

  • A simple react hook to create click-firework animation 🎆

Demo 🪞

Edit react-use-ripple demo

Install 📦

yarn add react-use-firework

Usage 📋

importReact,{useRef}from"react";importuseFireWorkfrom"react-use-firework";exportcomponent=()=>{constref=useRef(null);useFireWork(ref);return(<divref={ref}style={{width: "100%",height: "600px",background: "#000"}}/>);}

API

the usage demo above is the basic usage with default setting of useFirewrok, you can use it with some options like useFirework(ref,{ count: 10, ...otherOptions }) as well and the supporting options arguments are like the table below

nametypedefaultdescription
countnumber30The number of the firework dot
durationnumber1500the millisecond of the duration of firework
sizenumber6the size of each firework dot
rangenumber200the spread range radius of the firework
colorsArray["#f59342", '#f5e942', '#f54242']the color of the firework
randomColorbooleanfalsewhether to apply random color into the firework

About

A simple react hook to create click-firework animation

Topics

Resources

Stars

6 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages