feat: 移植原版背景/点阵遮罩/入场幕布,修复贴纸淡出与 cursor 颜色

- BackgroundFX: 1:1 移植原版 sz 多通道程序化背景(vignette→swirl→sine→shatter→bokeh→output,30% 分辨率 ping-pong,指针跟随、进度门控跳帧)
- DotOverlay: 移植原版 s1 滚动点阵遮罩(renderOrder 10,uOpacity=sT(sP))——贴纸随滚动溶入页面底色的原版机制
- LoadingCurtain+LoadingOverlay: 移植原版入场流程(径向圆洞幕布 + MaskedDots 点阵化后处理 + 居中进度条,字体/重资产 5:5 计时轴)
- sP 修正: f2 无 footer 时取 1(原版语义),相机 lerp(24,32,sP) 拉远恢复;视差 y 系数修正为 0.6
- 相机: ready 门控 intro dolly(lerp(A+8,A,customCubic),1.2s)+ 鼠标视差(lag .18/leave .05)
- GlassModels: cursor 贴色修正为亮色主题 #009dff/#009dff;新增指针跟随高光控制器 ca()
- 刷新回顶: scrollRestoration=manual + pageshow(bfcache) 双 rAF 重置 + lenis immediate
- 新增 lib/pointer.ts、lib/loadingBus.ts、lib/customCubic.ts;loadingBus 打点: 模型/贴纸/about 图
This commit is contained in:
2026-09-01 02:00:54 +08:00
parent 91ba27ffc0
commit ce08eabf62
15 changed files with 1757 additions and 33 deletions
+68
View File
@@ -0,0 +1,68 @@
/**
* Heavy-asset loading progress — mirrors the original's heavy-load tracking
* (models + texture layers + sticker atlas gate the entrance). Components
* report completion via mark(); the overlay reads progress/ready.
*/
const REQUIRED = [
"model:hello.gltf",
"model:cursor.glb",
"stickers",
"img:about",
] as const;
const done = new Set<string>();
const listeners = new Set<() => void>();
let notifyQueued = false;
function notify() {
if (notifyQueued) return;
notifyQueued = true;
queueMicrotask(() => {
notifyQueued = false;
listeners.forEach((l) => l());
});
}
function computeSnapshot() {
const marked = REQUIRED.filter((k) => done.has(k)).length;
return {
progress: Math.round((marked / REQUIRED.length) * 100),
ready: marked === REQUIRED.length,
};
}
let currentSnapshot = computeSnapshot();
export const loadingBus = {
mark(key: string) {
if (!done.has(key)) {
done.add(key);
currentSnapshot = computeSnapshot();
notify();
}
},
/** Safety valve: complete everything (a stalled asset must not soft-lock). */
forceReady() {
let changed = false;
for (const k of REQUIRED) {
if (!done.has(k)) {
done.add(k);
changed = true;
}
}
if (changed) {
currentSnapshot = computeSnapshot();
notify();
}
},
getSnapshot() {
return currentSnapshot;
},
subscribe(listener: () => void) {
listeners.add(listener);
return () => {
listeners.delete(listener);
};
},
};