mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-06-08 23:16:54 +00:00
鼠标跟随动画
This commit is contained in:
27
components/MouseFollow.js
Normal file
27
components/MouseFollow.js
Normal file
@@ -0,0 +1,27 @@
|
||||
import { useEffect } from 'react'
|
||||
// import anime from 'animejs'
|
||||
import { siteConfig } from '@/lib/config'
|
||||
import { loadExternalResource } from '@/lib/utils'
|
||||
|
||||
/**
|
||||
* 鼠标跟随特效
|
||||
* @returns
|
||||
*/
|
||||
const MOUSE_FOLLOW = () => {
|
||||
const type = siteConfig('MOUSE_FOLLOW_EFFECT_TYPE')
|
||||
const color = siteConfig('MOUSE_FOLLOW_EFFECT_COLOR')
|
||||
|
||||
useEffect(() => {
|
||||
loadExternalResource('/js/mouse-follow.js', 'js').then(url => {
|
||||
if (window.createMouseCanvas) {
|
||||
window.createMouseCanvas()({
|
||||
type,
|
||||
color
|
||||
})
|
||||
}
|
||||
})
|
||||
}, [])
|
||||
|
||||
return <></>
|
||||
}
|
||||
export default MOUSE_FOLLOW
|
||||
Reference in New Issue
Block a user