feat: 添加滚动环境和媒体状态管理,优化头部组件功能,支持背景音乐和主题切换
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
import { useEffect } from 'react';
|
||||
import Lenis from 'lenis';
|
||||
import { scrollBus } from '@/lib/scrollBus';
|
||||
import { scrollEnv } from '@/lib/scrollEnv';
|
||||
|
||||
const clamp01 = (v: number) => Math.min(1, Math.max(0, v));
|
||||
|
||||
@@ -57,6 +58,7 @@ export default function SmoothScroller() {
|
||||
lerp: 0.1,
|
||||
smoothWheel: true,
|
||||
});
|
||||
scrollEnv.setLenis(lenis);
|
||||
|
||||
lenis.scrollTo(0, { immediate: true });
|
||||
|
||||
@@ -79,6 +81,7 @@ export default function SmoothScroller() {
|
||||
return () => {
|
||||
window.removeEventListener('resize', updateCameraProgress);
|
||||
window.removeEventListener('pageshow', onPageShow);
|
||||
scrollEnv.setLenis(null);
|
||||
lenis.destroy();
|
||||
};
|
||||
}, []);
|
||||
|
||||
Reference in New Issue
Block a user