mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-14 07:26:52 +00:00
修复星空雨特效BUG
This commit is contained in:
@@ -1,23 +1,24 @@
|
||||
/* eslint-disable */
|
||||
import React from 'react'
|
||||
import { useEffect } from 'react'
|
||||
|
||||
const StarrySky = () => {
|
||||
React.useEffect(() => {
|
||||
dark()
|
||||
useEffect(() => {
|
||||
renderStarrySky()
|
||||
}, [])
|
||||
return (
|
||||
<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>
|
||||
)
|
||||
}
|
||||
|
||||
export default StarrySky
|
||||
|
||||
/**
|
||||
* 创建星空雨
|
||||
* @param config
|
||||
*/
|
||||
function dark() {
|
||||
function renderStarrySky() {
|
||||
window.requestAnimationFrame =
|
||||
window.requestAnimationFrame ||
|
||||
window.mozRequestAnimationFrame ||
|
||||
@@ -124,7 +125,7 @@ function dark() {
|
||||
u()
|
||||
})(),
|
||||
(function t() {
|
||||
document.getElementsByTagName('html')[0].className == 'dark' && u(),
|
||||
document.getElementsByTagName('html')[0].className.indexOf('dark')>=0 && u(),
|
||||
window.requestAnimationFrame(t)
|
||||
})()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user