分享图
动画工坊
引擎就绪
<!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-color: #0b1118;
      --panel-bg: rgba(16, 25, 38, 0.75);
      --border-color: rgba(64, 120, 192, 0.25);
      --accent-cyan: #00e5ff;
      --accent-amber: #ffab00;
      --accent-green: #00e676;
      --accent-bubble: #ff5252;
      --text-dim: #78909c;
      --text-main: #eceff1;
      --font-mono: 'JetBrains Mono', 'Fira Code', 'Roboto Mono', monospace;
      --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    }

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

    body {
      background-color: var(--bg-color);
      color: var(--text-main);
      font-family: var(--font-sans);
      min-height: 100vh;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      overflow-x: hidden;
      background-image: 
        radial-gradient(circle at 50% 30%, rgba(0, 229, 255, 0.05) 0%, transparent 70%),
        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%, 30px 30px, 30px 30px;
    }

    .main-container {
      width: 100%;
      max-width: 1060px;
      padding: 24px;
      display: flex;
      flex-direction: column;
      gap: 16px;
    }

    /* 顶部仪表栏 */
    .telemetry-bar {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 12px;
    }

    .telemetry-card {
      background: var(--panel-bg);
      border: 1px solid var(--border-color);
      border-radius: 6px;
      padding: 10px 14px;
      backdrop-filter: blur(8px);
      position: relative;
      overflow: hidden;
    }

    .telemetry-card::before {
      content: '';
      position: absolute;
      top: 0; left: 0; width: 3px; height: 100%;
      background: var(--accent-cyan);
      opacity: 0.6;
    }

    .card-label {
      font-size: 11px;
      color: var(--text-dim);
      letter-spacing: 0.5px;
      text-transform: uppercase;
      font-family: var(--font-mono);
      margin-bottom: 4px;
    }

    .card-value {
      font-size: 18px;
      font-family: var(--font-mono);
      font-weight: 600;
      color: var(--text-main);
      display: flex;
      align-items: baseline;
      gap: 4px;
    }

    .card-value span.unit {
      font-size: 11px;
      font-weight: normal;
      color: var(--text-dim);
    }

    /* 画布外框 */
    .viewport-wrapper {
      position: relative;
      background: var(--panel-bg);
      border: 1px solid var(--border-color);
      border-radius: 8px;
      box-shadow: 0 16px 40px -10px rgba(0, 0, 0, 0.5);
      backdrop-filter: blur(12px);
      overflow: hidden;
      display: flex;
      justify-content: center;
      align-items: center;
    }

    svg.viewport {
      width: 100%;
      height: auto;
      max-height: 520px;
      display: block;
    }

    /* 状态指示小标 */
    .status-badge {
      position: absolute;
      top: 14px;
      left: 16px;
      display: flex;
      align-items: center;
      gap: 8px;
      font-size: 12px;
      font-family: var(--font-mono);
      background: rgba(0, 0, 0, 0.45);
      padding: 6px 12px;
      border-radius: 20px;
      border: 1px solid rgba(255, 255, 255, 0.08);
      pointer-events: none;
    }

    .pulse-dot {
      width: 8px;
      height: 8px;
      border-radius: 50%;
      background: var(--accent-cyan);
      box-shadow: 0 0 8px var(--accent-cyan);
      animation: pulse 1.8s infinite;
    }

    @keyframes pulse {
      0%, 100% { opacity: 1; transform: scale(1); }
      50% { opacity: 0.4; transform: scale(0.85); }
    }

    /* 底部控制台 */
    .control-console {
      background: var(--panel-bg);
      border: 1px solid var(--border-color);
      border-radius: 6px;
      padding: 12px 20px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 20px;
      backdrop-filter: blur(8px);
    }

    .btn-group {
      display: flex;
      align-items: center;
      gap: 10px;
    }

    .ctrl-btn {
      background: rgba(255, 255, 255, 0.06);
      border: 1px solid rgba(255, 255, 255, 0.12);
      color: var(--text-main);
      padding: 8px 16px;
      font-size: 13px;
      border-radius: 4px;
      cursor: pointer;
      font-family: var(--font-sans);
      display: inline-flex;
      align-items: center;
      gap: 6px;
      transition: all 0.2s ease;
    }

    .ctrl-btn:hover {
      background: rgba(0, 229, 255, 0.15);
      border-color: var(--accent-cyan);
      color: #fff;
    }

    .ctrl-btn.active {
      background: var(--accent-cyan);
      color: #0b1118;
      font-weight: 600;
      border-color: var(--accent-cyan);
    }

    .slider-container {
      display: flex;
      align-items: center;
      gap: 12px;
      flex: 1;
      max-width: 420px;
    }

    .slider-label {
      font-size: 12px;
      color: var(--text-dim);
      font-family: var(--font-mono);
      white-space: nowrap;
    }

    input[type=range] {
      -webkit-appearance: none;
      width: 100%;
      height: 4px;
      background: rgba(255, 255, 255, 0.15);
      border-radius: 2px;
      outline: none;
    }

    input[type=range]::-webkit-slider-thumb {
      -webkit-appearance: none;
      width: 14px;
      height: 14px;
      border-radius: 50%;
      background: var(--accent-cyan);
      cursor: pointer;
      box-shadow: 0 0 8px var(--accent-cyan);
      transition: transform 0.15s ease;
    }

    input[type=range]::-webkit-slider-thumb:hover {
      transform: scale(1.25);
    }
  </style>
