mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-06-01 15:10:14 +00:00
修复星空雨特效BUG
This commit is contained in:
@@ -1,23 +1,24 @@
|
|||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
import React from 'react'
|
import { useEffect } from 'react'
|
||||||
|
|
||||||
const StarrySky = () => {
|
const StarrySky = () => {
|
||||||
React.useEffect(() => {
|
useEffect(() => {
|
||||||
dark()
|
renderStarrySky()
|
||||||
}, [])
|
}, [])
|
||||||
return (
|
return (
|
||||||
<div className="relative">
|
<div className="relative">
|
||||||
<canvas id="starry-sky-vixcity" style={{zIndex:1}} className="top-0 fixed pointer-events-none"></canvas>
|
<canvas id="starry-sky-vixcity" style={{zIndex:5}} className="top-0 fixed pointer-events-none"></canvas>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export default StarrySky
|
export default StarrySky
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建星空雨
|
* 创建星空雨
|
||||||
* @param config
|
* @param config
|
||||||
*/
|
*/
|
||||||
function dark() {
|
function renderStarrySky() {
|
||||||
window.requestAnimationFrame =
|
window.requestAnimationFrame =
|
||||||
window.requestAnimationFrame ||
|
window.requestAnimationFrame ||
|
||||||
window.mozRequestAnimationFrame ||
|
window.mozRequestAnimationFrame ||
|
||||||
@@ -124,7 +125,7 @@ function dark() {
|
|||||||
u()
|
u()
|
||||||
})(),
|
})(),
|
||||||
(function t() {
|
(function t() {
|
||||||
document.getElementsByTagName('html')[0].className == 'dark' && u(),
|
document.getElementsByTagName('html')[0].className.indexOf('dark')>=0 && u(),
|
||||||
window.requestAnimationFrame(t)
|
window.requestAnimationFrame(t)
|
||||||
})()
|
})()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user