1.0.2 • Published 2 years ago

react-use-firework v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

react-use-firework 🎆

npm version

Demo

Edit react-use-ripple demo

Installation

npm i react-use-firework --save
yarn add react-use-firework

Usage

import React, { useRef } from "react";

import useFireWork from "react-use-firework";

export component = ()=> {
  const ref = useRef(null);
  useFireWork(ref);

  return (
    <div
     ref={ref}
     style={{ width: "100%", height: "600px", background: "#000" }}
    />
  );
}

APIs

the usage demo describes the basic usage and 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