分享图
动画工坊
引擎就绪
<!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-dark: #0b0f17;
      --panel-bg: rgba(18, 26, 41, 0.82);
      --panel-border: rgba(56, 189, 248, 0.2);
      --cyan-core: #00f0ff;
      --cyan-glow: rgba(0, 240, 255, 0.45);
      --amber-tape: #f59e0b;
      --amber-glow: rgba(245, 158, 11, 0.4);
      --silicone-soft: #38bdf8;
      --success: #10b981;
      --text-main: #f1f5f9;
      --text-muted: #94a3b8;
      --font-mono: "SF Mono", "Fira Code", "Roboto Mono", monospace;
    }

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

    body {
      background-color: var(--bg-dark);
      background-image: 
        radial-gradient(circle at 50% 15%, rgba(14, 165, 233, 0.12) 0%, transparent 65%),
        linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
      background-size: 100% 100%, 32px 32px, 32px 32px;
      color: var(--text-main);
      font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
      min-height: 100vh;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      overflow-x: hidden;
      padding: 24px;
    }

    .container {
      width: 100%;
      max-width: 1080px;
      background: var(--panel-bg);
      border: 1px solid var(--panel-border);
      backdrop-filter: blur(16px);
      border-radius: 16px;
      box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.7), 0 0 30px 0 rgba(0, 240, 255, 0.1);
      display: flex;
      flex-direction: column;
      overflow: hidden;
      position: relative;
    }

    /* 顶部状态条 */
    .header {
      padding: 16px 28px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      border-bottom: 1px solid rgba(255, 255, 255, 0.06);
      background: rgba(11, 15, 23, 0.6);
    }

    .title-group h1 {
      font-size: 18px;
      font-weight: 600;
      letter-spacing: 0.5px;
      display: flex;
      align-items: center;
      gap: 10px;
      color: #fff;
    }

    .badge-ifr {
      font-size: 11px;
      font-weight: 700;
      color: var(--cyan-core);
      background: rgba(0, 240, 255, 0.12);
      border: 1px solid rgba(0, 240, 255, 0.35);
      padding: 2px 8px;
      border-radius: 4px;
      text-transform: uppercase;
      letter-spacing: 1px;
    }

    .meta-tags {
      display: flex;
      gap: 16px;
      font-family: var(--font-mono);
      font-size: 12px;
      color: var(--text-muted);
    }

    .meta-tag span {
      color: var(--cyan-core);
      font-weight: 600;
    }

    /* 核心舞台 */
    .stage-wrapper {
      position: relative;
      width: 100%;
      height: 520px;
      display: flex;
      align-items: center;
      justify-content: center;
      background: radial-gradient(ellipse at center, rgba(30, 41, 59, 0.4) 0%, rgba(11, 15, 23, 0.9) 100%);
    }

    svg#animCanvas {
      width: 100%;
      height: 100%;
      overflow: visible;
    }

    /* 底部控制台与时序指示 */
    .dashboard {
      padding: 18px 28px;
      background: rgba(11, 15, 23, 0.75);
      border-top: 1px solid rgba(255, 255, 255, 0.06);
      display: flex;
      flex-direction: column;
      gap: 14px;
    }

    /* 时序阶段流道 */
    .timeline-steps {
      display: grid;
      grid-template-columns: repeat(5, 1fr);
      gap: 8px;
      position: relative;
    }

    .step-item {
      padding: 8px 12px;
      background: rgba(255, 255, 255, 0.03);
      border: 1px solid rgba(255, 255, 255, 0.08);
      border-radius: 6px;
      text-align: center;
      transition: all 0.25s ease;
    }

    .step-item.active {
      background: rgba(0, 240, 255, 0.15);
      border-color: var(--cyan-core);
      box-shadow: 0 0 15px rgba(0, 240, 255, 0.25);
    }

    .step-name {
      font-size: 12px;
      font-weight: 600;
      color: #cbd5e1;
      display: block;
    }

    .step-item.active .step-name {
      color: var(--cyan-core);
    }

    .step-time {
      font-size: 10px;
      font-family: var(--font-mono);
      color: var(--text-muted);
    }

    /* 交互面板 */
    .controls-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 20px;
    }

    .ctrl-group {
      display: flex;
      align-items: center;
      gap: 12px;
    }

    .btn {
      background: rgba(255, 255, 255, 0.06);
      border: 1px solid rgba(255, 255, 255, 0.15);
      color: #fff;
      padding: 7px 16px;
      border-radius: 6px;
      font-size: 12px;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      gap: 6px;
      transition: all 0.2s;
    }

    .btn:hover {
      background: rgba(0, 240, 255, 0.2);
      border-color: var(--cyan-core);
    }

    .range-group {
      display: flex;
      align-items: center;
      gap: 10px;
      font-size: 12px;
      color: var(--text-muted);
    }

    .range-group input[type=range] {
      accent-color: var(--cyan-core);
      cursor: pointer;
      width: 140px;
    }

    .status-monitor {
      display: flex;
      gap: 20px;
      font-family: var(--font-mono);
      font-size: 12px;
    }

    .metric {
      display: flex;
      gap: 6px;
      align-items: center;
    }

    .metric-dot {
      width: 7px;
      height: 7px;
      border-radius: 50%;
      background: #475569;
    }

    .metric-dot.on-cyan {
      background: var(--cyan-core);
      box-shadow: 0 0 8px var(--cyan-core);
    }

    .metric-dot.on-amber {
      background: var(--amber-tape);
      box-shadow: 0 0 8px var(--amber-tape);
    }
  </style>
