退役(零视觉影响:NEXT_PUBLIC_HERO_SCENE 从未在任何 .env* 设置): - 删 hero-scene.tsx(694行)/caption/单测/文案真源/CC0 机柜/海报帧 - R26 删除、R22 登记归零、e2e heroSceneMask 移除(无命中的假安全网) - R22 自证改可注入(夹具不再依赖生产条目) 落库(flag NEXT_PUBLIC_HERO_FIELD 样期默认关 ⇒ 基线零影响): - hero-field.tsx 三拍:噪声→增长→判断;bloom 半分辨率;DPR≤1.5 - 降级统一看结论帧(reduced-motion 定格 T_HOLD=40500 非 0) - 文案真源含承诺词正则守卫(禁帮助/赋能/提升/%/倍) - 海报帧 capture 脚本与资产同批入库(1920x864/26.9KB,可复现) - eslint 忽略 demo/**/vendor/**(vendored three 不可被 lint-staged --fix 改写) 守卫重建:R26 指向 hero-field(43260ms/3 拍合规);R22 登记 HeroField 条目 验证:tsc 0 / eslint 0 error / jest 162 套件 1906 例 / check:grammar 26+26 / check:a11y 0 违规 / 默认构建首页 DOM 冒烟 E 案不变
727 lines
33 KiB
HTML
727 lines
33 KiB
HTML
<!doctype html>
|
|
<html lang="zh-CN">
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
<title>Hero 分镜方案对照 · 数据驱动决策</title>
|
|
<style>
|
|
:root { --ink:#0b0a08; --line:rgba(255,255,255,.12); --amber:#ffb457; }
|
|
* { box-sizing: border-box; }
|
|
html, body { height:100%; margin:0; }
|
|
body {
|
|
background: var(--ink); color:#fff; overflow:hidden;
|
|
font-family:-apple-system,BlinkMacSystemFont,'PingFang SC','Helvetica Neue',Arial,sans-serif;
|
|
-webkit-font-smoothing:antialiased;
|
|
}
|
|
#host { position:fixed; inset:0; }
|
|
#host canvas { display:block; width:100%; height:100%; }
|
|
#scrim {
|
|
position:fixed; inset:0; pointer-events:none;
|
|
background:linear-gradient(90deg,rgba(11,10,8,.94) 0%,rgba(11,10,8,.9) 32%,rgba(11,10,8,.62) 55%,rgba(11,10,8,.16) 100%);
|
|
}
|
|
#veil { position:fixed; inset:0; background:#07080a; opacity:0; pointer-events:none; }
|
|
#vignette { position:fixed; inset:0; pointer-events:none;
|
|
background:radial-gradient(120% 90% at 50% 45%,transparent 45%,rgba(0,0,0,.55) 100%); }
|
|
|
|
#copy { position:fixed; left:6vw; top:50%; transform:translateY(-50%); width:min(38rem,46vw); pointer-events:none; }
|
|
#copy .eyebrow { display:flex; align-items:center; gap:12px; }
|
|
#copy .eyebrow i { display:block; width:32px; height:1px; background:#c41e3a; }
|
|
#copy .eyebrow span { font-size:13px; font-weight:500; letter-spacing:.15em; color:rgba(255,255,255,.75); }
|
|
#copy h1 { margin:24px 0 0; font-size:clamp(28px,3.1vw,44px); line-height:1.14; font-weight:700; letter-spacing:-.01em; }
|
|
#copy p { margin:18px 0 0; font-size:15px; line-height:1.72; color:rgba(255,255,255,.75); max-width:32rem; }
|
|
#copy .ctas { display:flex; gap:16px; margin-top:30px; }
|
|
#copy .cta { padding:13px 26px; font-size:14px; font-weight:600; border-radius:2px; }
|
|
#copy .cta.primary { background:#c41e3a; color:#fff; }
|
|
#copy .cta.secondary { border:1px solid rgba(255,255,255,.4); color:#fff; }
|
|
|
|
#caption { position:fixed; left:6vw; bottom:26px; display:flex; align-items:center; gap:12px; pointer-events:none; font-size:13px; }
|
|
#caption i { display:block; width:24px; height:1px; background:rgba(255,255,255,.3); }
|
|
#caption b { font-weight:500; letter-spacing:.08em; color:rgba(255,255,255,.7); }
|
|
#caption span { color:rgba(255,255,255,.5); }
|
|
|
|
#panel {
|
|
position:fixed; top:16px; right:16px; width:326px; padding:15px 15px 13px;
|
|
background:rgba(14,13,12,.88); border:1px solid var(--line); border-radius:4px;
|
|
backdrop-filter:blur(14px); font-size:12px;
|
|
}
|
|
#panel h2 { margin:0 0 2px; font-size:12px; font-weight:600; letter-spacing:.06em; }
|
|
#panel .sub { margin:0 0 11px; font-size:11px; line-height:1.6; color:rgba(255,255,255,.42); }
|
|
.variants { display:grid; gap:5px; }
|
|
.vbtn {
|
|
display:block; width:100%; text-align:left; padding:7px 9px; cursor:pointer;
|
|
background:transparent; border:1px solid rgba(255,255,255,.1); border-radius:3px;
|
|
color:rgba(255,255,255,.72); font-size:12px; font-family:inherit; transition:120ms;
|
|
}
|
|
.vbtn:hover { border-color:rgba(255,255,255,.28); color:#fff; }
|
|
.vbtn.on { border-color:rgba(255,255,255,.55); background:rgba(255,255,255,.07); color:#fff; }
|
|
.vbtn em { display:block; font-style:normal; margin-top:3px; font-size:10.5px; line-height:1.5; color:rgba(255,255,255,.38); }
|
|
.vbtn.on em { color:rgba(255,255,255,.55); }
|
|
.vbtn .k { display:inline-block; margin-right:6px; color:rgba(255,255,255,.3); font-variant-numeric:tabular-nums; }
|
|
.row { display:flex; gap:6px; margin-top:11px; }
|
|
.row button {
|
|
flex:1; padding:6px 0; cursor:pointer; text-align:center; font-size:11px;
|
|
background:transparent; border:1px solid rgba(255,255,255,.1); border-radius:3px;
|
|
color:rgba(255,255,255,.6); font-family:inherit;
|
|
}
|
|
.row button:hover { border-color:rgba(255,255,255,.3); color:#fff; }
|
|
#tl { width:100%; margin:11px 0 3px; accent-color:#c41e3a; }
|
|
.ticks { display:flex; justify-content:space-between; font-size:10px; color:rgba(255,255,255,.28); font-variant-numeric:tabular-nums; }
|
|
#readout { margin-top:9px; padding-top:9px; border-top:1px solid rgba(255,255,255,.08);
|
|
display:flex; justify-content:space-between; font-size:10.5px; color:rgba(255,255,255,.42); font-variant-numeric:tabular-nums; }
|
|
#readout b { color:var(--amber); font-weight:500; }
|
|
#hint { position:fixed; left:50%; bottom:26px; transform:translateX(-50%); font-size:11px; color:rgba(255,255,255,.25); pointer-events:none; }
|
|
#err { position:fixed; inset:0; display:none; place-items:center; text-align:center; padding:40px; font-size:13px; color:#ff9b9b; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div id="host"></div>
|
|
<div id="scrim"></div>
|
|
<div id="vignette"></div>
|
|
<div id="veil"></div>
|
|
|
|
<div id="copy">
|
|
<div class="eyebrow"><i></i><span>企业数字化转型</span></div>
|
|
<h1>让每一家企业都拥有数据驱动的决策能力</h1>
|
|
<p>专业核心团队,以结果导向的服务理念,做中国企业数字化转型的同行者与成长伙伴,从战略诊断到系统落地、再到持续陪跑,让每一份技术投入都转化为可衡量的成长。</p>
|
|
<div class="ctas"><span class="cta primary">预约咨询</span><span class="cta secondary">看行业实践</span></div>
|
|
</div>
|
|
|
|
<div id="caption"><i></i><b id="cap-label">01 数据汇入</b><span id="cap-detail">冷通道 · 数据逐格累积</span></div>
|
|
|
|
<div id="panel">
|
|
<h2>Hero 分镜方案对照</h2>
|
|
<p class="sub">同机位 · 同时长(43.26s)· 三拍结构相同,只换「决策」的内容模型。</p>
|
|
<div class="variants" id="variants"></div>
|
|
<input id="tl" type="range" min="0" max="43260" step="10" value="0" />
|
|
<div class="ticks"><span>0s</span><span>16.4s</span><span>29.8s</span><span>42.8s</span></div>
|
|
<div class="row">
|
|
<button id="btn-play">暂停</button>
|
|
<button id="btn-settle">跳到落定帧</button>
|
|
<button id="btn-copy">文案层</button>
|
|
</div>
|
|
<div id="readout"><span>镜头 <b id="ro-shot">s1-aisle</b></span><span>k <b id="ro-k">0.00</b></span><span>t <b id="ro-t">0.0s</b></span></div>
|
|
</div>
|
|
|
|
<div id="hint">键盘 1–4 切方案 · 空格播放/暂停</div>
|
|
<div id="err"></div>
|
|
|
|
<script type="importmap">
|
|
{ "imports": {
|
|
"three": "/node_modules/three/build/three.module.js",
|
|
"three/addons/": "/node_modules/three/examples/jsm/"
|
|
} }
|
|
</script>
|
|
|
|
<script type="module">
|
|
import * as THREE from 'three';
|
|
import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js';
|
|
|
|
/* ═══════════ 机位与时长:与 hero-scene.tsx 完全一致 ═══════════ */
|
|
const SHOTS = [
|
|
{ id:'s1-aisle', ms:16000,
|
|
from:{ pos:[ 2.8, 2.3, 9.5], tgt:[0.1,1.35,-18] },
|
|
to: { pos:[-0.55,1.5, 4.6], tgt:[0.15,1.28,-22] } },
|
|
{ id:'s2-array', ms:13000,
|
|
from:{ pos:[5.2,-28.6,3.2], tgt:[0,-40,-11] },
|
|
to: { pos:[1.6,-31.2,-6.4], tgt:[0,-40,-13] } },
|
|
{ id:'s3-closeup', ms:13000,
|
|
from:{ pos:[-0.62,1.52,-0.6], tgt:[2.0,1.35,-5.4] },
|
|
to: { pos:[-0.5,1.24,-5.2], tgt:[2.05,1.28,-9.6] } },
|
|
];
|
|
const DIP_MS = 420;
|
|
const CYCLE_MS = SHOTS.reduce((a,s)=>a+s.ms+DIP_MS, 0);
|
|
const S3_SETTLE = 0.62;
|
|
const T_S3 = SHOTS[0].ms + DIP_MS + SHOTS[1].ms + DIP_MS;
|
|
const T_SETTLE = T_S3 + SHOTS[2].ms * S3_SETTLE;
|
|
|
|
const CAPTIONS = {
|
|
's1-aisle': { label:'01 数据汇入', detail:'冷通道 · 数据逐格累积' },
|
|
's2-array': { label:'02 全局评估', detail:'模块化阵列 · 全部选项同框' },
|
|
's3-closeup': { label:'03 判断落定', detail:'单柜视角 · 一柜长明' },
|
|
};
|
|
|
|
const VARIANTS = [
|
|
{ id:'base', name:'基线(现状)', desc:'只有运镜与灯,画面里没有任何「决策对象」。对照组。' },
|
|
{ id:'gate', name:'V1 阈值触发', desc:'内容=数据格逐格累积 → 填满后越过闸门 → 触发唯一动作。因果链最直白。' },
|
|
{ id:'pick', name:'V2 候选筛选', desc:'内容=6 个候选被评估 → 俯视图里 5 个逐个转灰熄灭 → 回到走廊只剩 1 个被锁定。' },
|
|
{ id:'path', name:'V3 路径选择', desc:'内容=3 条并行路径 → 2 条先后熄灭 → 1 条保持并通向目标柜。决策即「排除」。' },
|
|
];
|
|
|
|
const SCENE_BG = 0x07080a, FARM_Y = -40;
|
|
const RACK_W=1.0, RACK_H=2.0, RACK_D=0.6, RACK_COUNT=72, RACK_STEP=0.66, LED_PER_RACK=3;
|
|
const REAL_PER_SIDE = 40;
|
|
const COL=6, ROW=10, GAP=1.15, FARM_RACK=0.7;
|
|
/* 目标柜:S3 相机终点 z=-5.2、看向 z=-9.6 ⇒ 目标必须在视线前方,不能贴身 */
|
|
const TARGET = { i:24, z:-9.84, x:1.505, ys:[0.55,1.07,1.59] };
|
|
const LED_PALETTE = [0x4a7cff,0x63d2ff,0x2f6bff,0xffb457,0x46e08a];
|
|
const AMBER = 0xffb457, CYAN = 0x63d2ff;
|
|
|
|
const host = document.getElementById('host');
|
|
const veil = document.getElementById('veil');
|
|
const errBox = document.getElementById('err');
|
|
let renderer;
|
|
try {
|
|
renderer = new THREE.WebGLRenderer({ antialias:true, alpha:false, powerPreference:'high-performance' });
|
|
} catch (e) {
|
|
errBox.style.display='grid'; errBox.textContent='WebGL 不可用:'+e.message; throw e;
|
|
}
|
|
renderer.setPixelRatio(Math.min(window.devicePixelRatio||1, 1.5));
|
|
renderer.setSize(host.clientWidth, host.clientHeight, false);
|
|
renderer.toneMapping = THREE.ACESFilmicToneMapping;
|
|
renderer.toneMappingExposure = 1.32;
|
|
renderer.outputColorSpace = THREE.SRGBColorSpace;
|
|
host.appendChild(renderer.domElement);
|
|
|
|
const scene = new THREE.Scene();
|
|
scene.background = new THREE.Color(SCENE_BG);
|
|
scene.fog = new THREE.Fog(SCENE_BG, 16, 78);
|
|
const camera = new THREE.PerspectiveCamera(38, host.clientWidth/host.clientHeight, 0.1, 400);
|
|
const m4 = new THREE.Matrix4();
|
|
|
|
/* ═══════════ 舞台(与线上同一套几何) ═══════════ */
|
|
const floorMat = new THREE.MeshStandardMaterial({ color:0x0d1116, roughness:.3, metalness:.5 });
|
|
const floor = new THREE.Mesh(new THREE.PlaneGeometry(44,96), floorMat);
|
|
floor.rotation.x = -Math.PI/2; scene.add(floor);
|
|
|
|
const rackGeo = new THREE.BoxGeometry(RACK_W, RACK_H, RACK_D);
|
|
const rackMat = new THREE.MeshStandardMaterial({ color:0x1c222a, roughness:.5, metalness:.3 });
|
|
const racks = new THREE.InstancedMesh(rackGeo, rackMat, RACK_COUNT*2);
|
|
for (let side=0; side<2; side++) {
|
|
const x = side===0 ? -2.05 : 2.05;
|
|
for (let i=0;i<RACK_COUNT;i++) { m4.makeTranslation(x, RACK_H/2, 6-i*RACK_STEP); racks.setMatrixAt(side*RACK_COUNT+i, m4); }
|
|
}
|
|
racks.instanceMatrix.needsUpdate = true; scene.add(racks);
|
|
|
|
const ledGeo = new THREE.PlaneGeometry(0.44,0.018);
|
|
const ledMat = new THREE.MeshBasicMaterial({ toneMapped:false });
|
|
const ledCount = RACK_COUNT*2*LED_PER_RACK;
|
|
const leds = new THREE.InstancedMesh(ledGeo, ledMat, ledCount);
|
|
const ledBase = new Float32Array(ledCount*3);
|
|
{
|
|
const c=new THREE.Color(), v=new THREE.Vector3(), q=new THREE.Quaternion(), s=new THREE.Vector3(1,1,1), e=new THREE.Euler();
|
|
let n=0;
|
|
for (let side=0; side<2; side++) {
|
|
const x = side===0 ? -2.05+RACK_W/2+0.001 : 2.05-RACK_W/2-0.001;
|
|
e.set(0, side===0 ? Math.PI/2 : -Math.PI/2, 0); q.setFromEuler(e);
|
|
for (let i=0;i<RACK_COUNT;i++) {
|
|
const z = 6-i*RACK_STEP;
|
|
for (let k=0;k<LED_PER_RACK;k++) {
|
|
v.set(x, 0.55+k*0.52, z); m4.compose(v,q,s); leds.setMatrixAt(n, m4);
|
|
const pick = (i*7+k*3+side)%11;
|
|
const hex = pick===0 ? LED_PALETTE[3] : pick===5 ? LED_PALETTE[4] : LED_PALETTE[(i+k)%3];
|
|
c.setHex(hex); leds.setColorAt(n, c);
|
|
ledBase[n*3]=c.r; ledBase[n*3+1]=c.g; ledBase[n*3+2]=c.b; n++;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
leds.instanceMatrix.needsUpdate = true;
|
|
if (leds.instanceColor) leds.instanceColor.needsUpdate = true;
|
|
scene.add(leds);
|
|
|
|
const ceil = new THREE.Mesh(new THREE.PlaneGeometry(44,96), new THREE.MeshStandardMaterial({ color:0x0a0c10, roughness:1 }));
|
|
ceil.rotation.x = Math.PI/2; ceil.position.y = 3.1; scene.add(ceil);
|
|
|
|
const strip = new THREE.Mesh(new THREE.PlaneGeometry(0.34,92), new THREE.MeshBasicMaterial({ color:0x38434f, toneMapped:false }));
|
|
strip.rotation.x = Math.PI/2; strip.position.set(0,3.08,-36); scene.add(strip);
|
|
|
|
const lamps = new THREE.InstancedMesh(new THREE.BoxGeometry(0.5,0.04,1.5),
|
|
new THREE.MeshBasicMaterial({ color:0x8fa2ba, toneMapped:false }), 16);
|
|
for (let i=0;i<16;i++) { m4.makeTranslation(0,3.05,5-i*3.4); lamps.setMatrixAt(i, m4); }
|
|
lamps.instanceMatrix.needsUpdate = true; scene.add(lamps);
|
|
|
|
const skirtMat = new THREE.MeshBasicMaterial({ color:0x16263a, toneMapped:false });
|
|
const skirtGeo = new THREE.BoxGeometry(0.035,0.02,92);
|
|
for (const x of [-1.46,1.46]) { const m=new THREE.Mesh(skirtGeo, skirtMat); m.position.set(x,0.05,-36); scene.add(m); }
|
|
|
|
const farm = new THREE.Group(); farm.position.y = FARM_Y; scene.add(farm);
|
|
const farmFloor = new THREE.Mesh(new THREE.PlaneGeometry(30,30), floorMat);
|
|
farmFloor.rotation.x = -Math.PI/2; farm.add(farmFloor);
|
|
|
|
const farmRackMat = new THREE.MeshStandardMaterial({ color:0x2b333d, roughness:.55, metalness:.3 });
|
|
const farmRacks = new THREE.InstancedMesh(rackGeo, farmRackMat, COL*ROW);
|
|
{
|
|
let fi=0;
|
|
for (let c=0;c<COL;c++) for (let r=0;r<ROW;r++) {
|
|
m4.makeTranslation((c-(COL-1)/2)*GAP, RACK_H/2, -8-r*GAP);
|
|
m4.scale(new THREE.Vector3(FARM_RACK,1,FARM_RACK));
|
|
farmRacks.setMatrixAt(fi++, m4);
|
|
}
|
|
}
|
|
farmRacks.instanceMatrix.needsUpdate = true; farm.add(farmRacks);
|
|
|
|
const aisleMats = [];
|
|
const aisleGeo = new THREE.BoxGeometry(0.05,0.02,ROW*GAP+0.6);
|
|
for (let c=0;c<=COL;c++) {
|
|
const mat = new THREE.MeshBasicMaterial({ color:0x2a4c6e, toneMapped:false });
|
|
aisleMats.push(mat);
|
|
const a = new THREE.Mesh(aisleGeo, mat);
|
|
a.position.set((c-COL/2)*GAP, 0.03, -8-((ROW-1)*GAP)/2);
|
|
farm.add(a);
|
|
}
|
|
|
|
const hemi = new THREE.HemisphereLight(0x1b2430, 0x030405, 0.5); scene.add(hemi);
|
|
const corridorLights = [];
|
|
for (const z of [6,-3,-12,-22,-34]) {
|
|
const p = new THREE.PointLight(0xdce4ee, 34, 30, 2); p.position.set(0,2.75,z);
|
|
scene.add(p); corridorLights.push(p);
|
|
}
|
|
const farmLights = [];
|
|
for (const [fx,fz] of [[0,-10],[0,-19]]) {
|
|
const p = new THREE.PointLight(0xdce4ee, 220, 30, 2); p.position.set(fx,FARM_Y+7,fz);
|
|
scene.add(p); farmLights.push(p);
|
|
}
|
|
const HEMI_BASE = hemi.intensity;
|
|
const LIGHTS_BASE = corridorLights.map(l=>l.intensity);
|
|
const FARM_LIGHTS_BASE = farmLights.map(l=>l.intensity);
|
|
|
|
/* ── 目标柜灯带:必须外挂。近景 40 台已被 GLB 顶替,其 LED 材质是所有实例共享的一份,
|
|
无法逐台调 ⇒ 「单柜长明」只能靠叠一层我们自己的发光片。 ── */
|
|
const decisionMat = new THREE.MeshBasicMaterial({ color:AMBER, toneMapped:false, transparent:true, opacity:0 });
|
|
const decisionStrips = new THREE.Group();
|
|
for (const y of TARGET.ys) {
|
|
const m = new THREE.Mesh(new THREE.PlaneGeometry(0.46,0.032), decisionMat);
|
|
m.position.set(TARGET.x, y, TARGET.z); m.rotation.y = -Math.PI/2;
|
|
decisionStrips.add(m);
|
|
}
|
|
scene.add(decisionStrips);
|
|
|
|
/* 整面薄光:只点三条灯带在 5m 外读成「一点橘」,整面微亮才读成「这一台被选中」 */
|
|
const decisionPlate = new THREE.MeshBasicMaterial({
|
|
color:AMBER, toneMapped:false, transparent:true, opacity:0,
|
|
blending:THREE.AdditiveBlending, depthWrite:false,
|
|
});
|
|
{
|
|
const p = new THREE.Mesh(new THREE.PlaneGeometry(0.62,1.96), decisionPlate);
|
|
p.position.set(TARGET.x-0.006, 1.02, TARGET.z+0.01); p.rotation.y = -Math.PI/2;
|
|
scene.add(p);
|
|
}
|
|
|
|
const glowTex = (() => {
|
|
const cv=document.createElement('canvas'); cv.width=cv.height=128;
|
|
const g=cv.getContext('2d');
|
|
const rg=g.createRadialGradient(64,64,2,64,64,64);
|
|
rg.addColorStop(0,'rgba(255,255,255,.95)');
|
|
rg.addColorStop(.35,'rgba(255,190,110,.35)');
|
|
rg.addColorStop(1,'rgba(0,0,0,0)');
|
|
g.fillStyle=rg; g.fillRect(0,0,128,128);
|
|
const t=new THREE.CanvasTexture(cv); t.colorSpace=THREE.SRGBColorSpace; return t;
|
|
})();
|
|
const decisionGlow = new THREE.MeshBasicMaterial({
|
|
color:AMBER, map:glowTex, toneMapped:false, transparent:true, opacity:0,
|
|
blending:THREE.AdditiveBlending, depthWrite:false,
|
|
});
|
|
{
|
|
const g = new THREE.Mesh(new THREE.PlaneGeometry(1.6,1.5), decisionGlow);
|
|
g.position.set(TARGET.x-0.02, 1.06, TARGET.z); g.rotation.y=-Math.PI/2; scene.add(g);
|
|
}
|
|
|
|
/* ═══════════ 真实机柜资产(CC0) ═══════════ */
|
|
const darken = (src) => {
|
|
const c = src.clone();
|
|
if (/led/i.test(c.name||'')) { c.toneMapped=false; if (c.color) c.color.multiplyScalar(.3); return c; }
|
|
if (c.color) c.color.multiplyScalar(.09);
|
|
if (typeof c.roughness==='number') c.roughness = Math.min(1, c.roughness+.12);
|
|
if (typeof c.metalness==='number') c.metalness = Math.max(0, c.metalness-.08);
|
|
return c;
|
|
};
|
|
const rackTransform = (side,i,t) => t.compose(
|
|
new THREE.Vector3(side===0?-2.05:2.05, 0, 6-i*RACK_STEP),
|
|
new THREE.Quaternion().setFromEuler(new THREE.Euler(0, side===0?Math.PI/2:-Math.PI/2, 0)),
|
|
new THREE.Vector3(1,1,1),
|
|
);
|
|
async function loadRealRacks() {
|
|
const gltf = await new GLTFLoader().loadAsync('/public/models/server-rack.glb');
|
|
gltf.scene.updateMatrixWorld(true);
|
|
const parts = [];
|
|
gltf.scene.traverse((o) => {
|
|
if (!o.isMesh) return;
|
|
if (/led_glow/i.test(o.name)) return;
|
|
const mat = Array.isArray(o.material) ? o.material[0] : o.material;
|
|
if (!mat) return;
|
|
parts.push({ geometry:o.geometry, material:darken(mat), local:o.matrixWorld.clone() });
|
|
});
|
|
if (!parts.length) return;
|
|
for (const p of parts) {
|
|
const inst = new THREE.InstancedMesh(p.geometry, p.material, REAL_PER_SIDE*2);
|
|
let n=0;
|
|
for (let side=0;side<2;side++) for (let i=0;i<REAL_PER_SIDE;i++) {
|
|
rackTransform(side,i,m4).multiply(p.local); inst.setMatrixAt(n++, m4);
|
|
}
|
|
inst.instanceMatrix.needsUpdate = true; scene.add(inst);
|
|
|
|
const fi2 = new THREE.InstancedMesh(p.geometry, p.material, COL*ROW);
|
|
let fn=0;
|
|
for (let c=0;c<COL;c++) for (let r=0;r<ROW;r++) {
|
|
m4.makeTranslation((c-(COL-1)/2)*GAP, 0, -8-r*GAP); fi2.setMatrixAt(fn++, m4);
|
|
}
|
|
fi2.instanceMatrix.needsUpdate = true; farm.add(fi2);
|
|
}
|
|
for (let side=0;side<2;side++) for (let i=0;i<REAL_PER_SIDE;i++) {
|
|
m4.makeScale(0,0,0);
|
|
racks.setMatrixAt(side*RACK_COUNT+i, m4);
|
|
for (let k=0;k<LED_PER_RACK;k++) leds.setMatrixAt(side*RACK_COUNT*LED_PER_RACK+i*LED_PER_RACK+k, m4);
|
|
}
|
|
racks.instanceMatrix.needsUpdate = true;
|
|
leds.instanceMatrix.needsUpdate = true;
|
|
farmRacks.visible = false;
|
|
}
|
|
|
|
/* ══════════════════ 决策内容物(三个模型共享的零件库) ══════════════════ */
|
|
const stripeTex = () => {
|
|
const cv=document.createElement('canvas'); cv.width=8; cv.height=128;
|
|
const g=cv.getContext('2d');
|
|
g.fillStyle='#000'; g.fillRect(0,0,8,128);
|
|
const grd=g.createLinearGradient(0,0,0,128);
|
|
grd.addColorStop(0,'rgba(120,210,255,0)');
|
|
grd.addColorStop(.5,'rgba(190,240,255,1)');
|
|
grd.addColorStop(1,'rgba(120,210,255,0)');
|
|
g.fillStyle=grd; g.fillRect(0,0,8,128);
|
|
const t=new THREE.CanvasTexture(cv);
|
|
t.wrapS=t.wrapT=THREE.RepeatWrapping; t.colorSpace=THREE.SRGBColorSpace;
|
|
return t;
|
|
};
|
|
|
|
/* V1 数据格:8 格贴在右排柜面(视线可见侧,且不被左侧压暗吃掉),逐格点亮=累积 */
|
|
const gate = { cells:[], gateFrame:null, farmThresh:null };
|
|
{
|
|
const geo = new THREE.PlaneGeometry(0.5, 0.5);
|
|
for (let i=0;i<8;i++) {
|
|
const mat = new THREE.MeshBasicMaterial({ color:0x0d1a28, toneMapped:false });
|
|
const m = new THREE.Mesh(geo, mat);
|
|
m.position.set(1.503, 1.15, 1.4 - i*0.66);
|
|
m.rotation.y = -Math.PI/2;
|
|
m.visible = false;
|
|
scene.add(m);
|
|
gate.cells.push(m);
|
|
}
|
|
/* 闸门:四根发光条围成的门。0.05 厚在 12m 外只剩 1px,实测等于没有 */
|
|
const frameMat = new THREE.MeshBasicMaterial({ color:0x2f6bff, toneMapped:false, transparent:true, opacity:.8, blending:THREE.AdditiveBlending, depthWrite:false });
|
|
const gf = new THREE.Group();
|
|
for (const [x, y, w, h] of [[-1.62,1.05,0.16,2.1],[1.62,1.05,0.16,2.1],[0,2.08,3.4,0.16]]) {
|
|
const bar = new THREE.Mesh(new THREE.BoxGeometry(w, h, 0.16), frameMat);
|
|
bar.position.set(x, y, 0); gf.add(bar);
|
|
}
|
|
gf.position.set(0, 0, -5.4); gf.visible = false;
|
|
scene.add(gf);
|
|
gate.gateFrame = gf; gate.frameMat = frameMat;
|
|
|
|
const ftMat = new THREE.MeshBasicMaterial({ color:0x2f6bff, toneMapped:false, transparent:true, opacity:.6, blending:THREE.AdditiveBlending, depthWrite:false });
|
|
/* 俯视档的闸线必须浮到柜顶之上:放在地面会被 2m 高的机柜整片遮住(实测) */
|
|
const ft = new THREE.Mesh(new THREE.BoxGeometry(9.4, 0.05, 0.09), ftMat);
|
|
ft.position.set(0, FARM_Y+2.06, -12.2); ft.visible = false;
|
|
scene.add(ft);
|
|
gate.farmThresh = ft; gate.farmThreshMat = ftMat;
|
|
}
|
|
|
|
/* V2 候选:走廊右排 6 台机柜各挂一个评估框 + 俯视图里 6 个候选格 */
|
|
const pick = { frames:[], marks:[], candIdx:[8,12,16,20,24,28] };
|
|
{
|
|
for (const i of pick.candIdx) {
|
|
const mat = new THREE.LineBasicMaterial({ color:0x4f8dff, transparent:true, opacity:0 });
|
|
const f = new THREE.LineSegments(new THREE.EdgesGeometry(new THREE.BoxGeometry(0.68, 2.02, 1.16)), mat);
|
|
f.position.set(2.05, 1.01, 6-i*RACK_STEP);
|
|
f.visible = false; scene.add(f);
|
|
pick.frames.push({ mesh:f, mat });
|
|
}
|
|
const pairs = [[0,1],[2,3],[4,2],[1,6],[3,8],[5,5]];
|
|
for (const [c,r] of pairs) {
|
|
const mat = new THREE.MeshBasicMaterial({ color:0x4f8dff, toneMapped:false, transparent:true, opacity:0, blending:THREE.AdditiveBlending, depthWrite:false });
|
|
const m = new THREE.Mesh(new THREE.PlaneGeometry(0.95,0.95), mat);
|
|
m.rotation.x = -Math.PI/2;
|
|
/* 贴柜顶而不是地面:地面候选格会被机柜自身遮挡,俯视档等于看不见 */
|
|
m.position.set((c-(COL-1)/2)*GAP, FARM_Y+2.04, -8-r*GAP);
|
|
m.visible = false; scene.add(m);
|
|
pick.marks.push({ mesh:m, mat });
|
|
}
|
|
}
|
|
|
|
/* V3 路径:走廊地面 3 条 + 俯视阵列地面 3 条,都是「流动的光带」 */
|
|
const pathV = { corridor:[], farmP:[] };
|
|
{
|
|
const corridorX = [-0.15, 0.65, 1.45];
|
|
const farmX = [-2.3, 0, 2.3];
|
|
for (let i=0;i<3;i++) {
|
|
const tex = stripeTex(); tex.repeat.set(1, 14);
|
|
const mat = new THREE.MeshBasicMaterial({ map:tex, color:0x7fd4ff, toneMapped:false, transparent:true, opacity:0, blending:THREE.AdditiveBlending, depthWrite:false });
|
|
const m = new THREE.Mesh(new THREE.BoxGeometry(0.16, 0.012, 26), mat);
|
|
m.position.set(corridorX[i], 0.02, -6);
|
|
m.visible = false; scene.add(m);
|
|
pathV.corridor.push({ mesh:m, mat, tex });
|
|
|
|
const ftex = stripeTex(); ftex.repeat.set(1, 10);
|
|
const fmat = new THREE.MeshBasicMaterial({ map:ftex, color:0x7fd4ff, toneMapped:false, transparent:true, opacity:0, blending:THREE.AdditiveBlending, depthWrite:false });
|
|
/* 俯视档的路径走「通道」而不是柜顶:通道本身就是阵列里的负空间,从上方看最清楚 */
|
|
const fm = new THREE.Mesh(new THREE.BoxGeometry(0.34, 0.012, 12.6), fmat);
|
|
fm.position.set(farmX[i], FARM_Y+0.09, -13.3);
|
|
fm.visible = false; scene.add(fm);
|
|
pathV.farmP.push({ mesh:fm, mat:fmat, tex:ftex });
|
|
}
|
|
}
|
|
|
|
/* ══════════════ 时间线 ══════════════ */
|
|
const tmpPos = new THREE.Vector3(), tmpTgt = new THREE.Vector3();
|
|
const easeK = (k) => k*k*(3-2*k);
|
|
function poseOf(shot, k, outPos, outTgt) {
|
|
const e = easeK(k);
|
|
outPos.set(
|
|
shot.from.pos[0]+(shot.to.pos[0]-shot.from.pos[0])*e,
|
|
shot.from.pos[1]+(shot.to.pos[1]-shot.from.pos[1])*e,
|
|
shot.from.pos[2]+(shot.to.pos[2]-shot.from.pos[2])*e);
|
|
outTgt.set(
|
|
shot.from.tgt[0]+(shot.to.tgt[0]-shot.from.tgt[0])*e,
|
|
shot.from.tgt[1]+(shot.to.tgt[1]-shot.from.tgt[1])*e,
|
|
shot.from.tgt[2]+(shot.to.tgt[2]-shot.from.tgt[2])*e);
|
|
}
|
|
function beatAt(t) {
|
|
let acc=0;
|
|
for (let i=0;i<SHOTS.length;i++) {
|
|
const s = SHOTS[i];
|
|
if (t < acc+s.ms) return { shot:s, k:(t-acc)/s.ms, dip:-1, prev:null };
|
|
acc += s.ms;
|
|
if (t < acc+DIP_MS) return { shot:SHOTS[(i+1)%SHOTS.length], k:0, dip:(t-acc)/DIP_MS, prev:s };
|
|
acc += DIP_MS;
|
|
}
|
|
return { shot:SHOTS[0], k:0, dip:-1, prev:null };
|
|
}
|
|
const smoothstep = (x,a,b) => { const t=Math.min(1,Math.max(0,(x-a)/(b-a))); return t*t*(3-2*t); };
|
|
|
|
/* ══════════════ 变体状态 ══════════════ */
|
|
let variant='gate', currentShotId='', playing=true, clockT=0, lastNow=performance.now();
|
|
let dimFactor=1;
|
|
|
|
function showOnly(map) {
|
|
const vis = (o, on) => { (o.mesh ?? o).visible = on; };
|
|
gate.cells.forEach(o => vis(o, map.gate));
|
|
gate.gateFrame.visible = map.gate;
|
|
gate.farmThresh.visible = false;
|
|
pick.frames.forEach(f => vis(f, map.pick));
|
|
pick.marks.forEach(m => vis(m, false));
|
|
pathV.corridor.forEach(p => vis(p, map.path));
|
|
pathV.farmP.forEach(p => vis(p, false));
|
|
if (variant !== 'pick') pick.frames.forEach(f => { f.mat.opacity = 0; });
|
|
if (variant !== 'path') pathV.corridor.forEach(p => { p.mat.opacity = 0; });
|
|
if (variant !== 'gate') gate.cells.forEach(c => { c.material.color.setHex(0x0d1a28); });
|
|
}
|
|
|
|
function setVariant(id) {
|
|
variant = id;
|
|
showOnly({ gate: id==='gate', pick: id==='pick', path: id==='path' });
|
|
for (const b of document.querySelectorAll('.vbtn')) b.classList.toggle('on', b.dataset.id===id);
|
|
}
|
|
|
|
/* 场景退暗 + 单柜长明:三个模型共用的「落定」语法 */
|
|
function applySettle(p) {
|
|
const d = 1 - 0.42*smoothstep(p, .42, 1);
|
|
dimFactor = d;
|
|
hemi.intensity = HEMI_BASE*d;
|
|
corridorLights.forEach((l,i)=>{ l.intensity = LIGHTS_BASE[i]*d; });
|
|
farmLights.forEach((l,i)=>{ l.intensity = FARM_LIGHTS_BASE[i]*d; });
|
|
const q = smoothstep(p, .45, .92);
|
|
decisionMat.opacity = q;
|
|
decisionPlate.opacity = 0.16*q;
|
|
decisionGlow.opacity = 0.42*smoothstep(p, .5, 1);
|
|
const c = new THREE.Color();
|
|
for (let n=0;n<ledCount;n++) {
|
|
c.setRGB(ledBase[n*3]*d, ledBase[n*3+1]*d, ledBase[n*3+2]*d);
|
|
leds.setColorAt(n, c);
|
|
}
|
|
if (leds.instanceColor) leds.instanceColor.needsUpdate = true;
|
|
skirtMat.color.setHex(0x16263a).multiplyScalar(d);
|
|
for (const m of aisleMats) m.color.setHex(0x2a4c6e).multiplyScalar(d);
|
|
}
|
|
|
|
/* ── V1 阈值触发 ──
|
|
内容:12 格数据逐格填满 → 闸门亮起 → 填满瞬间闸门闪白并触发唯一动作。
|
|
可指着说:「这是数据在攒」「这是判据线」「越过它就动了」。 */
|
|
const cCellOff = new THREE.Color(0x0d1a28), cCellOn = new THREE.Color(0x7fd4ff);
|
|
function updateGate(t, beat) {
|
|
const id = beat.shot.id;
|
|
gate.cells.forEach(c => { c.visible = true; });
|
|
gate.gateFrame.visible = true;
|
|
|
|
if (id === 's1-aisle') {
|
|
/* 8 格:k 走完时正好填满 → 填满即触发,不是「一直在填」 */
|
|
const n = Math.floor(beat.k * 9);
|
|
gate.cells.forEach((c,i) => {
|
|
c.material.color.copy(i < n ? cCellOn : cCellOff);
|
|
});
|
|
gate.frameMat.color.setHex(0x2f6bff);
|
|
gate.frameMat.opacity = 0.3 + 0.35*beat.k;
|
|
} else if (id === 's2-array') {
|
|
/* 俯视:整片阵列被读一遍,末端闸线在数据跑到头时闪白 */
|
|
gate.cells.forEach(c => { c.material.color.copy(cCellOn); });
|
|
const lit = smoothstep(beat.k, .15, .95);
|
|
aisleMats.forEach((m,i) => {
|
|
const reach = smoothstep(lit*8.6 - i, 0, 1);
|
|
m.color.setHex(0x2a4c6e).lerp(new THREE.Color(CYAN), reach*0.9);
|
|
});
|
|
gate.farmThresh.visible = true;
|
|
const flash = smoothstep(beat.k, .82, .95);
|
|
gate.farmThreshMat.color.setHex(0x2f6bff).lerp(new THREE.Color(0xffffff), flash);
|
|
gate.farmThreshMat.opacity = 0.35 + 0.65*flash;
|
|
} else {
|
|
gate.cells.forEach(c => { c.material.color.copy(cCellOn); });
|
|
/* 落定瞬间:闸门由蓝转白并常亮 —— 这是「触发」,不是「装饰」 */
|
|
const trig = smoothstep(beat.k, .55, .8);
|
|
gate.frameMat.color.setHex(0x2f6bff).lerp(new THREE.Color(0xffffff), trig);
|
|
gate.frameMat.opacity = 0.5 + 0.5*trig;
|
|
}
|
|
}
|
|
|
|
/* ── V2 候选筛选 ──
|
|
内容:6 个候选(右排 6 台柜的评估框)→ 俯视图里 6 个候选格 → 5 个逐个转灰熄灭 → 剩 1 个。 */
|
|
const cCand = new THREE.Color(0x4f8dff), cCandDead = new THREE.Color(0x2a2f38);
|
|
function updatePick(t, beat) {
|
|
const id = beat.shot.id;
|
|
const KEEP = 4; // candIdx[4] = i:24 ⇒ 正是目标柜
|
|
|
|
if (id === 's1-aisle') {
|
|
pick.frames.forEach((f,i) => {
|
|
f.mesh.visible = true;
|
|
const appear = smoothstep(beat.k, i*0.09, i*0.09+0.18);
|
|
f.mat.opacity = 0.75*appear;
|
|
f.mat.color.copy(cCand);
|
|
});
|
|
pick.frames.forEach(()=>{});
|
|
} else if (id === 's2-array') {
|
|
pick.frames.forEach(f => { f.mesh.visible = false; });
|
|
pick.marks.forEach((mk,i) => {
|
|
mk.mesh.visible = true;
|
|
/* 淘汰自 k=0.32 起,每 0.1 一轮;第 KEEP 个永不淘汰 */
|
|
const d = i === KEEP ? 0 : smoothstep(beat.k, 0.32 + i*0.09, 0.4 + i*0.09);
|
|
mk.mat.color.copy(cCand).lerp(cCandDead, d);
|
|
mk.mat.opacity = (1 - d*0.85) * 0.9;
|
|
});
|
|
} else {
|
|
pick.marks.forEach(mk => { mk.mesh.visible = false; });
|
|
pick.frames.forEach((f,i) => {
|
|
const alive = i === KEEP;
|
|
f.mesh.visible = alive || beat.k < 0.3;
|
|
f.mat.color.copy(alive ? new THREE.Color(AMBER) : cCandDead);
|
|
f.mat.opacity = alive ? (0.55 + 0.45*smoothstep(beat.k, .55, .85)) : (1-smoothstep(beat.k,0,.3))*0.35;
|
|
});
|
|
}
|
|
/* 锁定框永远跟着目标柜(V2 的「选定」由评估框本身承担) */
|
|
if (id === 's3-closeup') {
|
|
const p = smoothstep(beat.k, .5, .9);
|
|
pick.frames[KEEP].mat.opacity = 0.55 + 0.45*p;
|
|
}
|
|
}
|
|
|
|
/* ── V3 路径选择 ──
|
|
内容:3 条并行路径同时有数据在跑 → 俯视时 2 条先后熄灭 → 只剩 1 条通向目标柜。 */
|
|
function updatePath(t, beat, dt) {
|
|
const id = beat.shot.id;
|
|
const KEEP = 1;
|
|
pathV.corridor.forEach((p,i) => {
|
|
p.tex.offset.y -= dt * 0.6;
|
|
});
|
|
pathV.farmP.forEach((p) => { p.tex.offset.y -= dt * 0.5; });
|
|
|
|
if (id === 's1-aisle') {
|
|
pathV.corridor.forEach((p,i) => {
|
|
p.mesh.visible = true;
|
|
const exist = smoothstep(beat.k, i*0.08, i*0.08+0.2);
|
|
const dying = i === KEEP ? 0 : smoothstep(beat.k, .72 + i*0.05, .92 + i*0.05);
|
|
p.mat.opacity = 0.9*exist*(1-dying*0.92);
|
|
p.mesh.visible = p.mat.opacity > 0.02;
|
|
});
|
|
pathV.farmP.forEach(p => { p.mesh.visible = false; });
|
|
} else if (id === 's2-array') {
|
|
pathV.corridor.forEach(p => { p.mesh.visible = false; });
|
|
pathV.farmP.forEach((p,i) => {
|
|
p.mesh.visible = true;
|
|
const dying = i === KEEP ? 0 : smoothstep(beat.k, .28 + (i===0?0:.18), .46 + (i===0?0:.18));
|
|
p.mat.opacity = 0.85*(1-dying*0.95);
|
|
p.mesh.visible = p.mat.opacity > 0.02;
|
|
});
|
|
} else {
|
|
pathV.farmP.forEach(p => { p.mesh.visible = false; });
|
|
pathV.corridor.forEach((p,i) => {
|
|
p.mesh.visible = i === KEEP;
|
|
p.mat.opacity = i === KEEP ? 0.9 : 0;
|
|
});
|
|
}
|
|
}
|
|
|
|
/* ══════════════ 主循环 ══════════════ */
|
|
const roShot=document.getElementById('ro-shot'), roK=document.getElementById('ro-k'), roT=document.getElementById('ro-t');
|
|
function frame(now) {
|
|
const dt = Math.min(0.05, (now-lastNow)/1000); lastNow = now;
|
|
if (playing) clockT = (clockT + dt*1000) % CYCLE_MS;
|
|
|
|
const beat = beatAt(clockT);
|
|
let k = beat.k;
|
|
if (beat.shot.id === 's3-closeup') k = Math.min(1, k/S3_SETTLE);
|
|
|
|
if (beat.dip >= 0) {
|
|
if (beat.dip < 0.5) { poseOf(beat.prev, 1, tmpPos, tmpTgt); veil.style.opacity = String(Math.min(1, beat.dip*2)); }
|
|
else { poseOf(beat.shot, 0, tmpPos, tmpTgt); veil.style.opacity = String(Math.max(0, (1-beat.dip)*2)); }
|
|
} else {
|
|
poseOf(beat.shot, k, tmpPos, tmpTgt); veil.style.opacity = '0';
|
|
}
|
|
camera.position.copy(tmpPos); camera.lookAt(tmpTgt);
|
|
|
|
applySettle(beat.shot.id === 's3-closeup' ? k : 0);
|
|
|
|
if (variant === 'gate') updateGate(clockT, beat);
|
|
else if (variant === 'pick') updatePick(clockT, beat);
|
|
else if (variant === 'path') updatePath(clockT, beat, dt);
|
|
|
|
renderer.render(scene, camera);
|
|
|
|
if (beat.shot.id !== currentShotId) {
|
|
currentShotId = beat.shot.id;
|
|
const cap = CAPTIONS[currentShotId];
|
|
document.getElementById('cap-label').textContent = cap.label;
|
|
document.getElementById('cap-detail').textContent = cap.detail;
|
|
roShot.textContent = currentShotId;
|
|
}
|
|
roK.textContent = k.toFixed(2);
|
|
roT.textContent = (clockT/1000).toFixed(1)+'s';
|
|
document.getElementById('tl').value = String(Math.round(clockT));
|
|
requestAnimationFrame(frame);
|
|
}
|
|
|
|
/* ══════════════ UI ══════════════ */
|
|
const wrap = document.getElementById('variants');
|
|
VARIANTS.forEach((v,i) => {
|
|
const b = document.createElement('button');
|
|
b.className='vbtn'; b.dataset.id=v.id;
|
|
b.innerHTML = `<b><span class="k">${i+1}</span>${v.name}</b><em>${v.desc}</em>`;
|
|
b.onclick = () => setVariant(v.id);
|
|
wrap.appendChild(b);
|
|
});
|
|
const tl = document.getElementById('tl');
|
|
tl.addEventListener('input', () => { clockT = Number(tl.value); playing = false; syncPlay(); });
|
|
const btnPlay = document.getElementById('btn-play');
|
|
function syncPlay(){ btnPlay.textContent = playing ? '暂停' : '播放'; }
|
|
btnPlay.onclick = () => { playing = !playing; syncPlay(); };
|
|
document.getElementById('btn-settle').onclick = () => { clockT = T_SETTLE; playing=false; syncPlay(); };
|
|
let copyOn = true;
|
|
document.getElementById('btn-copy').onclick = () => {
|
|
copyOn = !copyOn;
|
|
document.getElementById('copy').style.opacity = copyOn ? '1':'0';
|
|
document.getElementById('scrim').style.opacity = copyOn ? '1':'.25';
|
|
};
|
|
window.addEventListener('keydown', (e) => {
|
|
const n = Number(e.key);
|
|
if (n>=1 && n<=VARIANTS.length) setVariant(VARIANTS[n-1].id);
|
|
if (e.code === 'Space') { e.preventDefault(); playing = !playing; syncPlay(); }
|
|
});
|
|
window.addEventListener('resize', () => {
|
|
const w=host.clientWidth, h=host.clientHeight; if (!w||!h) return;
|
|
renderer.setSize(w,h,false); camera.aspect=w/h; camera.updateProjectionMatrix();
|
|
});
|
|
|
|
/* ══════════════ 启动 ══════════════ */
|
|
poseOf(SHOTS[0], .5, tmpPos, tmpTgt);
|
|
camera.position.copy(tmpPos); camera.lookAt(tmpTgt);
|
|
setVariant('gate');
|
|
loadRealRacks().catch(()=>{});
|
|
requestAnimationFrame(frame);
|
|
</script>
|
|
</body>
|
|
</html>
|