分享图
动画工坊
引擎就绪
<!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-deep: #050a12;
      --bg-panel: rgba(9, 18, 32, 0.75);
      --accent-cyan: #00f2ff;
      --accent-amber: #ffaa00;
      --accent-green: #00ffa3;
      --accent-blue: #3b82f6;
      --text-muted: #64748b;
      --text-light: #cbd5e1;
      --border-subtle: rgba(0, 242, 255, 0.18);
      --font-mono: "SF Mono", "JetBrains Mono", Consolas, monospace;
      --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
    }

    * {
      box-sizing: border-box;
      margin: 0;
      padding: 0;
      user-select: none;
    }

    body {
      width: 100vw;
      height: 100vh;
      background-color: var(--bg-deep);
      background-image: 
        radial-gradient(ellipse at 50% 20%, rgba(0, 110, 180, 0.15) 0%, transparent 60%),
        radial-gradient(circle at 10% 90%, rgba(0, 242, 255, 0.05) 0%, transparent 40%),
        linear-gradient(to bottom, #03070d 0%, #08111c 100%);
      font-family: var(--font-sans);
      color: var(--text-light);
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      overflow: hidden;
      position: relative;
    }

    /* 背景深海声纳网格与浮游微粒感 */
    .sonar-grid {
      position: absolute;
      inset: 0;
      background-size: 40px 40px;
      background-image: 
        linear-gradient(to right, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
      pointer-events: none;
      z-index: 1;
    }

    /* 顶部极简状态栏 - 严控字号与空间 */
    .top-bar {
      position: absolute;
      top: 14px;
      left: 20px;
      right: 20px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      z-index: 10;
      pointer-events: none;
    }

    .brand-title {
      display: flex;
      align-items: center;
      gap: 10px;
      font-size: 13px;
      font-weight: 600;
      letter-spacing: 0.5px;
      color: #e2e8f0;
    }

    .pulse-dot {
      width: 7px;
      height: 7px;
      background: var(--accent-green);
      border-radius: 50%;
      box-shadow: 0 0 8px var(--accent-green);
      animation: blink 2s infinite ease-in-out;
    }

    @keyframes blink {
      0%, 100% { opacity: 1; }
      50% { opacity: 0.3; }
    }

    .status-badge {
      font-family: var(--font-mono);
      font-size: 11px;
      color: var(--accent-cyan);
      background: rgba(0, 242, 255, 0.08);
      border: 1px solid var(--border-subtle);
      padding: 3px 8px;
      border-radius: 4px;
      letter-spacing: 0.5px;
    }

    /* 中央核心动画视区 - 满幅且无大面积覆盖物 */
    .main-stage {
      position: relative;
      width: 100%;
      height: 100%;
      display: flex;
      align-items: center;
      justify-content: center;
      z-index: 5;
    }

    svg#subsea-stage {
      width: 96%;
      height: 88%;
      max-width: 1200px;
      max-height: 640px;
      filter: drop-shadow(0 10px 25px rgba(0, 0, 0, 0.6));
    }

    /* 底部角落微型遥测图例 - 极小字号放置在边界 */
    .telemetry-strip {
      position: absolute;
      bottom: 12px;
      left: 20px;
      right: 20px;
      display: flex;
      justify-content: space-between;
      align-items: flex-end;
      z-index: 10;
      font-family: var(--font-mono);
      font-size: 11px;
      pointer-events: none;
    }

    .telemetry-card {
      background: var(--bg-panel);
      backdrop-filter: blur(8px);
      border: 1px solid var(--border-subtle);
      padding: 6px 12px;
      border-radius: 6px;
      display: flex;
      gap: 16px;
    }

    .data-item {
      display: flex;
      flex-direction: column;
      gap: 2px;
    }

    .data-item .label {
      color: var(--text-muted);
      font-size: 9px;
      text-transform: uppercase;
      letter-spacing: 0.5px;
    }

    .data-item .val {
      color: var(--accent-cyan);
      font-weight: 600;
      font-size: 12px;
    }

    .val.green { color: var(--accent-green); }
    .val.amber { color: var(--accent-amber); }

    .action-guide {
      background: var(--bg-panel);
      backdrop-filter: blur(8px);
      border: 1px solid var(--border-subtle);
      padding: 6px 12px;
      border-radius: 6px;
      display: flex;
      align-items: center;
      gap: 12px;
      pointer-events: auto;
    }

    .guide-btn {
      background: rgba(0, 242, 255, 0.12);
      border: 1px solid var(--accent-cyan);
      color: var(--accent-cyan);
      font-size: 10px;
      padding: 3px 8px;
      border-radius: 3px;
      cursor: pointer;
      font-family: var(--font-mono);
      transition: all 0.2s ease;
    }

    .guide-btn:hover {
      background: var(--accent-cyan);
      color: #000;
    }

    /* 履带动态齿轮流动 */
    .tread-pattern {
      stroke-dasharray: 6 5;
      animation: treadMove 0.8s linear infinite;
    }

    @keyframes treadMove {
      from { stroke-dashoffset: 0; }
      to { stroke-dashoffset: 22; }
    }
  </style>
</head>
<body>

  <div class="sonar-grid"></div>

  <!-- 顶部精简导航与状态栏 -->
  <header class="top-bar">
    <div class="brand-title">
      <div class="pulse-dot"></div>
      <span>双段铰接式海底仿形底盘机构 · 最终理想解动态演示</span>
    </div>
    <div class="status-badge" id="mode-text">IFR 自动巡航模式: 地形全浮动适应 ON</div>
  </header>

  <!-- 核心交互动画舞台 (SVG) -->
  <main class="main-stage">
    <svg id="subsea-stage" viewBox="0 0 1000 520" preserveAspectRatio="xMidYMid meet">
      <defs>
        <!-- 压强安全区渐变 -->
        <linearGradient id="pressure-grad" x1="0%" y1="0%" x2="0%" y2="100%">
          <stop offset="0%" stop-color="#00ffa3" stop-opacity="0.8"/>
          <stop offset="100%" stop-color="#00ffa3" stop-opacity="0"/>
        </linearGradient>

        <!-- 海底地层切片阴影 -->
        <linearGradient id="seabed-grad" x1="0%" y1="0%" x2="0%" y2="100%">
          <stop offset="0%" stop-color="#142236" stop-opacity="0.95"/>
          <stop offset="25%" stop-color="#0c1726" stop-opacity="0.98"/>
          <stop offset="100%" stop-color="#050a12" stop-opacity="1"/>
        </linearGradient>

        <!-- 金属骨架渐变 -->
        <linearGradient id="chassis-grad" x1="0%" y1="0%" x2="100%" y2="100%">
          <stop offset="0%" stop-color="#2a3f5a"/>
          <stop offset="50%" stop-color="#19283d"/>
          <stop offset="100%" stop-color="#0e1724"/>
        </linearGradient>

        <linearGradient id="accent-metal" x1="0%" y1="0%" x2="100%" y2="0%">
          <stop offset="0%" stop-color="#ffaa00"/>
          <stop offset="100%" stop-color="#ffd000"/>
        </linearGradient>

        <!-- 发光滤镜 -->
        <filter id="neon-glow" x="-20%" y="-20%" width="140%" height="140%">
          <feGaussianBlur stdDeviation="3" result="blur" />
          <feMerge>
            <feMergeNode in="blur" />
            <feMergeNode in="SourceGraphic" />
          </feMerge>
        </filter>

        <!-- 履带材质图案 -->
        <pattern id="tread-lines" width="10" height="8" patternUnits="userSpaceOnUse">
          <line x1="0" y1="4" x2="8" y2="4" stroke="#00f2ff" stroke-width="2" stroke-linecap="round"/>
        </pattern>
      </defs>

      <!-- 海底水流微尘参考背景粒子 -->
      <g id="particles" opacity="0.35"></g>

      <!-- 动态海底地层曲线 -->
      <g id="seabed-layer">
        <path id="seabed-poly" fill="url(#seabed-grad)" stroke="#00f2ff" stroke-width="2" stroke-opacity="0.5"/>
        <path id="seabed-surface" fill="none" stroke="#00f2ff" stroke-width="2.5" filter="url(#neon-glow)"/>
        <!-- 海床等高基准虚线 -->
        <line x1="40" y1="420" x2="960" y2="420" stroke="rgba(255,255,255,0.08)" stroke-width="1" stroke-dasharray="4 6"/>
      </g>

      <!-- 接地比压分布热力标量区 (载荷均布 < 5kPa) -->
      <g id="ground-pressure-group"></g>

      <!-- 履带机器人整机层 (包含后模块、中央铰接、前模块) -->
      <g id="chassis-system">
        
        <!-- 后履带模块 Rear Module -->
        <g id="rear-module">
          <!-- 模块主梁与机匣 -->
          <g class="module-body">
            <polygon class="chassis-plate" fill="url(#chassis-grad)" stroke="#38bdf8" stroke-width="1.5"/>
            <!-- 标识字样 (极简微字号) -->
            <text class="module-tag" font-family="var(--font-mono)" font-size="8" fill="#64748b" letter-spacing="1">MOD-01 REAR</text>
          </g>

          <!-- 3组独立被动摇臂与支重轮 (内嵌扭簧) -->
          <g class="bogie-arms" id="rear-bogies"></g>

          <!-- 驱动轮与张紧轮 (前后两端端轮) -->
          <circle id="rear-wheel-sprocket" r="23" fill="#111c2a" stroke="#ffaa00" stroke-width="2"/>
          <circle id="rear-wheel-idler" r="23" fill="#111c2a" stroke="#00f2ff" stroke-width="2"/>

          <!-- 履带外环包裹线 -->
          <path id="rear-tread-belt" fill="rgba(0, 242, 255, 0.04)" stroke="#00f2ff" stroke-width="5" stroke-linejoin="round" class="tread-pattern"/>
        </g>

        <!-- 前履带模块 Front Module -->
        <g id="front-module">
          <!-- 模块主梁与机匣 -->
          <g class="module-body">
            <polygon class="chassis-plate" fill="url(#chassis-grad)" stroke="#38bdf8" stroke-width="1.5"/>
            <!-- 标识字样 -->
            <text class="module-tag" font-family="var(--font-mono)" font-size="8" fill="#64748b" letter-spacing="1">MOD-02 FRONT</text>
          </g>

          <!-- 3组独立被动摇臂与支重轮 -->
          <g class="bogie-arms" id="front-bogies"></g>

          <!-- 前模块驱动轮与张紧轮 -->
          <circle id="front-wheel-idler" r="23" fill="#111c2a" stroke="#00f2ff" stroke-width="2"/>
          <circle id="front-wheel-sprocket" r="23" fill="#111c2a" stroke="#ffaa00" stroke-width="2"/>

          <!-- 前履带外环包裹线 -->
          <path id="front-tread-belt" fill="rgba(0, 242, 255, 0.04)" stroke="#00f2ff" stroke-width="5" stroke-linejoin="round" class="tread-pattern"/>
        </g>

        <!-- 中央俯仰铰接系统 (核心创新点高亮区) -->
        <g id="articulation-system">
          <!-- 柔性防水耐压穿线管 (Bézier Cable) -->
          <path id="flexible-conduit" fill="none" stroke="#f59e0b" stroke-width="3.5" stroke-dasharray="3 2" opacity="0.85"/>
          
          <!-- 铰接连杆与机械限位块 (±18°) -->
          <line id="joint-link" stroke="#475569" stroke-width="6" stroke-linecap="round"/>
          <path id="joint-limit-arc" fill="none" stroke="rgba(255, 170, 0, 0.35)" stroke-width="3"/>
          <circle id="joint-center-pin" r="8" fill="#ffaa00" stroke="#fff" stroke-width="2" filter="url(#neon-glow)"/>
          
          <!-- 角度与力矩数字 HUD 指示标 (紧凑附着在铰接点旁) -->
          <g id="joint-hud" transform="translate(0, -22)">
            <rect x="-38" y="-14" width="76" height="15" rx="3" fill="rgba(5, 10, 18, 0.85)" stroke="#ffaa00" stroke-width="0.8"/>
            <text id="joint-angle-val" x="0" y="-3" text-anchor="middle" font-family="var(--font-mono)" font-size="9" fill="#ffaa00" font-weight="600">PITCH: +0.0°</text>
          </g>
        </g>
      </g>

      <!-- 标注提示标签 (精巧线框,避免遮挡中心区) -->
      <g id="minimal-callouts" opacity="0.85" pointer-events="none">
        <!-- 铰接创新指引 -->
        <g transform="translate(500, 75)">
          <line x1="0" y1="0" x2="0" y2="40" stroke="#ffaa00" stroke-width="1" stroke-dasharray="2 3"/>
          <circle cx="0" cy="40" r="2" fill="#ffaa00"/>
          <rect x="-65" y="-18" width="130" height="18" rx="3" fill="rgba(9,18,32,0.8)" stroke="rgba(255,170,0,0.5)" stroke-width="0.8"/>
          <text x="0" y="-5" text-anchor="middle" font-size="9.5" fill="#f8fafc">俯仰铰接轴 (±18° 自适应)</text>
        </g>

        <!-- 摇臂机构指引 -->
        <g id="callout-bogie" transform="translate(720, 200)">
          <line x1="-30" y1="0" x2="0" y2="0" stroke="#00f2ff" stroke-width="1"/>
          <circle cx="-30" cy="0" r="2" fill="#00f2ff"/>
          <rect x="0" y="-11" width="135" height="18" rx="3" fill="rgba(9,18,32,0.8)" stroke="rgba(0,242,255,0.4)" stroke-width="0.8"/>
          <text x="6" y="2" font-size="9" fill="#94a3b8">扭簧被动摇臂 (行程100mm)</text>
        </g>

        <!-- 均布比压指引 -->
        <g id="callout-pressure" transform="translate(340, 485)">
          <line x1="0" y1="-25" x2="0" y2="0" stroke="#00ffa3" stroke-width="1" stroke-dasharray="2 2"/>
          <circle cx="0" cy="-25" r="2" fill="#00ffa3"/>
          <rect x="-70" y="2" width="140" height="18" rx="3" fill="rgba(9,18,32,0.8)" stroke="rgba(0,255,163,0.4)" stroke-width="0.8"/>
          <text x="0" y="15" text-anchor="middle" font-size="9" fill="#00ffa3">全域接地比压 &lt; 5kPa (无局部沉陷)</text>
        </g>
      </g>
    </svg>
  </main>

  <!-- 底部边缘微型工程数据遥测栏 (Text-sm/11px) -->
  <footer class="telemetry-strip">
    <div class="telemetry-card">
      <div class="data-item">
        <span class="label">铰接俯仰角 (±18°)</span>
        <span class="val amber" id="telemetry-pitch">+0.0°</span>
      </div>
      <div class="data-item">
        <span class="label">最大局部接地比压</span>
        <span class="val green" id="telemetry-pressure">3.82 kPa</span>
      </div>
      <div class="data-item">
        <span class="label">摇臂位移行程量</span>
        <span class="val" id="telemetry-stroke">42.5 mm</span>
      </div>
      <div class="data-item">
        <span class="label">当前越障裕量</span>
        <span class="val" id="telemetry-clearance">218 mm</span>
      </div>
    </div>

    <!-- 极简控制微交互 -->
    <div class="action-guide">
      <span style="font-size: 10px; color: var(--text-muted);">地形工况切换:</span>
      <button class="guide-btn" id="btn-trench">典型海沟海丘</button>
      <button class="guide-btn" id="btn-rocks">连续岩礁起伏</button>
      <button class="guide-btn" id="btn-extreme">大坡坎越障</button>
    </div>
  </footer>

  <script>
    /**
     * 深海自适应底盘机构 运动学与物理可视化驱动
     * 遵循 IFR (最终理想解):利用地形反作用力与扭簧被动机构自适应消除局部高比压
     */
    (function () {
      // 核心参数
      const STAGE_WIDTH = 1000;
      const BASE_Y = 380;       // 海床基础水平高度
      let speed = 0.85;         // 海床行进速率
      let terrainPhase = 0;     // 当前地形滚动相位
      let terrainMode = 0;      // 0: 混合海丘, 1: 复杂岩礁, 2: 极限断阶

      // 机械几何尺寸定义 (以毫米/标量映射)
      const JOINT_X = 500;       // 中央铰接销轴位于屏幕水平中心
      const MODULE_HALF_LEN = 145; // 单模块轮廓半长
      const MODULE_GAP = 55;      // 前后模块销轴中心到各自主梁枢轴的距离
      
      // 支重轮相对各模块中心的局部 X 偏移 (单模块内各配备 3 个独立摇臂支重轮)
      const BOGIE_LOCAL_X = [-80, 0, 80];
      const BOGIE_ARM_LEN = 36;  // 摇臂几何杆长
      const ROAD_WHEEL_R = 14;   // 支重轮半径
      const SPROCKET_R = 23;     // 首尾大轮半径

      // 地形生成函数:多重正弦傅里叶叠加,模拟非平整起伏底形
      function getSeabedHeight(x, phase) {
        const u = (x + phase) * 0.007;
        let h = 0;
        if (terrainMode === 0) {
          // 典型连续波状海丘与浅沟
          h = Math.sin(u) * 28 + Math.cos(u * 2.1) * 14 + Math.sin(u * 0.5) * 18;
        } else if (terrainMode === 1) {
          // 密集崎岖岩礁软硬突变底质
          h = Math.sin(u * 1.8) * 35 + Math.sin(u * 3.7) * 12 + Math.cos(u * 0.8) * 25;
        } else {
          // 200mm 越障阶梯型障碍与落水海槽
          const stepU = (x + phase) * 0.005;
          h = Math.sin(stepU) * 45 + Math.sign(Math.sin(stepU * 1.5)) * 18 + Math.cos(u * 1.4) * 10;
        }
        return BASE_Y + h;
      }

      // 获取海床切线法向量斜率
      function getSeabedSlope(x, phase) {
        const delta = 4;
        const y1 = getSeabedHeight(x - delta, phase);
        const y2 = getSeabedHeight(x + delta, phase);
        return (y2 - y1) / (delta * 2);
      }

      // DOM 元素缓存
      const seabedPoly = document.getElementById('seabed-poly');
      const seabedSurface = document.getElementById('seabed-surface');
      const particlesGroup = document.getElementById('particles');
      const groundPressureGroup = document.getElementById('ground-pressure-group');
      
      const rearModule = document.getElementById('rear-module');
      const frontModule = document.getElementById('front-module');
      const rearBogies = document.getElementById('rear-bogies');
      const frontBogies = document.getElementById('front-bogies');
      
      const jointLink = document.getElementById('joint-link');
      const jointCenterPin = document.getElementById('joint-center-pin');
      const jointLimitArc = document.getElementById('joint-limit-arc');
      const jointAngleVal = document.getElementById('joint-angle-val');
      const jointHud = document.getElementById('joint-hud');
      const flexibleConduit = document.getElementById('flexible-conduit');

      const telemetryPitch = document.getElementById('telemetry-pitch');
      const telemetryPressure = document.getElementById('telemetry-pressure');
      const telemetryStroke = document.getElementById('telemetry-stroke');
      const telemetryClearance = document.getElementById('telemetry-clearance');

      // 初始化背景漂浮微粒
      const particles = [];
      for (let i = 0; i < 24; i++) {
        const c = document.createElementNS('http://www.w3.org/2000/svg', 'circle');
        const p = {
          x: Math.random() * STAGE_WIDTH,
          y: Math.random() * 320,
          r: Math.random() * 1.6 + 0.8,
          speed: Math.random() * 0.4 + 0.2
        };
        c.setAttribute('r', p.r);
        c.setAttribute('fill', '#00f2ff');
        particlesGroup.appendChild(c);
        particles.push({ el: c, ...p });
      }

      // 预先建立摇臂支重轮与扭簧 DOM
      function createBogieElements(container) {
        const elements = [];
        for (let i = 0; i < 3; i++) {
          const g = document.createElementNS('http://www.w3.org/2000/svg', 'g');
          
          // 摇臂摇杆
          const arm = document.createElementNS('http://www.w3.org/2000/svg', 'line');
          arm.setAttribute('stroke', '#38bdf8');
          arm.setAttribute('stroke-width', '5');
          arm.setAttribute('stroke-linecap', 'round');

          // 扭簧形态指示圈
          const spring = document.createElementNS('http://www.w3.org/2000/svg', 'circle');
          spring.setAttribute('r', '7');
          spring.setAttribute('fill', 'none');
          spring.setAttribute('stroke', '#ffaa00');
          spring.setAttribute('stroke-width', '2');
          spring.setAttribute('stroke-dasharray', '4 2');

          // 支重轮外轮
          const wheel = document.createElementNS('http://www.w3.org/2000/svg', 'circle');
          wheel.setAttribute('r', ROAD_WHEEL_R);
          wheel.setAttribute('fill', '#0f172a');
          wheel.setAttribute('stroke', '#00f2ff');
          wheel.setAttribute('stroke-width', '2.5');

          // 轮芯轴
          const hub = document.createElementNS('http://www.w3.org/2000/svg', 'circle');
          hub.setAttribute('r', '4');
          hub.setAttribute('fill', '#38bdf8');

          g.appendChild(arm);
          g.appendChild(spring);
          g.appendChild(wheel);
          g.appendChild(hub);
          container.appendChild(g);

          elements.push({ g, arm, spring, wheel, hub });
        }
        return elements;
      }

      const rearBogieNodes = createBogieElements(rearBogies);
      const frontBogieNodes = createBogieElements(frontBogies);

      // 主更新循环
      function animate() {
        terrainPhase += speed;

        // 1. 生成海底地表剖面 Path
        let pathD = `M 0 520 L 0 ${getSeabedHeight(0, terrainPhase)}`;
        let surfaceD = `M 0 ${getSeabedHeight(0, terrainPhase)}`;
        const step = 8;
        for (let x = step; x <= STAGE_WIDTH; x += step) {
          const y = getSeabedHeight(x, terrainPhase);
          pathD += ` L ${x} ${y}`;
          surfaceD += ` L ${x} ${y}`;
        }
        pathD += ` L ${STAGE_WIDTH} 520 Z`;
        seabedPoly.setAttribute('d', pathD);
        seabedSurface.setAttribute('d', surfaceD);

        // 2. 模拟前后两大模块在海底的姿态解算
        // 后模块中心 X 约为 350,前模块中心 X 约为 650
        const rearCenterX = JOINT_X - MODULE_GAP - MODULE_HALF_LEN * 0.7;
        const frontCenterX = JOINT_X + MODULE_GAP + MODULE_HALF_LEN * 0.7;

        // 获取后模块两端地高计算俯仰角
        const rearYLeft = getSeabedHeight(rearCenterX - MODULE_HALF_LEN * 0.85, terrainPhase);
        const rearYRight = getSeabedHeight(rearCenterX + MODULE_HALF_LEN * 0.85, terrainPhase);
        const rearSlope = (rearYRight - rearYLeft) / (MODULE_HALF_LEN * 1.7);
        const rearPitchRad = Math.atan(rearSlope);
        const rearModuleY = (rearYLeft + rearYRight) / 2 - 45; // 底盘离地标称距

        // 获取前模块两端地高计算俯仰角
        const frontYLeft = getSeabedHeight(frontCenterX - MODULE_HALF_LEN * 0.85, terrainPhase);
        const frontYRight = getSeabedHeight(frontCenterX + MODULE_HALF_LEN * 0.85, terrainPhase);
        const frontSlope = (frontYRight - frontYLeft) / (MODULE_HALF_LEN * 1.7);
        const frontPitchRad = Math.atan(frontSlope);
        const frontModuleY = (frontYLeft + frontYRight) / 2 - 45;

        // 中央铰接实际销轴空间物理位置 (连接前后模块连杆交点)
        const rearJointPivot = {
          x: rearCenterX + Math.cos(rearPitchRad) * (MODULE_HALF_LEN * 0.85),
          y: rearModuleY + Math.sin(rearPitchRad) * (MODULE_HALF_LEN * 0.85)
        };
        const frontJointPivot = {
          x: frontCenterX - Math.cos(frontPitchRad) * (MODULE_HALF_LEN * 0.85),
          y: frontModuleY - Math.sin(frontPitchRad) * (MODULE_HALF_LEN * 0.85)
        };
        const jointPinX = (rearJointPivot.x + frontJointPivot.x) / 2;
        const jointPinY = (rearJointPivot.y + frontJointPivot.y) / 2;

        // 相对俯仰摆动角 (限制在工程标准 ±18° 内)
        let relativePitchDeg = ((frontPitchRad - rearPitchRad) * 180 / Math.PI);
        relativePitchDeg = Math.max(-18, Math.min(18, relativePitchDeg));

        // 3. 更新中央俯仰铰接机构视觉渲染
        jointCenterPin.setAttribute('cx', jointPinX);
        jointCenterPin.setAttribute('cy', jointPinY);
        jointLink.setAttribute('x1', rearJointPivot.x);
        jointLink.setAttribute('y1', rearJointPivot.y);
        jointLink.setAttribute('x2', frontJointPivot.x);
        jointLink.setAttribute('y2', frontJointPivot.y);

        // 柔性耐压走线管 (三次贝塞尔根据铰接角度产生自然弧度)
        const sagOffset = Math.sin(terrainPhase * 0.05) * 4;
        const ctrlY = Math.max(rearJointPivot.y, frontJointPivot.y) + 26 + sagOffset;
        flexibleConduit.setAttribute('d', 
          `M ${rearJointPivot.x - 14} ${rearJointPivot.y - 12} ` +
          `Q ${jointPinX} ${ctrlY} ${frontJointPivot.x + 14} ${frontJointPivot.y - 12}`
        );

        // 铰接角度 HUD 位置动态跟随
        jointHud.setAttribute('transform', `translate(${jointPinX}, ${jointPinY - 26})`);
        const signStr = relativePitchDeg >= 0 ? '+' : '';
        jointAngleVal.textContent = `PITCH: ${signStr}${relativePitchDeg.toFixed(1)}°`;

        // 铰接限位圆弧指示器
        const arcRadius = 24;
        const startRad = rearPitchRad - 0.314; // -18 deg
        const endRad = rearPitchRad + 0.314;   // +18 deg
        const ax1 = jointPinX + Math.cos(startRad) * arcRadius;
        const ay1 = jointPinY + Math.sin(startRad) * arcRadius;
        const ax2 = jointPinX + Math.cos(endRad) * arcRadius;
        const ay2 = jointPinY + Math.sin(endRad) * arcRadius;
        jointLimitArc.setAttribute('d', `M ${ax1} ${ay1} A ${arcRadius} ${arcRadius} 0 0 1 ${ax2} ${ay2}`);

        // 4. 驱动单个模块与内部被动摇臂支重轮系统
        let totalStroke = 0;
        let groundContactPoints = [];

        function updateModule(isFront, centerX, centerY, pitchRad, bogieNodes) {
          const deg = pitchRad * 180 / Math.PI;
          const modGroup = isFront ? frontModule : rearModule;
          const treadPath = modGroup.querySelector('.tread-pattern');
          const plate = modGroup.querySelector('.chassis-plate');
          const spk = modGroup.querySelector(isFront ? '#front-wheel-sprocket' : '#rear-wheel-sprocket');
          const idl = modGroup.querySelector(isFront ? '#front-wheel-idler' : '#rear-wheel-idler');
          const tag = modGroup.querySelector('.module-tag');

          // 主梁多边形轮廓
          const halfL = MODULE_HALF_LEN * 0.9;
          const p1 = [-halfL, -16], p2 = [halfL, -16], p3 = [halfL - 10, 16], p4 = [-halfL + 10, 16];
          plate.setAttribute('points', `${p1} ${p2} ${p3} ${p4}`);
          plate.setAttribute('transform', `translate(${centerX}, ${centerY}) rotate(${deg})`);
          tag.setAttribute('transform', `translate(${centerX - 28}, ${centerY - 4}) rotate(${deg})`);

          // 首尾主轮坐标
          const spkLocalX = isFront ? halfL : -halfL;
          const idlLocalX = isFront ? -halfL : halfL;
          const spkWorld = localToWorld(spkLocalX, 0, centerX, centerY, pitchRad);
          const idlWorld = localToWorld(idlLocalX, 0, centerX, centerY, pitchRad);

          spk.setAttribute('cx', spkWorld.x);
          spk.setAttribute('cy', spkWorld.y);
          idl.setAttribute('cx', idlWorld.x);
          idl.setAttribute('cy', idlWorld.y);

          // 3组摇臂系统贴合解算
          const wheelBottoms = [];
          bogieNodes.forEach((node, idx) => {
            const lx = BOGIE_LOCAL_X[idx];
            // 摇臂枢轴在底盘主梁上的挂载点
            const pivotWorld = localToWorld(lx, 10, centerX, centerY, pitchRad);
            
            // 该轮位置对应的真实海底表面高度
            const groundY = getSeabedHeight(pivotWorld.x, terrainPhase);
            
            // 理想贴地时的轮心目标 Y 坐标 (轮下沿紧贴海床)
            const targetWheelY = groundY - ROAD_WHEEL_R;
            
            // 摇臂行程与角度解算 (行程限位在 100mm 规范内)
            const verticalDelta = targetWheelY - pivotWorld.y;
            const clampedDelta = Math.max(16, Math.min(50, verticalDelta));
            totalStroke += Math.abs(clampedDelta - 33);

            // 摇臂水平投影
            const armDx = Math.sqrt(Math.max(0, BOGIE_ARM_LEN * BOGIE_ARM_LEN - (clampedDelta - 10) * (clampedDelta - 10)));
            const wheelX = pivotWorld.x + (isFront ? armDx * 0.7 : -armDx * 0.7);
            const wheelY = pivotWorld.y + clampedDelta;

            // 更新摇臂连杆与扭簧状态
            node.arm.setAttribute('x1', pivotWorld.x);
            node.arm.setAttribute('y1', pivotWorld.y);
            node.arm.setAttribute('x2', wheelX);
            node.arm.setAttribute('y2', wheelY);

            node.spring.setAttribute('cx', pivotWorld.x);
            node.spring.setAttribute('cy', pivotWorld.y);

            node.wheel.setAttribute('cx', wheelX);
            node.wheel.setAttribute('cy', wheelY);
            node.hub.setAttribute('cx', wheelX);
            node.hub.setAttribute('cy', wheelY);

            wheelBottoms.push({ x: wheelX, y: wheelY + ROAD_WHEEL_R });
            groundContactPoints.push({ x: wheelX, y: wheelY + ROAD_WHEEL_R });
          });

          // 闭合柔性履带外圈曲线渲染
          // 连接: 导向轮顶点 -> 驱动轮顶点 -> 各支重轮触底包络 -> 闭合
          const pTopLeft = localToWorld(-halfL, -SPROCKET_R, centerX, centerY, pitchRad);
          const pTopRight = localToWorld(halfL, -SPROCKET_R, centerX, centerY, pitchRad);
          
          let beltD = `M ${pTopLeft.x} ${pTopLeft.y} L ${pTopRight.x} ${pTopRight.y} `;
          const endWheelRight = isFront ? spkWorld : idlWorld;
          beltD += `A ${SPROCKET_R} ${SPROCKET_R} 0 0 1 ${endWheelRight.x + (isFront?SPROCKET_R:-SPROCKET_R)*0.6} ${endWheelRight.y + SPROCKET_R*0.7} `;
          
          // 串联底部受压支重轮曲线
          const sortedBottoms = isFront ? [...wheelBottoms] : [...wheelBottoms].reverse();
          sortedBottoms.forEach(wb => {
            beltD += `L ${wb.x} ${wb.y} `;
          });

          const endWheelLeft = isFront ? idlWorld : spkWorld;
          beltD += `L ${endWheelLeft.x} ${endWheelLeft.y + SPROCKET_R*0.7} `;
          beltD += `A ${SPROCKET_R} ${SPROCKET_R} 0 0 1 ${pTopLeft.x} ${pTopLeft.y} Z`;
          treadPath.setAttribute('d', beltD);
        }

        function localToWorld(lx, ly, cx, cy, rad) {
          const cos = Math.cos(rad);
          const sin = Math.sin(rad);
          return {
            x: cx + lx * cos - ly * sin,
            y: cy + lx * sin + ly * cos
          };
        }

        updateModule(false, rearCenterX, rearModuleY, rearPitchRad, rearBogieNodes);
        updateModule(true, frontCenterX, frontModuleY, frontPitchRad, frontBogieNodes);

        // 5. 渲染全域载荷分布比压热力柱与微箭头 (证明载荷均布 < 5kPa)
        renderPressureDistribution(groundContactPoints);

        // 6. 悬浮微粒深海水流动画
        particles.forEach(p => {
          p.x -= (p.speed + speed * 0.35);
          if (p.x < 0) p.x = STAGE_WIDTH;
          p.el.setAttribute('cx', p.x);
          p.el.setAttribute('cy', p.y);
        });

        // 7. 更新底部极简遥测读数
        telemetryPitch.textContent = `${relativePitchDeg >= 0 ? '+' : ''}${relativePitchDeg.toFixed(1)}°`;
        // 载荷均布动态模拟值:在自适应消除集中载荷后,平均受压稳定在 3.6 ~ 4.2 kPa
        const avgPressure = (3.78 + Math.sin(terrainPhase * 0.08) * 0.28).toFixed(2);
        telemetryPressure.textContent = `${avgPressure} kPa`;
        const avgStrokeVal = (38 + (totalStroke / 6) * 1.5).toFixed(1);
        telemetryStroke.textContent = `${avgStrokeVal} mm`;

        requestAnimationFrame(animate);
      }

      // 接地压力光标绘制
      function renderPressureDistribution(contactPoints) {
        let html = '';
        contactPoints.forEach((pt, i) => {
          // 接地比压渐变光斑
          html += `
            <g transform="translate(${pt.x}, ${pt.y})">
              <!-- 比压发光梯度 -->
              <ellipse cx="0" cy="2" rx="14" ry="4" fill="url(#pressure-grad)" opacity="0.6"/>
              <!-- 均布受力小矢量线 -->
              <line x1="0" y1="2" x2="0" y2="12" stroke="#00ffa3" stroke-width="1.5" stroke-dasharray="2 1"/>
              <polygon points="-2.5,12 2.5,12 0,16" fill="#00ffa3"/>
            </g>
          `;
        });
        groundPressureGroup.innerHTML = html;
      }

      // 地形工况快速切换交互
      const modeText = document.getElementById('mode-text');
      document.getElementById('btn-trench').addEventListener('click', () => {
        terrainMode = 0;
        modeText.textContent = "IFR 自动巡航模式: 典型海沟海丘仿形中";
      });
      document.getElementById('btn-rocks').addEventListener('click', () => {
        terrainMode = 1;
        modeText.textContent = "IFR 自动巡航模式: 崎岖岩礁软硬交替地形自适应中";
      });
      document.getElementById('btn-extreme').addEventListener('click', () => {
        terrainMode = 2;
        modeText.textContent = "IFR 极限工况模式: 200mm 海底断阶大坡坎越障中";
      });

      // 启动并保证重开即播
      if (document.readyState === 'complete' || document.readyState === 'interactive') {
        requestAnimationFrame(animate);
      } else {
        window.addEventListener('DOMContentLoaded', () => requestAnimationFrame(animate));
      }
    })();
  </script>
</body>
</html>
积分规则:每轮对话扣10分