fix: 统一针孔幕布转场收尾 — 注释与参考实现逐字节对齐 + 文档同步

- 转场修复主体(LoadingCurtain 全屏 wrapper + pointerEvents、
  RouteTransitionOverlay 统一针孔幕布状态机 + 常驻 canvas、
  LoadingOverlay 精简为就绪 hooks、(site)/layout 移除 LoadingOverlay
  渲染)已随 bededec 一并入库(并行会话 git add -A 卷入);本提交
  补齐 RouteTransitionOverlay 与 vhsys-official-ui cf908fe 终态的
  逐字节对齐(注释措辞 + 空行)
- docs:README 架构图与 03 §5 更新为针孔幕布编排描述(替换旧的 CSS
  擦入层说明),记录 R3F 内联样式覆盖与常驻 canvas 两个关键点
- 验证:npx tsc --noEmit 通过;npx next build 通过;生产环境 CDP
  实测:点击导航 → cover 收拢(0.93 幕布占比)→ 全遮 1.0(URL 才
  切换)→ reveal 张开(0.34)→ 详情页归零;entry 起步全遮后揭开;
  幕布 canvas 全屏 1440x900、pointer-events none、视口中心无 CANVAS、
  0 console 错误(对标 vhsys-official-ui 27467b7 + cf908fe)
This commit is contained in:
2026-09-02 19:33:52 +08:00
parent bededec29c
commit 0ed0fcea4d
3 changed files with 31 additions and 12 deletions
+3 -2
View File
@@ -13,8 +13,8 @@
* the TARGET page's routeLoading gate (only "/" has one:
* readyToLoadHeavy && fontsReady).
* → phase "reveal" : curtain OPENS (0.8s); on complete →
* idle, navigation cleared. Scramble lines re-enabled 100ms into
* the reveal.
* idle, navigation cleared, canvas unmounted. Scramble lines
* re-enabled 100ms into the reveal.
*
* The linear-DOM-wipe overlay this replaces did NOT match the original —
* the original never wipes; it pinholes through the masked-dots curtain.
@@ -264,6 +264,7 @@ export default function RouteTransitionOverlay() {
return () => window.clearTimeout(t);
}, [mode, phase, setAllowScrambleLines]);
// open prop (original O): idle → menuOpen; else closed until reveal.
const open = mode === "idle" ? menuOpen : phase !== "reveal";
// initialProgress (original B): only entry:wait starts fully closed.
+26 -8
View File
@@ -62,20 +62,38 @@ function scrollToMdxAnchorTarget(el: HTMLElement) {
## 5. 路由过渡 cover/reveal(lib/routeTransition.tsx + components/dom/RouteTransitionOverlay.tsx)
复刻原模块 73475。三态机:
复刻原模块 34841:**一块全屏 WebGL 针孔幕布**(components/canvas/LoadingCurtain.tsx:
径向孔洞遮罩 + masked-dots 点阵,frameloop="demand")同时驱动 entry(首屏)与
route(跳页)两种过渡。三态机:
```
idle → startNavigation(href)
→ phase "cover" : b1 色固定层 0.8s cubic-bezier(0.66,0,0.01,1) 擦入
→ 完成后 router.push(href)
→ phase "wait" : 新页挂载(重资源可继续加载)
→ phase "reveal": 擦出(同 easing)→ idle,overlay 卸载
scramble 文字在 reveal 后 100ms 重新允许
→ mode "route", phase "cover" : 幕布 0.8s customCubic 针孔收拢(边缘先闭合)
→ 完成后 router.push/replace + phase "wait"
→ phase "wait" : 新页挂载;reveal 等目标页 routeLoading 门
(仅 "/" 有:readyToLoadHeavy && fontsReady)
→ phase "reveal" : 幕布 0.8s 针孔张开 → idle + clearNavigation
scramble 文字在 reveal 开始 100ms 后放行
```
Context 状态(`useRouteTransitionController`):`targetHref / navigationReplace / startNavigation / clearNavigation / readyToLoadHeavy / heavyLoadProgress / allowScrambleLines`。`readyToLoadHeavy` 同时就是加载门的输入(见 04 §6)。
- 状态机契约:`open = mode === "idle" ? menuOpen : phase !== "reveal"`;
`initialProgress` 仅 entry:wait 为 1(起步全遮);
`resetKey = mode:phase:targetHref:menuOpen`(每阶段重置动画时钟)。
- entry 流(首屏 "/")并入同一编排器:initialProgress=1 + 140px 进度条
(50% 字体 + 50% heavy,经 loadingBus 桥接 provider),就绪即 reveal;
LoadingOverlay 只剩 useAppReady/useHeavyLoad hooks 供相机 intro 使用。
- **幕布 canvas 常驻不卸载**(有意偏差,源码有注释):frameloop="demand"
空闲零开销;避免 dev 下 ~600ms 的 R3F Canvas + EffectComposer 重挂
吞掉大半 cover 动画。
- **LoadingCurtain 的 Canvas 必须包在 `fixed inset-0 z-[60]
pointer-events-none` wrapper 里**,且 Canvas 要显式
`style={{ pointerEvents: "none" }}`:R3F 容器内联
`position:relative; width/height:100%; pointerEvents:auto` 会覆盖
Tailwind 类,幕布会退化成 ~150px 高的文档流条带(动画不可见 +
吞卡片点击)——已踩坑。
调用方:Header 菜单链接、Work 卡片点击、详情页页脚 Home/Work/Contact。z-60 overlay,body 滚动锁定在 cover 期间。
调用方:Header 菜单链接、Work 卡片点击、服务页返回首页、详情页页脚
Home/Work/Contact。z-60 全屏幕布,cover 期间 URL 不变。
## 6. 提示词(让 AI 复刻滚动与过渡)
+2 -2
View File
@@ -33,8 +33,8 @@ app/layout.tsx (PasscodeAccessProvider + FullscreenTransitionProvider)
├─ components/dom/Header.tsx ← z-50 fixed(菜单 / 主题 / 声音开关 + useBgm)
├─ <main>{page}</main> ← 普通流内容(永远画在 canvas 之上)
├─ components/dom/CustomScrollbar.tsx ← SVG 自定义滚动条
├─ components/dom/LoadingOverlay.tsx ← 加载幕布(进度 0→100)
└─ components/dom/RouteTransitionOverlay← 路由过渡 cover/reveal(z-60)
├─ components/dom/LoadingOverlay.tsx ← 重资源就绪 hooks(useAppReady/useHeavyLoad)
└─ components/dom/RouteTransitionOverlay← 统一针孔幕布编排(entry + route 过渡,z-60)
页面:
app/page.tsx 首页(banner → about → WorkSection → HyperSpace → Footer)