</head>
<body>

<div class="main-container">
  <!-- 仪表参数 -->
  <div class="telemetry-bar">
    <div class="telemetry-card">
      <div class="card-label">滚压法向力 (Fn)</div>
      <div class="card-value" id="val-force">3.2 <span class="unit">N (恒定浮动)</span></div>
    </div>
    <div class="telemetry-card">
      <div class="card-label">滚压行进速度 (v)</div>
      <div class="card-value" id="val-speed">150 <span class="unit">mm/s</span></div>
    </div>
    <div class="telemetry-card">
      <div class="card-label">自适应浮动行程 (Δz)</div>
      <div class="card-value" id="val-stroke">1.8 <span class="unit">/ 3.0 mm</span></div>
    </div>
    <div class="telemetry-card">
      <div class="card-label">贴合排气残余率</div>
      <div class="card-value" style="color: var(--accent-green);" id="val-air">0.0 <span class="unit">% 无泡密封</span></div>
    </div>
  </div>

  <!-- 主仿真视口 -->
  <div class="viewport-wrapper">
    <div class="status-badge">
      <div class="pulse-dot"></div>
      <span id="cycle-step-text">时序执行:吸嘴预贴定位中 (0.2s)</span>
    </div>

    <svg class="viewport" viewBox="0 0 1000 520">
      <defs>
        <!-- 蓝图背景网格 -->
        <pattern id="grid" width="20" height="20" patternUnits="userSpaceOnUse">
          <path d="M 20 0 L 0 0 0 20" fill="none" stroke="rgba(255,255,255,0.03)" stroke-width="1"/>
        </pattern>

        <!-- 极耳金属渐变 -->
        <linearGradient id="tabGrad" x1="0" y1="0" x2="0" y2="1">
          <stop offset="0%" stop-color="#b0bec5"/>
          <stop offset="50%" stop-color="#eceff1"/>
          <stop offset="100%" stop-color="#78909c"/>
        </linearGradient>

        <!-- 电芯外壳渐变 -->
        <linearGradient id="caseGrad" x1="0" y1="0" x2="1" y2="0">
          <stop offset="0%" stop-color="#1e293b"/>
          <stop offset="100%" stop-color="#334155"/>
        </linearGradient>

        <!-- 胶带琥珀色聚酰亚胺 (PI) 渐变 -->
        <linearGradient id="tapeGrad" x1="0" y1="0" x2="0" y2="1">
          <stop offset="0%" stop-color="#ffb74d" stop-opacity="0.9"/>
          <stop offset="100%" stop-color="#f57c00" stop-opacity="0.9"/>
        </linearGradient>

        <!-- 胶带已完全排气贴合渐变 -->
        <linearGradient id="tapeBondedGrad" x1="0" y1="0" x2="1" y2="0">
          <stop offset="0%" stop-color="#00e676" stop-opacity="0.95"/>
          <stop offset="100%" stop-color="#00b0ff" stop-opacity="0.95"/>
        </linearGradient>

        <!-- 邵氏 A50 聚氨酯包胶滚轮质感 -->
        <radialGradient id="rollerRubber" cx="40%" cy="40%" r="60%">
          <stop offset="0%" stop-color="#4dd0e1"/>
          <stop offset="70%" stop-color="#00838f"/>
          <stop offset="100%" stop-color="#004d40"/>
        </radialGradient>

        <!-- 浮动弹簧滤镜光效 -->
        <filter id="glow" x="-20%" y="-20%" width="140%" height="140%">
          <feGaussianBlur stdDeviation="3" result="blur" />
          <feComposite in="SourceGraphic" in2="blur" operator="over" />
        </filter>
      </defs>

      <!-- 底网格 -->
      <rect width="1000" height="520" fill="url(#grid)"/>

      <!-- 坐标系微弱标尺线 -->
      <g stroke="rgba(255,255,255,0.06)" stroke-width="1" stroke-dasharray="2,4">
        <line x1="260" y1="40" x2="260" y2="480"/>
        <line x1="40" y1="360" x2="960" y2="360"/>
      </g>

      <!-- 1. 工件基座:电芯壳体与 R 角极耳 -->
      <g id="workpiece">
        <!-- 电芯外壳上端面 -->
        <path d="M 60,390 L 260,390 Q 285,390 285,365 L 285,355" fill="none" stroke="#64748b" stroke-width="2"/>
        <rect x="60" y="390" width="225" height="100" fill="url(#caseGrad)" stroke="#475569" stroke-width="1.5"/>
        
        <!-- 极耳根部阶梯台阶 & R 角过渡区 (半径 R=4mm) -->
        <!-- 极耳水平主体延伸,厚度约 0.2mm,高亮银白色 -->
        <path id="tab-contour" d="M 285,365 Q 285,360 295,360 L 920,360 L 920,366 L 295,366 Q 280,366 280,380 L 280,490" 
              fill="url(#tabGrad)" stroke="#90a4ae" stroke-width="1"/>
        
        <!-- R角标记辅助引导 -->
        <circle cx="285" cy="365" r="3" fill="none" stroke="var(--accent-amber)" stroke-width="1.5"/>
        <text x="235" y="348" fill="var(--accent-amber)" font-size="11" font-family="var(--font-mono)">根部 R 角 (起滚切线点)</text>
        <line x1="285" y1="365" x2="245" y2="352" stroke="var(--accent-amber)" stroke-width="1" stroke-dasharray="2,2"/>
      </g>

      <!-- 2. 被贴物:聚酰亚胺 (PI) 胶带与气泡逸出层 -->
      <g id="tape-assembly">
        <!-- 未滚压的微凸漂浮段(动态更新 d 路径) -->
        <path id="tape-floating" d="M 285,359 L 880,335 L 880,339 L 285,363 Z" fill="url(#tapeGrad)"/>
        
        <!-- 已滚压完全贴合段(完全平服,无气泡) -->
        <path id="tape-bonded" d="M 285,359 L 285,359 L 285,363 L 285,363 Z" fill="url(#tapeBondedGrad)"/>

        <!-- 气泡单向逸出粒子流容器 -->
        <g id="bubble-emitter"></g>
      </g>

      <!-- 3. 真空吸嘴预贴机构 (轻触吸附,之后解除) -->
      <g id="vacuum-nozzle" transform="translate(320, 240)">
        <!-- 气道主体 -->
        <path d="M -18,-90 L 18,-90 L 14,-10 L 24,0 L -24,0 L -14,-10 Z" fill="#37474f" stroke="#78909c" stroke-width="1.5"/>
        <line x1="0" y1="-85" x2="0" y2="-10" stroke="#00e5ff" stroke-width="2" stroke-dasharray="4,4" opacity="0.8"/>
        <!-- 硅胶吸盘唇边 (微触定位) -->
        <ellipse cx="0" cy="0" rx="24" ry="4" fill="#00bcd4" opacity="0.85"/>
        <text x="0" y="-100" fill="#90a4ae" font-size="11" text-anchor="middle" font-family="var(--font-mono)">真空预贴吸嘴 (仅定位)</text>
      </g>

      <!-- 4. 核心创新组件:15° 斜置浮动弹性压辊系统 -->
      <!-- carriage-assembly 沿着水平滚压前进 -->
      <g id="carriage-assembly" transform="translate(290, 0)">
        
        <!-- 水平驱动气缸主轴线指示 -->
        <line x1="-300" y1="120" x2="600" y2="120" stroke="rgba(0, 229, 255, 0.2)" stroke-width="2" stroke-dasharray="6,6"/>
        
        <!-- 单轴直线气缸驱动座 -->
        <rect x="-35" y="95" width="70" height="50" rx="4" fill="#1e293b" stroke="var(--accent-cyan)" stroke-width="1.5"/>
        <circle cx="0" cy="120" r="4" fill="var(--accent-cyan)"/>
        <text x="0" y="85" fill="var(--accent-cyan)" font-size="11" text-anchor="middle" font-family="var(--font-mono)">单轴直线驱动滑台</text>

        <!-- 15° 斜置安装悬臂 (倾角让滚轮优先从切线导入排气) -->
        <g id="tilted-bracket" transform="rotate(15, 0, 145)">
          
          <!-- 滑轨导柱外壳 -->
          <rect x="-14" y="145" width="28" height="110" rx="4" fill="#263238" stroke="#546e7a" stroke-width="1.5"/>
          
          <!-- 限位调节螺栓 (控制最大下压量 ≤ 0.3mm,防伤极耳) -->
          <g id="limit-screw" transform="translate(0, 145)">
            <rect x="-4" y="-20" width="8" height="20" fill="#cfd8dc" stroke="#37474f"/>
            <rect x="-8" y="-26" width="16" height="6" rx="2" fill="#90a4ae"/>
            <text x="18" y="-12" fill="#b0bec5" font-size="10" font-family="var(--font-mono)">限位深度: 0.3mm</text>
          </g>

          <!-- 内部恒力预紧弹簧 (随浮动行程压缩/舒张) -->
          <path id="floating-spring" d="M 0,165 
                   L 8,172 L -8,180 L 8,188 L -8,196 L 8,204 L -8,212 L 8,220 L 0,228" 
                fill="none" stroke="var(--accent-amber)" stroke-width="2.5" stroke-linecap="round"/>

          <!-- 浮动滑块部件 (带滚轮夹持叉) -->
          <g id="floating-slider" transform="translate(0, 60)">
            <rect x="-10" y="170" width="20" height="40" rx="3" fill="#37474f" stroke="#78909c"/>
            
            <!-- 轮叉支架 -->
            <path d="M -8,210 L -8,235 L 8,235 L 8,210" fill="none" stroke="#78909c" stroke-width="2.5"/>

            <!-- 邵氏 A50 包胶滚轮(直径 6mm,微凸鼓面利于向边缘排气) -->
            <g id="elastic-roller" transform="translate(0, 235)">
              <!-- 滚轮轮廓 -->
              <circle cx="0" cy="0" r="16" fill="url(#rollerRubber)" stroke="#e0f7fa" stroke-width="2"/>
              <!-- 滚轮旋转视觉标记槽 -->
              <circle cx="0" cy="0" r="13" fill="none" stroke="rgba(255,255,255,0.3)" stroke-width="1" stroke-dasharray="8,6"/>
              <line id="roller-spoke" x1="-14" y1="0" x2="14" y2="0" stroke="#ffffff" stroke-width="2"/>
              <circle cx="0" cy="0" r="4" fill="#263238" stroke="#80deea" stroke-width="1.5"/>

              <!-- 边缘微凸 (0.1mm) 夸张放大显示圈 -->
              <circle cx="0" cy="0" r="18" fill="none" stroke="var(--accent-cyan)" stroke-width="1" stroke-dasharray="2,3" opacity="0.6"/>
            </g>

            <!-- 法向力动态矢量箭头 -->
            <g id="force-vector" transform="translate(0, 235)" opacity="0">
              <line x1="0" y1="0" x2="0" y2="45" stroke="var(--accent-amber)" stroke-width="2.5" marker-end="url(#arrow)"/>
              <text x="12" y="38" fill="var(--accent-amber)" font-size="11" font-weight="bold" font-family="var(--font-mono)">Fn: 3.2N</text>
            </g>
          </g>
        </g>
      </g>

      <!-- 5. 局部排气微观放大视窗 (显式展现“气泡顺向排出”机理) -->
      <g id="micro-lens" transform="translate(740, 110)">
        <!-- 视窗背景 -->
        <circle cx="0" cy="0" r="82" fill="#131c27" stroke="rgba(0, 229, 255, 0.4)" stroke-width="2"/>
        <circle cx="0" cy="0" r="86" fill="none" stroke="rgba(255,255,255,0.08)" stroke-width="1" stroke-dasharray="4,6"/>
        <text x="0" y="-62" fill="var(--accent-cyan)" font-size="10" text-anchor="middle" font-family="var(--font-mono)">接触区微观放大 (10x)</text>

        <!-- 视窗内结构切片 -->
        <clipPath id="lens-clip">
          <circle cx="0" cy="0" r="80"/>
        </clipPath>
        
        <g clip-path="url(#lens-clip)">
          <!-- 极耳表面 -->
          <rect x="-85" y="22" width="170" height="60" fill="#90a4ae"/>
          <!-- 胶带层与粘接剂界面 -->
          <path d="M -85,15 Q -10,14 0,0 L 25,-35 L 85,-45 L 85,15 Z" fill="#ffb74d" opacity="0.75"/>
          <line x1="-85" y1="20" x2="0" y2="20" stroke="#00e676" stroke-width="4"/> <!-- 完全贴实区 -->
          
          <!-- 挤压滚轮局部圆弧 -->
          <circle cx="-5" cy="-75" r="85" fill="none" stroke="var(--accent-cyan)" stroke-width="18" opacity="0.85"/>
          
          <!-- 被驱动挤出的微观气泡流动动画 -->
          <circle cx="15" cy="5" r="4" fill="var(--accent-bubble)" opacity="0.85"/>
          <path d="M 18,2 Q 35,-6 55,-12" fill="none" stroke="var(--accent-bubble)" stroke-width="1.5" stroke-dasharray="2,3"/>
          <polygon points="56,-14 62,-11 58,-7" fill="var(--accent-bubble)"/>

          <text x="-40" y="52" fill="#eceff1" font-size="10" font-family="var(--font-mono)">已密实排气</text>
          <text x="18" y="-18" fill="var(--accent-bubble)" font-size="9" font-family="var(--font-mono)">沿前方逸出</text>
        </g>
      </g>

      <!-- 箭头定义 -->
      <defs>
        <marker id="arrow" viewBox="0 0 10 10" refX="6" refY="5" markerWidth="6" markerHeight="6" orient="auto-start-reverse">
          <path d="M 0 1 L 8 5 L 0 9 z" fill="var(--accent-amber)"/>
        </marker>
      </defs>
    </svg>
  </div>

  <!-- 底部操控条 -->
  <div class="control-console">
    <div class="btn-group">
      <button class="ctrl-btn active" id="btn-toggle">
        <svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor"><path d="M6 19h4V5H6v14zm8-14v14h4V5h-4z"/></svg>
        暂停演示
      </button>
      <button class="ctrl-btn" id="btn-restart">
        <svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor"><path d="M12 5V1L7 6l5 5V7c3.31 0 6 2.69 6 6s-2.69 6-6 6-6-2.69-6-6H4c0 4.42 3.58 8 8 8s8-3.58 8-8-3.58-8-8-8z"/></svg>
        单周期重置
      </button>
    </div>

    <div class="slider-container">
      <span class="slider-label">动作进度</span>
      <input type="range" id="progress-slider" min="0" max="1" step="0.001" value="0">
      <span class="slider-label" id="timeline-sec">0.00s</span>
    </div>
  </div>