</head>
<body>

<div class="container">
  <!-- 头部信息 -->
  <header class="header">
    <div class="title-group">
      <h1>极耳根部 R 角自适应贴合机构 <span class="badge-ifr">TRIZ 最终理想解 (IFR)</span></h1>
    </div>
    <div class="meta-tags">
      <div class="meta-tag">膜厚: <span>1.0mm (A30)</span></div>
      <div class="meta-tag">节拍: <span>1.0s/pcs</span></div>
      <div class="meta-tag">精度: <span>±0.3mm</span></div>
    </div>
  </header>

  <!-- SVG 主体工作区 -->
  <div class="stage-wrapper">
    <svg id="animCanvas" viewBox="0 0 960 520">
      <defs>
        <!-- 渐变 & 滤镜 -->
        <linearGradient id="metalGrad" x1="0" y1="0" x2="1" y2="0">
          <stop offset="0%" stop-color="#475569" />
          <stop offset="50%" stop-color="#94a3b8" />
          <stop offset="100%" stop-color="#334155" />
        </linearGradient>

        <linearGradient id="cellBodyGrad" x1="0" y1="0" x2="0" y2="1">
          <stop offset="0%" stop-color="#1e293b" />
          <stop offset="100%" stop-color="#0f172a" />
        </linearGradient>

        <linearGradient id="tabGrad" x1="0" y1="0" x2="1" y2="0">
          <stop offset="0%" stop-color="#d97706" />
          <stop offset="40%" stop-color="#fbbf24" />
          <stop offset="100%" stop-color="#b45309" />
        </linearGradient>

        <radialGradient id="airGlow" cx="50%" cy="50%" r="50%">
          <stop offset="0%" stop-color="#00f0ff" stop-opacity="0.6" />
          <stop offset="100%" stop-color="#00f0ff" stop-opacity="0" />
        </radialGradient>

        <filter id="glowEffect" x="-20%" y="-20%" width="140%" height="140%">
          <feGaussianBlur stdDeviation="3" result="blur" />
          <feMerge>
            <feMergeNode in="blur" />
            <feMergeNode in="SourceGraphic" />
          </feMerge>
        </filter>
      </defs>

      <!-- 1. 背景标尺与坐标基准 -->
      <g opacity="0.15">
        <line x1="100" y1="420" x2="860" y2="420" stroke="#38bdf8" stroke-dasharray="4,4" />
        <line x1="560" y1="80" x2="560" y2="460" stroke="#38bdf8" stroke-dasharray="4,4" />
      </g>

      <!-- 2. 电芯底座与极耳 (带真实根部 R 角模型) -->
      <g id="batteryBase">
        <!-- 电芯顶盖本体 (大阶梯) -->
        <path d="M 320 420 L 548 420 Q 560 420 560 408 L 560 300 L 600 300 L 600 420 L 780 420 L 780 470 L 320 470 Z" fill="url(#cellBodyGrad)" stroke="#334155" stroke-width="2" />
        
        <!-- 极耳铜箔柱 (凸出极柱) -->
        <path d="M 560 408 L 560 270 L 585 270 L 585 420 Z" fill="url(#tabGrad)" stroke="#78350f" stroke-width="1.5" />
        
        <!-- 极耳根部 R角高亮提示 (重点观察区域) -->
        <path d="M 548 420 Q 560 420 560 408" fill="none" stroke="#f59e0b" stroke-width="2.5" />
        <circle cx="560" cy="420" r="12" fill="none" stroke="#f59e0b" stroke-dasharray="2,2" opacity="0.6" />
        <text x="490" y="445" fill="#94a3b8" font-size="11" font-family="monospace">根部 R 角 (R=1.5mm)</text>
        <path d="M 545 435 L 555 422" stroke="#64748b" stroke-width="1" />
      </g>

      <!-- 3. 送料与切刀机构区 (左上方) -->
      <g id="feedSection">
        <!-- 供料带卷轴示意 -->
        <circle cx="160" cy="180" r="36" fill="#1e293b" stroke="#475569" stroke-width="2" />
        <circle cx="160" cy="180" r="14" fill="#0f172a" stroke="#64748b" stroke-width="2" />
        
        <!-- 送料防滑双辊 (一辊包胶) -->
        <g id="feedRollers">
          <circle id="rollerTop" cx="260" cy="165" r="16" fill="#334155" stroke="#00f0ff" stroke-width="1.5" />
          <circle id="rollerBottom" cx="260" cy="201" r="16" fill="#1e293b" stroke="#64748b" stroke-width="1.5" />
          <line x1="260" y1="165" x2="260" y2="175" stroke="#00f0ff" stroke-width="2" />
        </g>
        <text x="235" y="140" fill="#94a3b8" font-size="11">送料辊对</text>

        <!-- 浮动切刀机构 -->
        <g id="cutterGroup" transform="translate(325, 140)">
          <path d="M 0 0 L 10 25 L -10 25 Z" fill="#94a3b8" stroke="#cbd5e1" stroke-width="1.5" id="blade" />
          <text x="-12" y="-6" fill="#64748b" font-size="10">特氟龙切刀</text>
        </g>

        <!-- 送料路径上的胶带 (动态延伸) -->
        <path id="tapeInfeed" d="M 196 183 L 260 183 L 340 183" fill="none" stroke="#f59e0b" stroke-width="3" stroke-linecap="round" />
      </g>

      <!-- 4. 同轴压头与吸嘴复合模组 (执行核心部件) -->
      <!-- 整体通过 transform Y 轴驱动下降与抬升 -->
      <g id="headAssembly" transform="translate(480, 100)">
        
        <!-- (1) 主气缸活塞轴 -->
        <rect x="52" y="-40" width="16" height="60" fill="url(#metalGrad)" stroke="#334155" />
        <rect x="40" y="-55" width="40" height="15" fill="#334155" rx="3" />
        
        <!-- (2) 铝合金气室基座 -->
        <rect x="0" y="20" width="120" height="65" rx="4" fill="#1e293b" stroke="#38bdf8" stroke-width="1.8" />
        <text x="28" y="42" fill="#94a3b8" font-size="11">铝合金气室腔</text>

        <!-- 进气管口 -->
        <path d="M 120 50 L 140 50 L 140 10" fill="none" stroke="#38bdf8" stroke-width="3" stroke-linecap="round" />
        <text x="146" y="25" fill="#38bdf8" font-size="10" font-family="monospace">P_in: 0.12MPa</text>

        <!-- 气室内部气压流动动画粒子群 -->
        <g id="pressureAirField" opacity="0">
          <ellipse cx="60" cy="60" rx="42" ry="20" fill="url(#airGlow)" />
          <!-- 压力自适应面压箭头组 -->
          <g stroke="#00f0ff" stroke-width="1.5" stroke-linecap="round">
            <line x1="30" y1="65" x2="30" y2="82" marker-end="url(#arrow)" />
            <line x1="50" y1="65" x2="50" y2="85" />
            <line x1="70" y1="65" x2="70" y2="87" />
            <line x1="88" y1="65" x2="88" y2="84" />
            <line x1="102" y1="62" x2="108" y2="78" />
          </g>
        </g>

        <!-- (3) A30 柔性高弹硅胶膜 (关键创新破局点) -->
        <!-- d 路径将在充气贴合阶段变形为包覆 R 角形态 -->
        <path id="siliconeMembrane" 
              d="M 10 85 Q 60 85 110 85" 
              fill="none" 
              stroke="#38bdf8" 
              stroke-width="5" 
              stroke-linecap="round" 
              filter="url(#glowEffect)" />
        <text x="12" y="102" fill="#38bdf8" font-size="10">A30超柔硅胶膜 (1.0mm)</text>

        <!-- (4) 外侧避位式多孔真空吸嘴 (左右对称托持) -->
        <!-- 左吸嘴臂 -->
        <g id="vacuumNozzleLeft" transform="translate(-16, 25)">
          <path d="M 0 0 L 12 0 L 12 65 L 0 65 Z" fill="#334155" stroke="#64748b" />
          <!-- 真空吸孔阵列 -->
          <circle cx="6" cy="20" r="2" fill="#00f0ff" />
          <circle cx="6" cy="35" r="2" fill="#00f0ff" />
          <circle cx="6" cy="50" r="2" fill="#00f0ff" />
          <path id="vacFlowL" d="M 6 65 L 6 72" stroke="#00f0ff" stroke-width="2" stroke-dasharray="2,2" opacity="0" />
        </g>

        <!-- 右吸嘴臂 -->
        <g id="vacuumNozzleRight" transform="translate(124, 25)">
          <path d="M 0 0 L 12 0 L 12 65 L 0 65 Z" fill="#334155" stroke="#64748b" />
          <circle cx="6" cy="20" r="2" fill="#00f0ff" />
          <circle cx="6" cy="35" r="2" fill="#00f0ff" />
          <circle cx="6" cy="50" r="2" fill="#00f0ff" />
          <path id="vacFlowR" d="M 6 65 L 6 72" stroke="#00f0ff" stroke-width="2" stroke-dasharray="2,2" opacity="0" />
        </g>
        <text x="-48" y="60" fill="#94a3b8" font-size="10">真空吸附孔</text>
        <line x1="-5" y1="58" x2="-2" y2="58" stroke="#64748b" />

        <!-- (5) 吸附在吸嘴底部的定长胶带 (搬运目标物) -->
        <path id="heldTape" d="M -10 90 L 130 90" stroke="#f59e0b" stroke-width="3" stroke-linecap="round" opacity="0" />
      </g>

      <!-- 5. 最终贴合于电芯上的定型胶带 (呈现自适应完全贴合无气泡状态) -->
      <path id="bondedTapeFinal" 
            d="M 470 420 L 548 420 Q 560 420 560 408 L 560 340" 
            fill="none" 
            stroke="#f59e0b" 
            stroke-width="3.5" 
            stroke-linecap="round" 
            opacity="0" 
            filter="url(#glowEffect)" />

      <!-- 6. 创新机理高亮说明气泡标签 -->
      <g id="idealFeatureCallout" transform="translate(680, 260)" opacity="0">
        <rect x="0" y="0" width="220" height="74" rx="8" fill="rgba(15, 23, 42, 0.9)" stroke="#00f0ff" stroke-width="1.2" />
        <text x="14" y="24" fill="#00f0ff" font-weight="700" font-size="12">★ 自适应流体均压作用</text>
        <text x="14" y="44" fill="#cbd5e1" font-size="11">气动薄膜消除刚性峰值应力</text>
        <text x="14" y="62" fill="#10b981" font-size="11">● 根部100%包裹 零微气泡/翘边</text>
      </g>
    </svg>
  </div>

  <!-- 底部仪表与交互区 -->
  <footer class="dashboard">
    <!-- 动作时序进度槽 (严格对应 1.0s 协同动作) -->
    <div class="timeline-steps">
      <div class="step-item" id="step0">
        <span class="step-name">1. 进给切胶</span>
        <span class="step-time">0.0s - 0.20s</span>
      </div>
      <div class="step-item" id="step1">
        <span class="step-name">2. 切断吸持</span>
        <span class="step-time">0.20s - 0.35s</span>
      </div>
      <div class="step-item" id="step2">
        <span class="step-name">3. 搬运下压</span>
        <span class="step-time">0.35s - 0.55s</span>
      </div>
      <div class="step-item" id="step3">
        <span class="step-name">4. 充气自适应包覆</span>
        <span class="step-time">0.55s - 0.80s</span>
      </div>
      <div class="step-item" id="step4">
        <span class="step-name">5. 泄压复位</span>
        <span class="step-time">0.80s - 1.00s</span>
      </div>
    </div>

    <!-- 交互控件 & 传感器状态反馈 -->
    <div class="controls-row">
      <div class="ctrl-group">
        <button class="btn" id="btnTogglePlay">
          <svg width="12" height="12" viewBox="0 0 24 24" fill="currentColor">
            <polygon points="5 3 19 12 5 21 5 3"></polygon>
          </svg>
          <span id="playBtnText">暂停动画</span>
        </button>
        <button class="btn" id="btnReset">重置循环</button>
      </div>

      <!-- 实时传感器读数仪表 -->
      <div class="status-monitor">
        <div class="metric">
          <div class="metric-dot" id="dotVac"></div>
          <span>吸嘴真空度: <b id="valVac">-0 kPa</b></span>
        </div>
        <div class="metric">
          <div class="metric-dot" id="dotAir"></div>
          <span>气囊压力: <b id="valAir">0.00 MPa</b></span>
        </div>
        <div class="metric">
          <span>贴合面压: <b id="valPressure" style="color:var(--text-muted)">无接触</b></span>
        </div>
      </div>

      <!-- 交互式压力调节微调 (让用户体验气压自适应贴合变量) -->
      <div class="range-group">
        <label for="pressureRange">预设工作气压:</label>
        <input type="range" id="pressureRange" min="0.08" max="0.15" step="0.01" value="0.12">
        <span id="pressureLabel" style="font-family:var(--font-mono); color:var(--cyan-core); width:50px">0.12MPa</span>
      </div>
    </div>
  </footer>
