Skip to content

Mnxj/react-click-display-fireworks

Repository files navigation

1

The mouse click event of the react+ts version, colorful fireworks effects will appear when the mouse clicks. feedback: send [email protected] github:https://github.com/Mnxj

2

// npm i react-click-display-fireworks

// step1
import MouseClickAnimation from 'react-click-display-fireworks';

// mount get dom
const canvasEl = document.querySelector ('.fireworks') as any;

// step2 create hover
const mouse = new MouseClickAnimation(canvasEl);

// step3 listener
const onMousedown = (e ) => {
          mouse.updateCoords(e)
          mouse.animateParticules()
}

document.addEventListener('mousedown',onMousedown)
mouse.setCanvasSize();// init
window.addEventListener('resize', mouse.setCanvasSize);

// step4 remember clear

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published