feat: 添加滚动环境和媒体状态管理,优化头部组件功能,支持背景音乐和主题切换

This commit is contained in:
2026-09-01 14:39:37 +08:00
parent b8483e94a6
commit 602f1c82ed
8 changed files with 537 additions and 22 deletions
+3
View File
@@ -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();
};
}, []);