</div>

<script>
  // DOM 元素引用
  const headAssembly = document.getElementById('headAssembly');
  const cutterGroup = document.getElementById('cutterGroup');
  const rollerTop = document.getElementById('rollerTop');
  const tapeInfeed = document.getElementById('tapeInfeed');
  const heldTape = document.getElementById('heldTape');
  const siliconeMembrane = document.getElementById('siliconeMembrane');
  const bondedTapeFinal = document.getElementById('bondedTapeFinal');
  const pressureAirField = document.getElementById('pressureAirField');
  const vacFlowL = document.getElementById('vacFlowL');
  const vacFlowR = document.getElementById('vacFlowR');
  const idealFeatureCallout = document.getElementById('idealFeatureCallout');

  // 仪表盘指示
  const steps = [
    document.getElementById('step0'),
    document.getElementById('step1'),
    document.getElementById('step2'),
    document.getElementById('step3'),
    document.getElementById('step4')
  ];
  const dotVac = document.getElementById('dotVac');
  const dotAir = document.getElementById('dotAir');
  const valVac = document.getElementById('valVac');
  const valAir = document.getElementById('valAir');
  const valPressure = document.getElementById('valPressure');

  // 控件
  const btnTogglePlay = document.getElementById('btnTogglePlay');
  const playBtnText = document.getElementById('playBtnText');
  const btnReset = document.getElementById('btnReset');
  const pressureRange = document.getElementById('pressureRange');
  const pressureLabel = document.getElementById('pressureLabel');

  // 运行状态变量
  let isPlaying = true;
  let targetAirPressure = 0.12;
  const CYCLE_TIME = 3600; // 动画放慢至 3.6 秒循环一次,便于清晰观摩工程细节
  let startTime = performance.now();
  let pausedAt = 0;
  let animationFrameId = null;

  // 硅胶膜形态插值路径
  // 原始扁平状态
  const MEMBRANE_FLAT = "M 10 85 Q 60 85 110 85";
  // 气压包裹 R 状态 (下凸并自适应包裹阶梯与角部)
  const MEMBRANE_WRAPPED = "M 8 85 C 40 85, 68 88, 70 102 C 71 114, 76 122, 92 120 C 105 119, 110 100, 112 85";

  // 插值工具函数
  function lerp(a, b, t) {
    return a + (b - a) * t;
  }

  function setActiveStep(idx) {
    steps.forEach((el, i) => {
      if (i === idx) {
        el.classList.add('active');
      } else {
        el.classList.remove('active');
      }
    });
  }

  // 动画主渲染循环
  function tick(timestamp) {
    if (!isPlaying) return;

    const elapsed = (timestamp - startTime) % CYCLE_TIME;
    const progress = elapsed / CYCLE_TIME; // 0.0 ~ 1.0

    // ===== 阶段 1: 进给胶带 (0.00 ~ 0.20) =====
    if (progress < 0.20) {
      const p = progress / 0.20;
      setActiveStep(0);

      // 送料辊旋转
      rollerTop.setAttribute('transform', `rotate(${p * 180} 260 165)`);
      
      // 胶带向右延伸进入吸嘴托持区
      const tapeW = lerp(80, 200, p);
      tapeInfeed.setAttribute('d', `M 196 183 L ${196 + tapeW} 183`);
      tapeInfeed.style.opacity = '1';

      // 切刀待命
      cutterGroup.setAttribute('transform', 'translate(325, 140)');

      // 压头在原点高度待命
      headAssembly.setAttribute('transform', 'translate(480, 100)');
      siliconeMembrane.setAttribute('d', MEMBRANE_FLAT);
      heldTape.style.opacity = '0';
      bondedTapeFinal.style.opacity = '0';
      pressureAirField.setAttribute('opacity', '0');
      idealFeatureCallout.setAttribute('opacity', '0');

      // 传感器
      valVac.textContent = '-5 kPa';
      valAir.textContent = '0.00 MPa';
      valPressure.textContent = '空载';
      valPressure.style.color = 'var(--text-muted)';
      dotVac.className = 'metric-dot';
      dotAir.className = 'metric-dot';
      vacFlowL.style.opacity = '0';
      vacFlowR.style.opacity = '0';
    } 
    // ===== 阶段 2: 切断并吸持 (0.20 ~ 0.35) =====
    else if (progress < 0.35) {
      const p = (progress - 0.20) / 0.15;
      setActiveStep(1);

      // 切刀快速冲压动作 (下冲再回弹)
      const cutOffset = Math.sin(p * Math.PI) * 22;
      cutterGroup.setAttribute('transform', `translate(325, ${140 + cutOffset})`);

      // 胶带已被切断,交由吸嘴吸持接管
      tapeInfeed.style.opacity = p > 0.5 ? '0.4' : '1';
      heldTape.style.opacity = '1';
      
      // 真空吸嘴建压
      valVac.textContent = '-42 kPa';
      dotVac.className = 'metric-dot on-cyan';
      vacFlowL.style.opacity = '1';
      vacFlowR.style.opacity = '1';

      valAir.textContent = '0.00 MPa';
      valPressure.textContent = '真空托持中';
      valPressure.style.color = 'var(--amber-tape)';
    } 
    // ===== 阶段 3: 搬运下降 (0.35 ~ 0.55) =====
    else if (progress < 0.55) {
      const p = (progress - 0.35) / 0.20;
      setActiveStep(2);

      // 平滑缓动下行到贴合位
      const easeDown = Math.sin((p * Math.PI) / 2);
      const curY = lerp(100, 318, easeDown);
      headAssembly.setAttribute('transform', `translate(480, ${curY})`);

      heldTape.style.opacity = '1';
      valVac.textContent = '-45 kPa';
      valAir.textContent = '0.02 MPa';
      valPressure.textContent = '预贴合就位';
      valPressure.style.color = '#38bdf8';
    } 
    // ===== 阶段 4: 气囊充气自适应包覆贴合 (0.55 ~ 0.80) [核心亮点] =====
    else if (progress < 0.80) {
      const p = (progress - 0.55) / 0.25;
      setActiveStep(3);

      headAssembly.setAttribute('transform', 'translate(480, 318)');

      // 气囊充气膨胀:硅胶膜自适应包裹 R 角
      if (p < 0.5) {
        siliconeMembrane.setAttribute('d', MEMBRANE_WRAPPED);
        pressureAirField.setAttribute('opacity', p * 2);
      } else {
        siliconeMembrane.setAttribute('d', MEMBRANE_WRAPPED);
        pressureAirField.setAttribute('opacity', '1');
      }

      // 胶带转为已贴合在电芯 R 处的完全吻合状态
      heldTape.style.opacity = '0';
      bondedTapeFinal.style.opacity = '1';

      // 高亮气泡呼出
      idealFeatureCallout.setAttribute('opacity', Math.min(1, (p * 1.5)));

      // 传感器与状态高亮
      valVac.textContent = '-15 kPa (释放)';
      valAir.textContent = `${targetAirPressure.toFixed(2)} MPa`;
      valPressure.textContent = '面压均匀自适应 (0.12MPa)';
      valPressure.style.color = 'var(--cyan-core)';
      dotAir.className = 'metric-dot on-cyan';
      vacFlowL.style.opacity = '0';
      vacFlowR.style.opacity = '0';
    } 
    // ===== 阶段 5: 泄压、抬升复位 (0.80 ~ 1.00) =====
    else {
      const p = (progress - 0.80) / 0.20;
      setActiveStep(4);

      // 气室泄压,硅胶膜靠高弹性瞬间回弹扁平
      siliconeMembrane.setAttribute('d', MEMBRANE_FLAT);
      pressureAirField.setAttribute('opacity', `${Math.max(0, 1 - p * 3)}`);
      idealFeatureCallout.setAttribute('opacity', `${Math.max(0, 1 - p * 2)}`);

      // 气缸复位升起
      const easeUp = 1 - Math.cos((p * Math.PI) / 2);
      const curY = lerp(318, 100, easeUp);
      headAssembly.setAttribute('transform', `translate(480, ${curY})`);

      // 胶带完好贴合在电芯表面
      bondedTapeFinal.style.opacity = '1';

      // 传感器参数复位
      valVac.textContent = '-0 kPa';
      valAir.textContent = `${lerp(targetAirPressure, 0, p).toFixed(2)} MPa`;
      valPressure.textContent = '周期完成 / 准备下一件';
      valPressure.style.color = 'var(--success)';
      dotAir.className = 'metric-dot';
      dotVac.className = 'metric-dot';
    }

    animationFrameId = requestAnimationFrame(tick);
  }

  // 播放 / 暂停切换
  btnTogglePlay.addEventListener('click', () => {
    if (isPlaying) {
      isPlaying = false;
      pausedAt = performance.now() - startTime;
      cancelAnimationFrame(animationFrameId);
      playBtnText.textContent = '继续播放';
    } else {
      isPlaying = true;
      startTime = performance.now() - pausedAt;
      playBtnText.textContent = '暂停动画';
      animationFrameId = requestAnimationFrame(tick);
    }
  });

  // 重置动画到初始时刻
  btnReset.addEventListener('click', () => {
    startTime = performance.now();
    pausedAt = 0;
    if (!isPlaying) {
      isPlaying = true;
      playBtnText.textContent = '暂停动画';
      animationFrameId = requestAnimationFrame(tick);
    }
  });

  // 调节气囊气压滑块交互
  pressureRange.addEventListener('input', (e) => {
    targetAirPressure = parseFloat(e.target.value);
    pressureLabel.textContent = `${targetAirPressure.toFixed(2)}MPa`;
  });

  // 页面自启动保证
  window.addEventListener('DOMContentLoaded', () => {
    startTime = performance.now();
    animationFrameId = requestAnimationFrame(tick);
  });

  // 防止标签页切出后时间错乱
  document.addEventListener('visibilitychange', () => {
    if (!document.hidden && isPlaying) {
      startTime = performance.now();
    }
  });
</script>
</body>
</html>
积分规则:每轮对话扣10分