react-click-display-fireworks
v1.0.2
Published
The mouse click event of the react+ts version, colorful fireworks effects will appear when the mouse clicks.
Downloads
6
Readme
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