</div>

<script>
  /**
   * 极耳贴胶“浮动弹性单向滚压”时序控制系统
   * 总周期 T = 0.75s (吸嘴预贴 0.2s -> 滚轮下压 0.1s -> 单向滚压排气 0.3s -> 复位 0.15s)
   */
  const DURATION = 3.2; // 仿真视觉降速到 3.2s 便于观察机理细节
  let isPlaying = true;
  let progress = 0;
  let lastTimestamp = null;

  // DOM 节点缓存
  const nozzle = document.getElementById('vacuum-nozzle');
  const carriage = document.getElementById('carriage-assembly');
  const slider = document.getElementById('floating-slider');
  const roller = document.getElementById('elastic-roller');
  const spoke = document.getElementById('roller-spoke');
  const forceVector = document.getElementById('force-vector');
  const spring = document.getElementById('floating-spring');
  const tapeFloating = document.getElementById('tape-floating');
  const tapeBonded = document.getElementById('tape-bonded');
  const bubbleEmitter = document.getElementById('bubble-emitter');
  const stepText = document.getElementById('cycle-step-text');
  const valForce = document.getElementById('val-force');
  const valSpeed = document.getElementById('val-speed');
  const valStroke = document.getElementById('val-stroke');
  const valAir = document.getElementById('val-air');
  const progressSlider = document.getElementById('progress-slider');
  const timelineSec = document.getElementById('timeline-sec');
  const btnToggle = document.getElementById('btn-toggle');
  const btnRestart = document.getElementById('btn-restart');

  // 生成游离排出气泡粒子
  const bubbleParticles = [];
  for (let i = 0; i < 9; i++) {
    const c = document.createElementNS('http://www.w3.org/2000/svg', 'circle');
    c.setAttribute('r', (2 + Math.random() * 2).toFixed(1));
    c.setAttribute('fill', '#ff5252');
    c.setAttribute('opacity', '0');
    bubbleEmitter.appendChild(c);
    bubbleParticles.push({
      el: c,
      baseX: 0,
      baseY: 0,
      vx: 20 + Math.random() * 30,
      vy: -15 - Math.random() * 20,
      life: 0
    });
  }

  function updateFrame(p) {
    // 阶段区间:
    // 0.00 ~ 0.25: [阶段一] 吸嘴预贴定位 (0.2s)
    // 0.25 ~ 0.38: [阶段二] 弹性滚轮下压切入 R 角根部 (0.1s)
    // 0.38 ~ 0.80: [阶段三] 单向滚压排气推进 (0.3s)
    // 0.80 ~ 1.00: [阶段四] 滚轮抬起、吸嘴释放复位 (0.15s)

    const actualTime = (p * 0.75).toFixed(2);
    timelineSec.textContent = `${actualTime}s / 0.75s`;
    progressSlider.value = p;

    let carriageX = 290;
    let rollerPressY = 30; // 初始抬起高度
    let nozzleY = 240;
    let rollerAngle = 0;
    let normalForce = 0.0;
    let floatDisp = 0.0;
    let currentSpeed = 0;
    let airRatio = 100;

    if (p < 0.25) {
      // === 阶段一:吸嘴预贴轻触定位 ===
      const t = p / 0.25;
      stepText.textContent = "时序 1/4: 真空吸嘴预贴轻触根部定位 (0.2s)";
      nozzleY = 240 + Math.sin(t * Math.PI * 0.5) * 115;
      tapeFloating.setAttribute('d', `M 285,359 L 880,335 L 880,339 L 285,363 Z`);
      tapeBonded.setAttribute('d', `M 285,359 L 285,359 L 285,363 L 285,363 Z`);
      forceVector.setAttribute('opacity', '0');
      airRatio = 100;
    } 
    else if (p >= 0.25 && p < 0.38) {
      // === 阶段二:滚轮下压切入 R 角根部 ===
      const t = (p - 0.25) / 0.13;
      stepText.textContent = "时序 2/4: 15°弹性小辊接触 R 角切线,弹簧自适应预紧 (0.1s)";
      nozzleY = 355;
      rollerPressY = 30 + t * 45; // 下压贴实
      normalForce = (t * 3.2).toFixed(1);
      floatDisp = (t * 1.5).toFixed(1);
      forceVector.setAttribute('opacity', t.toString());
      airRatio = (100 - t * 15).toFixed(1);
    } 
    else if (p >= 0.38 && p < 0.80) {
      // === 阶段三:单向滚压排气推进 (核心创新) ===
      const t = (p - 0.38) / 0.42;
      stepText.textContent = "时序 3/4: 直线气缸驱动小辊单向滚压,气泡沿切线逸出 (0.3s)";
      nozzleY = 355 - t * 40; // 吸嘴轻抬脱离,让路滚压
      carriageX = 290 + t * 580;
      rollerPressY = 75;
      rollerAngle = t * 1440; // 滚轮纯滚动
      normalForce = (3.2 + Math.sin(t * Math.PI * 6) * 0.2).toFixed(1); // 浮动弹簧维持恒力 2~4N
      floatDisp = (1.5 + Math.cos(t * Math.PI * 4) * 0.3).toFixed(1);
      currentSpeed = 150;
      forceVector.setAttribute('opacity', '1');
      airRatio = ((1 - t) * 85).toFixed(1);

      // 动态胶带贴合路径 (已滚压部分平直密合,未滚压部分前方张起)
      const currentContactX = carriageX - 5;
      tapeBonded.setAttribute('d', `M 285,359 L ${currentContactX},359 L ${currentContactX},363 L 285,363 Z`);
      tapeFloating.setAttribute('d', `M ${currentContactX},359 L 880,${348 - (1 - t) * 12} L 880,${352 - (1 - t) * 12} L ${currentContactX},363 Z`);

      // 气泡顺向排出粒子动画更新
      bubbleParticles.forEach((b, idx) => {
        const offsetPhase = (t * 4 + idx * 0.3) % 1;
        b.el.setAttribute('opacity', (1 - offsetPhase).toFixed(2));
        b.el.setAttribute('cx', currentContactX + 15 + offsetPhase * b.vx);
        b.el.setAttribute('cy', 358 + offsetPhase * b.vy);
      });
    } 
    else {
      // === 阶段四:滚轮抬起,吸嘴释放复位 ===
      const t = (p - 0.80) / 0.20;
      stepText.textContent = "时序 4/4: 滚轮抬起退回,完成 100% 无泡边缘贴实 (0.15s)";
      carriageX = 870;
      rollerPressY = 75 - t * 45;
      nozzleY = 315 - (1 - t) * 75;
      forceVector.setAttribute('opacity', (1 - t).toString());
      airRatio = 0.0;
      normalForce = 0.0;
      tapeBonded.setAttribute('d', `M 285,359 L 880,359 L 880,363 L 285,363 Z`);
      tapeFloating.setAttribute('d', `M 880,359 L 880,359 L 880,363 L 880,363 Z`);
      bubbleParticles.forEach(b => b.el.setAttribute('opacity', '0'));
    }

    // 变换赋值
    nozzle.setAttribute('transform', `translate(340, ${nozzleY})`);
    carriage.setAttribute('transform', `translate(${carriageX}, 0)`);
    slider.setAttribute('transform', `translate(0, ${rollerPressY})`);
    spoke.setAttribute('transform', `rotate(${rollerAngle})`);

    // 弹簧随浮动行程压缩动画 (根据 rollerPressY 动态伸缩)
    const springCompress = 165 + (rollerPressY - 30) * 0.2;
    spring.setAttribute('d', `M 0,${springCompress} L 8,${springCompress + 7} L -8,${springCompress + 15} L 8,${springCompress + 23} L -8,${springCompress + 31} L 8,${springCompress + 39} L 0,${springCompress + 47}`);

    // 数据面板刷新
    valForce.innerHTML = `${normalForce} <span class="unit">N (${normalForce > 0 ? '恒定浮动' : '未接触'})</span>`;
    valSpeed.innerHTML = `${currentSpeed} <span class="unit">mm/s</span>`;
    valStroke.innerHTML = `${floatDisp} <span class="unit">/ 3.0 mm</span>`;
    valAir.innerHTML = `${airRatio} <span class="unit">% ${airRatio == 0 ? '全贴合完成' : '排气中'}</span>`;
  }

  function loop(timestamp) {
    if (!lastTimestamp) lastTimestamp = timestamp;
    const dt = (timestamp - lastTimestamp) / 1000;
    lastTimestamp = timestamp;

    if (isPlaying) {
      progress += dt / DURATION;
      if (progress >= 1.0) progress = 0;
      updateFrame(progress);
    }
    requestAnimationFrame(loop);
  }

  // 事件交互绑定
  btnToggle.addEventListener('click', () => {
    isPlaying = !isPlaying;
    btnToggle.innerHTML = isPlaying 
      ? `<svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor"><path d="M6 19h4V5H6v14zm8-14v14h4V5h-4z"/></svg> 暂停演示`
      : `<svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor"><path d="M8 5v14l11-7z"/></svg> 继续演示`;
    btnToggle.classList.toggle('active', isPlaying);
  });

  btnRestart.addEventListener('click', () => {
    progress = 0;
    updateFrame(progress);
  });

  progressSlider.addEventListener('input', (e) => {
    isPlaying = false;
    btnToggle.innerHTML = `<svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor"><path d="M8 5v14l11-7z"/></svg> 继续演示`;
    btnToggle.classList.remove('active');
    progress = parseFloat(e.target.value);
    updateFrame(progress);
  });

  // 页面自启动与复位重开机制
  window.addEventListener('DOMContentLoaded', () => {
    progress = 0;
    updateFrame(0);
    requestAnimationFrame(loop);
  });
</script>

</body>
</html>
积分规则:每轮对话扣10分