独立渲染引擎就绪引擎就绪
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>深海软泥底盘“轻触底”协同行走原理演示</title>
<style>
:root {
--bg-abyss: #040810;
--bg-panel: rgba(8, 18, 34, 0.72);
--border-panel: rgba(0, 240, 255, 0.22);
--cyan-glow: #00f0ff;
--green-thrust: #00ff9d;
--amber-buoyancy: #ffbe3b;
--text-muted: #627d98;
--text-main: #d9e2ec;
--font-mono: "SF Mono", "JetBrains Mono", Consolas, "Courier New", monospace;
}
* {
box-sizing: border-box;
margin: 0;
padding: 0;
user-select: none;
}
body {
background-color: var(--bg-abyss);
color: var(--text-main);
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", sans-serif;
overflow: hidden;
width: 100vw;
height: 100vh;
display: flex;
flex-direction: column;
position: relative;
}
/* 背景深海光影微噪感 */
.ocean-atmosphere {
position: absolute;
inset: 0;
background: radial-gradient(circle at 50% 20%, rgba(0, 72, 112, 0.28) 0%, rgba(2, 6, 13, 0.95) 75%);
pointer-events: none;
z-index: 0;
}
/* 顶部边缘简报条:严格控制字号与厚度,绝不遮挡核心区 */
header {
position: absolute;
top: 0;
left: 0;
right: 0;
height: 46px;
padding: 0 24px;
display: flex;
align-items: center;
justify-content: space-between;
border-bottom: 1px solid rgba(255, 255, 255, 0.06);
background: linear-gradient(180deg, rgba(5, 11, 22, 0.85) 0%, transparent 100%);
z-index: 20;
}
.brand-title {
display: flex;
align-items: center;
gap: 10px;
font-size: 13px;
letter-spacing: 0.8px;
font-weight: 600;
color: #e2e8f0;
}
.brand-badge {
display: inline-block;
padding: 2px 7px;
font-size: 10px;
border-radius: 2px;
background: rgba(0, 240, 255, 0.12);
border: 1px solid var(--cyan-glow);
color: var(--cyan-glow);
font-family: var(--font-mono);
font-weight: 500;
}
.top-telemetry {
display: flex;
gap: 20px;
font-family: var(--font-mono);
font-size: 11px;
color: var(--text-muted);
}
.tele-item span {
color: var(--cyan-glow);
font-weight: 600;
}
/* 主视觉视口容器 */
.viewport-container {
position: relative;
flex: 1;
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
z-index: 10;
}
svg#mainCanvas {
width: 100%;
height: 100%;
max-width: 1400px;
max-height: 820px;
display: block;
}
/* 四周轻量化边角 HUD 浮动层(小字号,避开中央底盘) */
.corner-hud {
position: absolute;
padding: 10px 14px;
background: var(--bg-panel);
backdrop-filter: blur(8px);
border: 1px solid var(--border-panel);
border-radius: 4px;
font-size: 11px;
line-height: 1.5;
z-index: 25;
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
pointer-events: auto;
}
.corner-top-right {
top: 56px;
right: 20px;
width: 210px;
}
.corner-bottom-left {
bottom: 20px;
left: 20px;
width: 260px;
}
.hud-title {
font-size: 10px;
font-weight: 700;
color: var(--cyan-glow);
text-transform: uppercase;
letter-spacing: 1px;
margin-bottom: 6px;
display: flex;
justify-content: space-between;
align-items: center;
border-bottom: 1px solid rgba(255, 255, 255, 0.08);
padding-bottom: 3px;
}
.hud-row {
display: flex;
justify-content: space-between;
margin: 3px 0;
color: var(--text-muted);
}
.hud-val {
font-family: var(--font-mono);
font-weight: 600;
color: var(--text-main);
}
.legend-tag {
display: inline-flex;
align-items: center;
gap: 6px;
margin: 2px 0;
font-size: 11px;
}
.dot {
width: 8px;
height: 8px;
border-radius: 50%;
}
/* 底部交互控制条:极简透明条 */
.bottom-bar {
position: absolute;
bottom: 18px;
right: 20px;
display: flex;
align-items: center;
gap: 12px;
background: var(--bg-panel);
padding: 6px 14px;
border-radius: 20px;
border: 1px solid var(--border-panel);
z-index: 30;
}
.mode-btn {
background: transparent;
border: 1px solid rgba(0, 240, 255, 0.2);
color: var(--text-muted);
font-size: 11px;
padding: 4px 10px;
border-radius: 12px;
cursor: pointer;
transition: all 0.25s ease;
font-family: var(--font-mono);
}
.mode-btn.active, .mode-btn:hover {
background: rgba(0, 240, 255, 0.15);
border-color: var(--cyan-glow);
color: #fff;
box-shadow: 0 0 10px rgba(0, 240, 255, 0.3);
}
.slider-wrap {
display: flex;
align-items: center;
gap: 8px;
font-size: 11px;
color: var(--text-muted);
font-family: var(--font-mono);
}
input[type=range] {
appearance: none;
-webkit-appearance: none;
width: 80px;
height: 3px;
background: #1c2e44;
border-radius: 2px;
outline: none;
}
input[type=range]::-webkit-slider-thumb {
-webkit-appearance: none;
width: 11px;
height: 11px;
border-radius: 50%;
background: var(--cyan-glow);
cursor: pointer;
box-shadow: 0 0 6px var(--cyan-glow);
}
</style>
</head>
<body>
<div class="ocean-atmosphere"></div>
<!-- 顶部轻量状态栏 -->
<header>
<div class="brand-title">
<span class="brand-badge">IFR-DESIGN</span>
<span>深水低比压底盘 · 浮力/涵道推力协同“轻触底”系统</span>
</div>
<div class="top-telemetry">
<div class="tele-item">海流抗击: <span id="teleCurrent">0.82 kn</span></div>
<div class="tele-item">淤泥基底类型: <span>深海高含水超软粘土</span></div>
<div class="tele-item">运行状态: <span style="color:var(--green-thrust);">轻触巡航 (FEATHER TOUCH)</span></div>
</div>
</header>
<!-- 右上角传感器仪表:极小字号HUD -->
<aside class="corner-hud corner-top-right">
<div class="hud-title">
<span>力学平衡遥测</span>
<span style="color:#00ff9d">AUTO-STABLE</span>
</div>
<div class="hud-row">
<span>接地比压 (P):</span>
<span class="hud-val" id="dispPressure" style="color:#00f0ff;">3.20 kPa</span>
</div>
<div class="hud-row">
<span>净可调浮力 (B):</span>
<span class="hud-val" id="dispBuoyancy">+52.0 kg</span>
</div>
<div class="hud-row">
<span>四涵道总推力:</span>
<span class="hud-val" id="dispThrust">360 N</span>
</div>
<div class="hud-row">
<span>淤泥下陷深度:</span>
<span class="hud-val" style="color:#00ff9d;">≤ 12 mm (理想沉陷)</span>
</div>
</aside>
<!-- 左下角图例解析:精简置底 -->
<aside class="corner-hud corner-bottom-left">
<div class="hud-title">
<span>破除矛盾:最终理想解 (IFR) 机理</span>
</div>
<div class="legend-tag">
<span class="dot" style="background:var(--amber-buoyancy); box-shadow:0 0 5px var(--amber-buoyancy);"></span>
<span>浮力包承担约85%自重,消除致命下陷</span>
</div>
<div class="legend-tag">
<span class="dot" style="background:var(--green-thrust); box-shadow:0 0 5px var(--green-thrust);"></span>
<span>四角涵道矢向下压 & 侧推,消除漂浮失稳</span>
</div>
<div class="legend-tag">
<span class="dot" style="background:var(--cyan-glow); box-shadow:0 0 5px var(--cyan-glow);"></span>
<span>宽履带仅提供轻柔牵引,实现雪上飞效果</span>
</div>
</aside>
<!-- 居中高保真核心 SVG 视口(占据90%无遮挡画面) -->
<main class="viewport-container">
<svg id="mainCanvas" viewBox="0 0 1000 600" preserveAspectRatio="xMidYMid meet">
<defs>
<!-- 淤泥渐变与高含水表面滤镜 -->
<linearGradient id="mudGradient" x1="0" y1="0" x2="0" y2="1">
<stop offset="0%" stop-color="#243828" stop-opacity="0.8" />
<stop offset="6%" stop-color="#19281f" stop-opacity="0.95" />
<stop offset="25%" stop-color="#0f1915" />
<stop offset="100%" stop-color="#070c09" />
</linearGradient>
<linearGradient id="fluidSiltLayer" x1="0" y1="0" x2="0" y2="1">
<stop offset="0%" stop-color="#2ed8a7" stop-opacity="0.35" />
<stop offset="100%" stop-color="#143026" stop-opacity="0.0" />
</linearGradient>
<!-- 浮力与推力光效滤镜 -->
<filter id="neonGlow" x="-30%" y="-30%" width="160%" height="160%">
<feGaussianBlur stdDeviation="3.5" result="blur" />
<feMerge>
<feMergeNode in="blur" />
<feMergeNode in="SourceGraphic" />
</feMerge>
</filter>
<filter id="vectorPulse" x="-20%" y="-20%" width="140%" height="140%">
<feGaussianBlur stdDeviation="2" result="blur" />
<feMerge>
<feMergeNode in="blur" />
<feMergeNode in="SourceGraphic" />
</feMerge>
</filter>
<!-- 涵道尾喷水流渐变 -->
<linearGradient id="thrustJetGrad" x1="0" y1="0" x2="0" y2="1">
<stop offset="0%" stop-color="#00ff9d" stop-opacity="0.95" />
<stop offset="50%" stop-color="#00f0ff" stop-opacity="0.45" />
<stop offset="100%" stop-color="#004870" stop-opacity="0" />
</linearGradient>
<!-- 浮力向上力场渐变 -->
<linearGradient id="buoyancyGrad" x1="0" y1="1" x2="0" y2="0">
<stop offset="0%" stop-color="#ffaa00" stop-opacity="0.85" />
<stop offset="60%" stop-color="#ffd56b" stop-opacity="0.4" />
<stop offset="100%" stop-color="#ffffff" stop-opacity="0" />
</linearGradient>
<!-- 底盘机械金属渐变 -->
<linearGradient id="hullMetal" x1="0" y1="0" x2="1" y2="1">
<stop offset="0%" stop-color="#2a3f5a" />
<stop offset="50%" stop-color="#19283c" />
<stop offset="100%" stop-color="#0e1724" />
</linearGradient>
<linearGradient id="podGlass" x1="0" y1="0" x2="0" y2="1">
<stop offset="0%" stop-color="rgba(0, 240, 255, 0.4)" />
<stop offset="60%" stop-color="rgba(0, 100, 150, 0.15)" />
<stop offset="100%" stop-color="rgba(0, 240, 255, 0.3)" />
</linearGradient>
<pattern id="gridSubsea" width="40" height="40" patternUnits="userSpaceOnUse">
<path d="M 40 0 L 0 0 0 40" fill="none" stroke="rgba(0, 240, 255, 0.04)" stroke-width="1" />
</pattern>
</defs>
<!-- 1. 背景参考坐标网格 -->
<rect x="0" y="0" width="1000" height="600" fill="url(#gridSubsea)" />
<!-- 2. 海流矢量流线 (Ocean Current Field: 从左往右冲击) -->
<g id="currentFlowField" opacity="0.45">
<!-- 动态海流虚线通过CSS连续向右流动 -->
</g>
<!-- 3. 底层超软淤泥地层与动态微触受力面 -->
<g id="seabedGroup">
<!-- 深层硬土 -->
<rect x="0" y="475" width="1000" height="125" fill="url(#mudGradient)" />
<!-- 极软富水流塑表层 (15-20mm超软流质层) -->
<rect x="0" y="468" width="1000" height="18" fill="url(#fluidSiltLayer)" />
<!-- 履带压印微触线:只有微弱的3~4px变形,展示“极轻触底,绝不下陷” -->
<path id="mudSurfaceLine" d="M 0 472 L 240 472 Q 260 475 285 475 L 715 475 Q 740 472 760 472 L 1000 472"
fill="none" stroke="#2ed8a7" stroke-width="2.5" opacity="0.8" filter="url(#vectorPulse)" />
<!-- 淤泥应力云纹分布 (微小接触应力散布扩散弧) -->
<g id="stressArcs" opacity="0.6">
<path d="M 310 476 Q 340 488 370 476" stroke="#00f0ff" stroke-width="1.2" fill="none" stroke-dasharray="2,2"/>
<path d="M 470 476 Q 500 488 530 476" stroke="#00f0ff" stroke-width="1.2" fill="none" stroke-dasharray="2,2"/>
<path d="M 630 476 Q 660 488 690 476" stroke="#00f0ff" stroke-width="1.2" fill="none" stroke-dasharray="2,2"/>
<text x="500" y="500" fill="#2ed8a7" font-size="10" font-family="var(--font-mono)" text-anchor="middle" letter-spacing="1">
软泥界面接触应力扩散带 (极低比压: 2.8~3.5 kPa)
</text>
</g>
</g>
<!-- 4. 浮力光羽与力矢量场(向上升腾) -->
<g id="buoyancyField">
<!-- 左右可变浮力舱向上发射的动态浮力场波束 -->
<polygon id="buoyancyBeamLeft" points="330,300 370,180 430,180 450,300" fill="url(#buoyancyGrad)" opacity="0.5" />
<polygon id="buoyancyBeamRight" points="550,300 570,180 630,180 670,300" fill="url(#buoyancyGrad)" opacity="0.5" />
<!-- 向上浮力主矢量光箭 (大箭头,代表抵消85%自重) -->
<g id="mainBuoyancyVector" transform="translate(500, 220)">
<line x1="0" y1="70" x2="0" y2="-60" stroke="#ffbe3b" stroke-width="4.5" stroke-linecap="round" filter="url(#neonGlow)"/>
<polygon points="0,-75 -8,-55 8,-55" fill="#ffbe3b" filter="url(#neonGlow)" />
<text x="14" y="-20" fill="#ffbe3b" font-size="11" font-weight="700" font-family="var(--font-mono)">
F_浮力 (+85% 重力平衡)
</text>
</g>
</g>
<!-- 5. 主机底盘总成 (ROV / Trenching Chassis) -->
<g id="crawlerChassis" transform="translate(0, 0)">
<!-- A. 履带推进单元 (宽幅低接地比压履带组) -->
<g id="trackModule">
<!-- 左右主履带环体 (长圆轮廓) -->
<rect x="270" y="420" width="460" height="54" rx="27" fill="#121d2b" stroke="#334d6e" stroke-width="3" />
<!-- 履带板防滑齿连续传送纹理 (利用 stroke-dasharray 做滚动动效) -->
<rect id="trackTreads" x="270" y="420" width="460" height="54" rx="27"
fill="none" stroke="#00f0ff" stroke-width="5" stroke-dasharray="14 10" opacity="0.75" />
<!-- 履带负重驱动轮系 -->
<!-- 驱动主轮(前) -->
<circle cx="300" cy="447" r="20" fill="#1e2c3f" stroke="#486581" stroke-width="2.5" />
<circle cx="300" cy="447" r="7" fill="#00f0ff" opacity="0.8" />
<line x1="300" y1="427" x2="300" y2="467" stroke="#486581" stroke-width="2" class="spin-wheel" />
<!-- 中部支重轮组(5联排) -->
<g id="roadWheels" fill="#172233" stroke="#334e68" stroke-width="2">
<circle cx="370" cy="451" r="15" />
<circle cx="435" cy="451" r="15" />
<circle cx="500" cy="451" r="15" />
<circle cx="565" cy="451" r="15" />
<circle cx="630" cy="451" r="15" />
</g>
<!-- 驱动从动轮(后) -->
<circle cx="700" cy="447" r="20" fill="#1e2c3f" stroke="#486581" stroke-width="2.5" />
<circle cx="700" cy="447" r="7" fill="#00f0ff" opacity="0.8" />
<line x1="700" y1="427" x2="700" y2="467" stroke="#486581" stroke-width="2" class="spin-wheel" />
<!-- 履带压力微分布传感器触点灯 -->
<g fill="#00ff9d" opacity="0.9">
<circle cx="340" cy="474" r="2" />
<circle cx="400" cy="474" r="2" />
<circle cx="460" cy="474" r="2" />
<circle cx="520" cy="474" r="2" />
<circle cx="580" cy="474" r="2" />
<circle cx="640" cy="474" r="2" />
</g>
</g>
<!-- B. 钛合金刚性主梁底盘骨架 -->
<path d="M 310 420 L 340 340 L 660 340 L 690 420 Z" fill="url(#hullMetal)" stroke="#3e5a7c" stroke-width="2.5" />
<rect x="350" y="348" width="300" height="20" rx="3" fill="#101926" stroke="#25384e" stroke-width="1.5" />
<!-- C. 双侧智能充排油式可变浮力舱 (Variable Buoyancy Pods) -->
<!-- 左浮力舱 -->
<g id="buoyancyPodLeft" transform="translate(330, 270)">
<rect x="0" y="0" width="115" height="66" rx="14" fill="#0c1624" stroke="#ffbe3b" stroke-width="2" filter="url(#vectorPulse)" />
<!-- 舱内液压活塞/油囊与浮力液透视 -->
<rect id="oilLevelLeft" x="6" y="16" width="103" height="42" rx="8" fill="rgba(255, 190, 59, 0.28)" />
<!-- 活塞推进滑块 -->
<line id="pistonShaftL" x1="20" y1="37" x2="80" y2="37" stroke="#ffbe3b" stroke-width="3" stroke-dasharray="4,2" />
<text x="57" y="42" fill="#ffd56b" font-size="9" font-family="var(--font-mono)" text-anchor="middle" font-weight="600">
FLOAT-POD A
</text>
<text x="57" y="54" fill="#829ab1" font-size="7.5" font-family="var(--font-mono)" text-anchor="middle">
±60kg 液压排量
</text>
</g>
<!-- 右浮力舱 -->
<g id="buoyancyPodRight" transform="translate(555, 270)">
<rect x="0" y="0" width="115" height="66" rx="14" fill="#0c1624" stroke="#ffbe3b" stroke-width="2" filter="url(#vectorPulse)" />
<rect id="oilLevelRight" x="6" y="16" width="103" height="42" rx="8" fill="rgba(255, 190, 59, 0.28)" />
<line id="pistonShaftR" x1="20" y1="37" x2="80" y2="37" stroke="#ffbe3b" stroke-width="3" stroke-dasharray="4,2" />
<text x="57" y="42" fill="#ffd56b" font-size="9" font-family="var(--font-mono)" text-anchor="middle" font-weight="600">
FLOAT-POD B
</text>
<text x="57" y="54" fill="#829ab1" font-size="7.5" font-family="var(--font-mono)" text-anchor="middle">
对称双向平衡
</text>
</g>
<!-- 中央高压液压双向泵组与控制阀块 -->
<rect x="465" y="285" width="70" height="48" rx="5" fill="#1b2838" stroke="#00f0ff" stroke-width="1.5" />
<circle cx="500" cy="305" r="10" fill="#0e1724" stroke="#00f0ff" stroke-width="1.2" />
<!-- 连通油管 -->
<path d="M 445 305 L 465 305 M 535 305 L 555 305" stroke="#ffbe3b" stroke-width="2" stroke-linecap="round" />
<!-- D. 四角矢量涵道推进器系统 (Ducted Thrusters: 前后各2台,显示侧视前后两主涵道) -->
<!-- 前涵道推进器 (左前方角) -->
<g id="thrusterBow" transform="translate(250, 320)">
<!-- 涵道外罩 (带整流护罩) -->
<rect x="-14" y="0" width="28" height="52" rx="6" fill="#102030" stroke="#00ff9d" stroke-width="2" />
<!-- 导流叶片与旋转核心 -->
<ellipse cx="0" cy="26" rx="10" ry="18" fill="none" stroke="#486581" stroke-width="1.5" />
<line x1="-12" y1="26" x2="12" y2="26" stroke="#00ff9d" stroke-width="2" class="prop-blur" />
<!-- 下压喷流光柱 (根据工况动态喷射) -->
<polygon id="jetPlumeBow" points="-10,54 10,54 22,125 -22,125" fill="url(#thrustJetGrad)" opacity="0.85" filter="url(#vectorPulse)" />
<!-- 涵道推力矢量标引 -->
<g transform="translate(-45, 75)">
<line x1="15" y1="0" x2="35" y2="0" stroke="#00ff9d" stroke-width="2" marker-end="url(#arrowThruster)" />
<text x="10" y="-8" fill="#00ff9d" font-size="9" font-family="var(--font-mono)" text-anchor="end">
F_下压/牵引 120N
</text>
</g>
</g>
<!-- 后涵道推进器 (右后方角) -->
<g id="thrusterStern" transform="translate(750, 320)">
<rect x="-14" y="0" width="28" height="52" rx="6" fill="#102030" stroke="#00ff9d" stroke-width="2" />
<ellipse cx="0" cy="26" rx="10" ry="18" fill="none" stroke="#486581" stroke-width="1.5" />
<line x1="-12" y1="26" x2="12" y2="26" stroke="#00ff9d" stroke-width="2" class="prop-blur" />
<!-- 下压喷流光柱 -->
<polygon id="jetPlumeStern" points="-10,54 10,54 20,130 -20,130" fill="url(#thrustJetGrad)" opacity="0.85" filter="url(#vectorPulse)" />
<g transform="translate(45, 75)">
<text x="0" y="-8" fill="#00ff9d" font-size="9" font-family="var(--font-mono)">
F_抗流下压 120N
</text>
</g>
</g>
<!-- E. 姿态与深度多波束声呐探测器 (工作扫描扇面) -->
<g id="sensorSonar" transform="translate(500, 420)">
<polygon points="0,0 -40,52 40,52" fill="rgba(0, 240, 255, 0.08)" />
<line x1="0" y1="0" x2="-38" y2="52" stroke="rgba(0, 240, 255, 0.3)" stroke-dasharray="2,3" />
<line x1="0" y1="0" x2="38" y2="52" stroke="rgba(0, 240, 255, 0.3)" stroke-dasharray="2,3" />
<circle cx="0" cy="5" r="3" fill="#00f0ff" />
</g>
<!-- F. 重力微弱合力箭头 (极小红/橙箭头,直观显示重力大部分已被浮力吃掉) -->
<g id="netGravityVector" transform="translate(500, 350)">
<line x1="0" y1="0" x2="0" y2="40" stroke="#ff5555" stroke-width="3" stroke-linecap="round" />
<polygon points="0,48 -5,35 5,35" fill="#ff5555" />
<text x="12" y="25" fill="#ff7a7a" font-size="10" font-family="var(--font-mono)" font-weight="600">
残余触底重压 (≤15%)
</text>
</g>
</g>
<!-- 6. 交互式流体动态微粒/水流泡泡层 -->
<g id="bubbleParticles"></g>
</svg>
</main>
<!-- 底部精简控制交互栏 -->
<footer class="bottom-bar">
<div style="font-size:11px; color:#829ab1; font-weight:600; margin-right:4px;">工况模拟:</div>
<button class="mode-btn active" id="btnCruise" onclick="setMode('cruise')">标准轻触巡航</button>
<button class="mode-btn" id="btnSurge" onclick="setMode('surge')">大洋流抗冲 (0.8kn)</button>
<button class="mode-btn" id="btnSlope" onclick="setMode('slope')">软泥陡坡攀爬</button>
<div style="width:1px; height:16px; background:rgba(255,255,255,0.12); margin:0 4px;"></div>
<div class="slider-wrap">
<span>接地比压调节:</span>
<input type="range" id="pressureSlider" min="20" max="80" value="32" oninput="onPressureChange(this.value)">
<span id="sliderVal" style="color:var(--cyan-glow); min-width:38px;">3.2kPa</span>
</div>
</footer>
<script>
// --- 纯原生高保真物理与动画控制器 ---
const svgNS = "http://www.w3.org/2000/svg";
const flowFieldGroup = document.getElementById("currentFlowField");
const bubbleGroup = document.getElementById("bubbleParticles");
const trackTreads = document.getElementById("trackTreads");
const mudSurfaceLine = document.getElementById("mudSurfaceLine");
const jetPlumeBow = document.getElementById("jetPlumeBow");
const jetPlumeStern = document.getElementById("jetPlumeStern");
const crawlerChassis = document.getElementById("crawlerChassis");
const mainBuoyancyVector = document.getElementById("mainBuoyancyVector");
const buoyancyBeamLeft = document.getElementById("buoyancyBeamLeft");
const buoyancyBeamRight = document.getElementById("buoyancyBeamRight");
// 遥测读数DOM
const dispPressure = document.getElementById("dispPressure");
const dispBuoyancy = document.getElementById("dispBuoyancy");
const dispThrust = document.getElementById("dispThrust");
const teleCurrent = document.getElementById("teleCurrent");
const sliderVal = document.getElementById("sliderVal");
const pressureSlider = document.getElementById("pressureSlider");
let currentMode = 'cruise'; // 'cruise' | 'surge' | 'slope'
let treadOffset = 0;
let animTime = 0;
// 海流流线初始化
const flowLines = [];
for (let i = 0; i < 18; i++) {
const path = document.createElementNS(svgNS, "path");
const y = 80 + Math.random() * 380;
const length = 80 + Math.random() * 120;
path.setAttribute("stroke", "rgba(0, 240, 255, 0.22)");
path.setAttribute("stroke-width", (1 + Math.random() * 1.5).toFixed(1));
path.setAttribute("stroke-dasharray", "12 8");
path.setAttribute("fill", "none");
flowFieldGroup.appendChild(path);
flowLines.push({
el: path,
x: Math.random() * 1000,
y: y,
speed: 1.8 + Math.random() * 2.2,
len: length
});
}
// 涵道喷流粒子池
const particles = [];
const MAX_PARTICLES = 36;
for (let i = 0; i < MAX_PARTICLES; i++) {
const circle = document.createElementNS(svgNS, "circle");
circle.setAttribute("r", (1 + Math.random() * 2.2).toFixed(1));
circle.setAttribute("fill", Math.random() > 0.5 ? "#00ff9d" : "#00f0ff");
circle.setAttribute("opacity", "0");
bubbleGroup.appendChild(circle);
particles.push({
el: circle,
active: false,
x: 0,
y: 0,
vx: 0,
vy: 0,
life: 0,
maxLife: 50
});
}
function spawnParticle(sourceX, sourceY, dirX, dirY) {
const p = particles.find(item => !item.active);
if (!p) return;
p.active = true;
p.x = sourceX + (Math.random() - 0.5) * 12;
p.y = sourceY;
p.vx = dirX + (Math.random() - 0.5) * 0.8;
p.vy = dirY + Math.random() * 1.8;
p.life = 0;
p.maxLife = 35 + Math.random() * 25;
p.el.setAttribute("opacity", "0.85");
}
// 工况模式切换
function setMode(mode) {
currentMode = mode;
document.querySelectorAll('.mode-btn').forEach(b => b.classList.remove('active'));
if (mode === 'cruise') {
document.getElementById('btnCruise').classList.add('active');
teleCurrent.textContent = "0.24 kn (平缓)";
pressureSlider.value = 30;
updateDynamics(3.0, 55, 240);
} else if (mode === 'surge') {
document.getElementById('btnSurge').classList.add('active');
teleCurrent.textContent = "0.88 kn (强海流冲击)";
pressureSlider.value = 52;
updateDynamics(5.2, 42, 480);
} else if (mode === 'slope') {
document.getElementById('btnSlope').classList.add('active');
teleCurrent.textContent = "0.55 kn (18°倾斜爬坡)";
pressureSlider.value = 42;
updateDynamics(4.2, 48, 380);
}
}
function onPressureChange(val) {
const p = (val / 10).toFixed(1);
sliderVal.textContent = p + "kPa";
// 比压增大 -> 浮力稍微减小或下压力增加
const buoyancy = Math.round(65 - (val - 20) * 0.5);
const thrust = Math.round(180 + (val - 20) * 5);
updateDynamics(p, buoyancy, thrust);
}
function updateDynamics(pVal, bVal, tVal) {
dispPressure.textContent = parseFloat(pVal).toFixed(2) + " kPa";
dispBuoyancy.textContent = (bVal >= 0 ? "+" : "") + bVal + ".0 kg";
dispThrust.textContent = tVal + " N";
sliderVal.textContent = parseFloat(pVal).toFixed(1) + "kPa";
}
// 核心动画主循环 (DOMContentLoaded 自动播放,无须任何按键触发)
function renderLoop() {
animTime += 0.035;
// 1. 履带滚动视觉
treadOffset = (treadOffset - 1.2) % 24;
trackTreads.setAttribute("stroke-dashoffset", treadOffset);
// 2. 底盘微悬浮“轻触”起伏(呼吸感,呈现水下浮力托举特质)
let chassisY = Math.sin(animTime * 1.5) * 1.8;
let chassisTilt = 0;
if (currentMode === 'slope') {
chassisTilt = -4.5 + Math.sin(animTime * 2) * 0.8;
chassisY -= 3;
} else if (currentMode === 'surge') {
chassisTilt = Math.sin(animTime * 3) * 1.2;
}
crawlerChassis.setAttribute("transform", `translate(0, ${chassisY}) rotate(${chassisTilt}, 500, 440)`);
// 3. 海流线平移
const currentSpeedFactor = currentMode === 'surge' ? 2.6 : (currentMode === 'slope' ? 1.4 : 1.0);
flowLines.forEach(line => {
line.x += line.speed * currentSpeedFactor;
if (line.x > 1020) line.x = -150;
const wave = Math.sin(animTime + line.y) * 4;
line.el.setAttribute("d", `M ${line.x} ${line.y + wave} L ${line.x + line.len} ${line.y + wave}`);
});
// 4. 涵道推力尾喷动态脉动与粒子喷射
let thrustScale = 1.0;
if (currentMode === 'surge') thrustScale = 1.45;
if (currentMode === 'slope') thrustScale = 1.25;
const plumePulse = (0.85 + Math.sin(animTime * 8) * 0.15) * thrustScale;
jetPlumeBow.setAttribute("transform", `scale(1, ${plumePulse})`);
jetPlumeStern.setAttribute("transform", `scale(1, ${plumePulse * 1.05})`);
// 周期性发射水下涵道气泡/微喷粒
if (Math.random() < 0.65) {
spawnParticle(250, 375 + chassisY, -0.6, 2.2 * thrustScale);
spawnParticle(750, 375 + chassisY, 0.4, 2.4 * thrustScale);
}
// 粒子更新
particles.forEach(p => {
if (!p.active) return;
p.life++;
p.x += p.vx;
p.y += p.vy;
p.vy *= 0.98;
const progress = p.life / p.maxLife;
p.el.setAttribute("cx", p.x.toFixed(1));
p.el.setAttribute("cy", p.y.toFixed(1));
p.el.setAttribute("opacity", (1 - progress).toFixed(2));
if (p.life >= p.maxLife) {
p.active = false;
p.el.setAttribute("opacity", "0");
}
});
// 5. 浮力光柱的微辉光呼吸
const bGlow = 0.42 + Math.sin(animTime * 2.2) * 0.14;
buoyancyBeamLeft.setAttribute("opacity", bGlow);
buoyancyBeamRight.setAttribute("opacity", bGlow);
mainBuoyancyVector.setAttribute("transform", `translate(500, ${220 + chassisY}) scale(1, ${1 + Math.sin(animTime * 2) * 0.08})`);
// 6. 软泥受力微变形线条与履带贴合
const mudDepression = 472 + (currentMode === 'surge' ? 4 : 2) + Math.sin(animTime * 1.5) * 0.6;
mudSurfaceLine.setAttribute("d",
`M 0 472 L 230 472 Q 260 ${mudDepression} 290 ${mudDepression} L 710 ${mudDepression} Q 740 472 770 472 L 1000 472`
);
requestAnimationFrame(renderLoop);
}
// 页面完全加载后立即自启动高保真循环
window.addEventListener("DOMContentLoaded", () => {
renderLoop();
});
</script>
</body>
</html>
积分规则:每轮对话扣10分
等待动画代码生成...
