分享图
动画工坊
引擎就绪
<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>四象限缩颈磁桥自适应限幅原理演示 (IFR 理想解)</title>
  <style>
    * {
      box-sizing: border-box;
      margin: 0;
      padding: 0;
      user-select: none;
    }

    body {
      background-color: #080c14;
      color: #e2e8f0;
      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: hidden;
      position: relative;
    }

    /* 背景工程微网格 */
    .bg-grid {
      position: absolute;
      inset: 0;
      background-image: 
        radial-gradient(circle at 50% 50%, rgba(14, 165, 233, 0.08) 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;
      pointer-events: none;
    }

    /* 主可视化舞台 */
    .stage-container {
      position: relative;
      width: 100vw;
      height: 100vh;
      max-width: 1280px;
      max-height: 880px;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 16px;
    }

    svg#mainCanvas {
      width: 100%;
      height: 100%;
      max-height: calc(100vh - 120px);
      filter: drop-shadow(0 0 40px rgba(0, 0, 0, 0.7));
    }

    /* 角落与边缘极简浮层(字号均在12-13px,绝不遮挡中央核心) */
    .corner-badge {
      position: absolute;
      z-index: 10;
      background: rgba(15, 23, 42, 0.75);
      backdrop-filter: blur(10px);
      border: 1px solid rgba(255, 255, 255, 0.08);
      border-radius: 8px;
      padding: 10px 14px;
      font-size: 12px;
      color: #94a3b8;
      pointer-events: none;
      line-height: 1.5;
    }

    .top-left {
      top: 20px;
      left: 24px;
      display: flex;
      flex-direction: column;
      gap: 3px;
    }

    .top-left h1 {
      font-size: 13px;
      font-weight: 600;
      color: #38bdf8;
      letter-spacing: 0.5px;
      display: flex;
      align-items: center;
      gap: 6px;
    }

    .top-left .tag {
      display: inline-block;
      font-size: 10px;
      padding: 1px 5px;
      border-radius: 4px;
      background: rgba(56, 189, 248, 0.15);
      color: #38bdf8;
      border: 1px solid rgba(56, 189, 248, 0.3);
    }

    .top-right {
      top: 20px;
      right: 24px;
      display: flex;
      flex-direction: column;
      gap: 6px;
      min-width: 190px;
    }

    .metric-row {
      display: flex;
      justify-content: space-between;
      align-items: center;
      font-size: 11px;
    }

    .metric-val {
      font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
      font-weight: 600;
      color: #f1f5f9;
    }

    .status-pill {
      display: inline-flex;
      align-items: center;
      gap: 5px;
      padding: 2px 7px;
      border-radius: 12px;
      font-size: 10px;
      font-weight: 600;
    }

    .pill-normal {
      background: rgba(16, 185, 129, 0.15);
      color: #34d399;
      border: 1px solid rgba(16, 185, 129, 0.3);
    }

    .pill-saturated {
      background: rgba(239, 68, 68, 0.2);
      color: #f87171;
      border: 1px solid rgba(239, 68, 68, 0.4);
      animation: pulse-red 1s infinite alternate;
    }

    @keyframes pulse-red {
      from { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
      to { box-shadow: 0 0 10px 2px rgba(239, 68, 68, 0.7); }
    }

    /* 底部极简操控坞(悬浮在屏幕底端) */
    .bottom-hud {
      position: absolute;
      bottom: 18px;
      z-index: 10;
      display: flex;
      align-items: center;
      gap: 16px;
      background: rgba(15, 23, 42, 0.85);
      backdrop-filter: blur(12px);
      border: 1px solid rgba(255, 255, 255, 0.1);
      border-radius: 30px;
      padding: 7px 18px;
      box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
    }

    .hud-btn {
      background: rgba(255, 255, 255, 0.06);
      border: 1px solid rgba(255, 255, 255, 0.12);
      color: #e2e8f0;
      padding: 5px 12px;
      border-radius: 16px;
      font-size: 12px;
      cursor: pointer;
      display: flex;
      align-items: center;
      gap: 5px;
      transition: all 0.2s ease;
    }

    .hud-btn:hover {
      background: rgba(56, 189, 248, 0.2);
      border-color: #38bdf8;
      color: #fff;
    }

    .hud-btn.active {
      background: #0284c7;
      border-color: #38bdf8;
      color: #fff;
      font-weight: 500;
    }

    .slider-wrap {
      display: flex;
      align-items: center;
      gap: 10px;
      font-size: 12px;
      color: #94a3b8;
    }

    input[type=range] {
      -webkit-appearance: none;
      width: 140px;
      height: 4px;
      background: #334155;
      border-radius: 2px;
      outline: none;
      cursor: pointer;
    }

    input[type=range]::-webkit-slider-thumb {
      -webkit-appearance: none;
      width: 14px;
      height: 14px;
      border-radius: 50%;
      background: #38bdf8;
      border: 2px solid #0f172a;
      box-shadow: 0 0 8px #38bdf8;
      transition: transform 0.1s ease;
    }

    input[type=range]::-webkit-slider-thumb:hover {
      transform: scale(1.2);
    }

    /* 周期性时序进度微条 */
    .timeline-bar {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 2px;
      background: rgba(255, 255, 255, 0.05);
    }

    .timeline-progress {
      height: 100%;
      width: 0%;
      background: linear-gradient(90deg, #0284c7, #38bdf8, #f59e0b);
      transition: width 0.1s linear;
    }
  </style>
</head>
<body>

  <div class="bg-grid"></div>
  <div class="timeline-bar"><div class="timeline-progress" id="timeProgress"></div></div>

  <!-- 左上角极简说明(严格小于14px,置于角落) -->
  <div class="corner-badge top-left">
    <h1>
      <span>缩颈磁桥自限幅系统</span>
      <span class="tag">IFR 最终理想解</span>
    </h1>
    <div style="color: #64748b; font-size: 11px;">利用结构本体磁饱和特性 · 零运动部件的被动式非线性阻断</div>
  </div>

  <!-- 右上角状态仪表(微型 HUD) -->
  <div class="corner-badge top-right">
    <div class="metric-row">
      <span>象限Ⅰ瞬态电流:</span>
      <span class="metric-val" id="dispCurrent">12.0 A (标称)</span>
    </div>
    <div class="metric-row">
      <span>磁桥局部磁密 B:</span>
      <span class="metric-val" id="dispB">1.12 T</span>
    </div>
    <div class="metric-row">
      <span>缩颈磁导率 μᵣ:</span>
      <span class="metric-val" id="dispMu">4200 (高导)</span>
    </div>
    <div class="metric-row">
      <span>对角象限串扰:</span>
      <span class="status-pill pill-normal" id="dispCrosstalk">已完全隔离</span>
    </div>
  </div>

  <!-- 主绘图区域 -->
  <div class="stage-container">
    <svg id="mainCanvas" viewBox="0 0 1000 800" xmlns="http://www.w3.org/2000/svg">
      <defs>
        <!-- 发光滤镜 -->
        <filter id="glow-cyan" x="-30%" y="-30%" width="160%" height="160%">
          <feGaussianBlur stdDeviation="4" result="blur" />
          <feMerge>
            <feMergeNode in="blur" />
            <feMergeNode in="SourceGraphic" />
          </feMerge>
        </filter>

        <filter id="glow-orange" x="-50%" y="-50%" width="200%" height="200%">
          <feGaussianBlur stdDeviation="6" result="blur1" />
          <feGaussianBlur stdDeviation="14" result="blur2" />
          <feMerge>
            <feMergeNode in="blur2" />
            <feMergeNode in="blur1" />
            <feMergeNode in="SourceGraphic" />
          </feMerge>
        </filter>

        <!-- 磁铁渐变 -->
        <linearGradient id="coreGrad" x1="0%" y1="0%" x2="100%" y2="100%">
          <stop offset="0%" stop-color="#1e293b"/>
          <stop offset="50%" stop-color="#334155"/>
          <stop offset="100%" stop-color="#1e293b"/>
        </linearGradient>

        <!-- 缩颈常态渐变 -->
        <linearGradient id="bridgeNormalGrad" x1="0%" y1="0%" x2="100%" y2="0%">
          <stop offset="0%" stop-color="#334155"/>
          <stop offset="50%" stop-color="#0284c7"/>
          <stop offset="100%" stop-color="#334155"/>
        </linearGradient>

        <!-- 缩颈过载饱和渐变 -->
        <linearGradient id="bridgeSatGrad" x1="0%" y1="0%" x2="100%" y2="0%">
          <stop offset="0%" stop-color="#ef4444"/>
          <stop offset="30%" stop-color="#f59e0b"/>
          <stop offset="50%" stop-color="#ffffff"/>
          <stop offset="70%" stop-color="#f59e0b"/>
          <stop offset="100%" stop-color="#ef4444"/>
        </linearGradient>

        <!-- 粒子发光色标 -->
        <radialGradient id="particleNormal">
          <stop offset="0%" stop-color="#ffffff" />
          <stop offset="40%" stop-color="#38bdf8" />
          <stop offset="100%" stop-color="rgba(56, 189, 248, 0)" />
        </radialGradient>

        <radialGradient id="particleOverload">
          <stop offset="0%" stop-color="#ffffff" />
          <stop offset="40%" stop-color="#f97316" />
          <stop offset="100%" stop-color="rgba(249, 115, 22, 0)" />
        </radialGradient>
      </defs>

      <!-- 导磁大框体底板与四象限槽 (Central Hub & Frame) -->
      <g id="frameGeometry" stroke="#475569" stroke-width="1.5">
        <!-- 外磁轭环 (大圆角方环) -->
        <rect x="140" y="70" width="720" height="660" rx="36" fill="url(#coreGrad)" opacity="0.95" />
        <!-- 中空镂空区 (四个象限窗口) -->
        <!-- Q2 (左上) -->
        <rect x="195" y="125" width="280" height="250" rx="16" fill="#080c14" />
        <!-- Q1 (右上 - 故障源工况区) -->
        <rect x="525" y="125" width="280" height="250" rx="16" fill="#080c14" />
        <!-- Q3 (左下) -->
        <rect x="195" y="425" width="280" height="250" rx="16" fill="#080c14" />
        <!-- Q4 (右下) -->
        <rect x="525" y="425" width="280" height="250" rx="16" fill="#080c14" />
      </g>

      <!-- 象限极简文字标示 (低对比度灰字,不抢视觉) -->
      <g font-size="11" fill="#475569" font-weight="600" letter-spacing="1">
        <text x="335" y="255" text-anchor="middle">象限 Ⅱ (正常)</text>
        <text x="665" y="255" text-anchor="middle" id="q1Label" fill="#38bdf8">象限 Ⅰ (脉冲源/受控区)</text>
        <text x="335" y="555" text-anchor="middle">象限 Ⅲ (正常)</text>
        <text x="665" y="555" text-anchor="middle">象限 Ⅳ (保护区)</text>
      </g>

      <!-- 四个象限回流支路中的“缩颈磁桥 (Necked Magnetic Bridges)” -->
      <!-- 1. Q1-Q4 右对角立臂缩颈 (核心观察点 1) -->
      <g id="bridge_right" transform="translate(830, 400)">
        <!-- 缩颈形状:截面由厚收窄 (8-12mm 长度,150-250mm²等效截面) -->
        <path id="neckPathRight" d="M -30,-45 C -12,-18 -10,-10 -10,0 C -10,10 -12,18 -30,45 L 30,45 C 12,18 10,10 10,0 C 10,-10 12,-18 30,-45 Z" 
              fill="#0284c7" opacity="0.85" />
        <!-- 非磁性绝缘侧夹板 -->
        <rect x="-35" y="-12" width="6" height="24" rx="2" fill="#d97706" opacity="0.8"/>
        <rect x="29" y="-12" width="6" height="24" rx="2" fill="#d97706" opacity="0.8"/>
        <!-- 局域磁阻阻断波纹(饱和时激活) -->
        <ellipse id="barrierRight" cx="0" cy="0" rx="22" ry="12" fill="none" stroke="#ef4444" stroke-width="2.5" opacity="0" filter="url(#glow-orange)"/>
      </g>

      <!-- 2. Q1-Q2 顶对角横臂缩颈 (核心观察点 2) -->
      <g id="bridge_top" transform="translate(500, 97)">
        <path id="neckPathTop" d="M -45,-30 C -18,-12 -10,-10 0,-10 C 10,-10 18,-12 45,-30 L 45,30 C 18,12 10,10 0,10 C -10,10 -18,12 -45,30 Z" 
              fill="#0284c7" opacity="0.85" />
        <rect x="-12" y="-35" width="24" height="6" rx="2" fill="#d97706" opacity="0.8"/>
        <rect x="-12" y="29" width="24" height="6" rx="2" fill="#d97706" opacity="0.8"/>
        <ellipse id="barrierTop" cx="0" cy="0" rx="12" ry="22" fill="none" stroke="#ef4444" stroke-width="2.5" opacity="0" filter="url(#glow-orange)"/>
      </g>

      <!-- 3. 左侧立臂缩颈 (对称件) -->
      <g id="bridge_left" transform="translate(170, 400)">
        <path d="M -30,-45 C -12,-18 -10,-10 -10,0 C -10,10 -12,18 -30,45 L 30,45 C 12,18 10,10 10,0 C 10,-10 12,-18 30,-45 Z" 
              fill="#0284c7" opacity="0.5" />
        <rect x="-35" y="-12" width="6" height="24" rx="2" fill="#d97706" opacity="0.6"/>
        <rect x="29" y="-12" width="6" height="24" rx="2" fill="#d97706" opacity="0.6"/>
      </g>

      <!-- 4. 底侧横臂缩颈 (对称件) -->
      <g id="bridge_bottom" transform="translate(500, 703)">
        <path d="M -45,-30 C -18,-12 -10,-10 0,-10 C 10,-10 18,-12 45,-30 L 45,30 C 18,12 10,10 0,10 C -10,10 -18,12 -45,30 Z" 
              fill="#0284c7" opacity="0.5" />
        <rect x="-12" y="-35" width="24" height="6" rx="2" fill="#d97706" opacity="0.6"/>
        <rect x="-12" y="29" width="24" height="6" rx="2" fill="#d97706" opacity="0.6"/>
      </g>

      <!-- 励磁主绕组 / 补偿线圈示意 (位于 Q1 支路) -->
      <g id="coilQ1" transform="translate(740, 240)">
        <rect x="-15" y="-55" width="30" height="110" rx="6" fill="#1e1b4b" stroke="#6366f1" stroke-width="2"/>
        <!-- 绕组纹理条纹 -->
        <line x1="-15" y1="-35" x2="15" y2="-35" stroke="#818cf8" stroke-width="3"/>
        <line x1="-15" y1="-15" x2="15" y2="-15" stroke="#818cf8" stroke-width="3"/>
        <line x1="-15" y1="5" x2="15" y2="5" stroke="#818cf8" stroke-width="3"/>
        <line x1="-15" y1="25" x2="15" y2="25" stroke="#818cf8" stroke-width="3"/>
        <line x1="-15" y1="45" x2="15" y2="45" stroke="#818cf8" stroke-width="3"/>
        <text x="25" y="4" fill="#a5b4fc" font-size="10" font-family="monospace">补偿线圈 L₁</text>
      </g>

      <!-- 磁力线流向示意线(基础流轨) -->
      <g id="fluxTracks" stroke="rgba(56, 189, 248, 0.2)" stroke-width="1.5" stroke-dasharray="4 6" fill="none">
        <!-- Q1 自闭环正常回流轨道 (内部小回路) -->
        <path id="path_q1_normal" d="M 665,110 L 815,110 Q 845,110 845,140 L 845,360 Q 845,390 815,390 L 515,390 Q 485,390 485,360 L 485,140 Q 485,110 515,110 Z" />
        <!-- 跨象限侵入路线 (直通 Q4 的路径) -->
        <path id="path_cross_q4" d="M 830,340 L 830,460 L 830,670 Q 830,700 800,700 L 530,700" />
        <!-- 跨象限侵入路线 (直通 Q2 的路径) -->
        <path id="path_cross_q2" d="M 540,97 L 460,97 L 220,97 Q 190,97 190,127 L 190,370" />
      </g>

      <!-- 动态运动的流动磁通粒子群容器 (由 JS 逐帧驱动) -->
      <g id="particleContainer"></g>

      <!-- 阻断截面高亮标记与微型技术标注 -->
      <g id="annotations" font-size="10" fill="#94a3b8">
        <!-- 磁桥 1 处微型引线 -->
        <path d="M 865,390 L 890,370 L 930,370" stroke="#64748b" stroke-width="1" fill="none"/>
        <text x="935" y="373" fill="#38bdf8" font-weight="600">缩颈几何截面 (180 mm²)</text>
        <text x="935" y="388" fill="#64748b">先于主框体饱和 (B_sat = 1.82 T)</text>

        <!-- 非线性阻抗跳变示意曲线气泡 (右下角悬浮) -->
        <g transform="translate(680, 590)">
          <rect x="0" y="0" width="160" height="90" rx="8" fill="rgba(15, 23, 42, 0.9)" stroke="rgba(255,255,255,0.1)"/>
          <text x="12" y="18" fill="#e2e8f0" font-size="10" font-weight="600">磁阻非线性跃升 (Rm vs Φ)</text>
          <!-- 坐标系 -->
          <line x1="20" y1="75" x2="145" y2="75" stroke="#475569" stroke-width="1"/>
          <line x1="20" y1="75" x2="20" y2="28" stroke="#475569" stroke-width="1"/>
          <!-- 跃升折线 -->
          <path id="curveRm" d="M 22,72 L 65,70 C 80,68 88,40 105,33 L 140,32" fill="none" stroke="#38bdf8" stroke-width="2"/>
          <!-- 动点指示当前工作状态 -->
          <circle id="curvePoint" cx="45" cy="71" r="3.5" fill="#38bdf8" stroke="#fff" stroke-width="1.5"/>
          <text x="105" y="72" fill="#64748b" font-size="8">Φ (磁通)</text>
          <text x="12" y="32" fill="#64748b" font-size="8">Rm</text>
        </g>
      </g>
    </svg>
  </div>

  <!-- 底部操控坞 -->
  <div class="bottom-hud">
    <button class="hud-btn active" id="btnAutoMode">
      <span style="font-size:14px;">⚡</span> 自动周期脉冲演示
    </button>
    <button class="hud-btn" id="btnManualMode">
      <span>⚙️</span> 手动过载调制
    </button>

    <div class="slider-wrap" id="sliderGroup" style="opacity: 0.5; pointer-events: none;">
      <span>脉冲激发幅值:</span>
      <input type="range" id="fluxSlider" min="0" max="100" value="20">
      <span id="sliderValText" style="min-width: 40px; font-family: monospace;">20%</span>
    </div>
  </div>

  <script>
    // 磁场粒子系统仿真与状态机
    const svg = document.getElementById('mainCanvas');
    const particleContainer = document.getElementById('particleContainer');
    const neckRight = document.getElementById('neckPathRight');
    const neckTop = document.getElementById('neckPathTop');
    const barrierRight = document.getElementById('barrierRight');
    const barrierTop = document.getElementById('barrierTop');

    // 指标看板
    const dispCurrent = document.getElementById('dispCurrent');
    const dispB = document.getElementById('dispB');
    const dispMu = document.getElementById('dispMu');
    const dispCrosstalk = document.getElementById('dispCrosstalk');
    const q1Label = document.getElementById('q1Label');
    const curvePoint = document.getElementById('curvePoint');
    const timeProgress = document.getElementById('timeProgress');

    // 控制按钮与滑块
    const btnAuto = document.getElementById('btnAutoMode');
    const btnManual = document.getElementById('btnManualMode');
    const sliderGroup = document.getElementById('sliderGroup');
    const fluxSlider = document.getElementById('fluxSlider');
    const sliderValText = document.getElementById('sliderValText');

    let isAuto = true;
    let autoTimer = 0;
    const CYCLE_DURATION = 8000; // 8秒一个完整工况周期

    // 粒子结构
    const particles = [];
    const MAX_PARTICLES = 65;

    // 预定义流动路径坐标点集 (闭环回流、侵入回流)
    // 1. Q1 正常内闭环
    const normalLoopQ1 = [
      {x: 520, y: 110}, {x: 810, y: 110}, {x: 830, y: 130}, 
      {x: 830, y: 250}, {x: 830, y: 350}, {x: 810, y: 380}, 
      {x: 520, y: 380}, {x: 495, y: 350}, {x: 495, y: 140}
    ];

    // 2. 跨象限侵入路线至 Q4 (越过右侧立臂缩颈)
    const spillPathQ4 = [
      {x: 830, y: 250}, {x: 830, y: 360}, {x: 830, y: 400}, // 穿越缩颈
      {x: 830, y: 550}, {x: 810, y: 690}, {x: 520, y: 690}
    ];

    // 初始化粒子
    for (let i = 0; i < MAX_PARTICLES; i++) {
      const circle = document.createElementNS('http://www.w3.org/2000/svg', 'circle');
      circle.setAttribute('r', '3');
      circle.setAttribute('fill', 'url(#particleNormal)');
      particleContainer.appendChild(circle);

      particles.push({
        el: circle,
        t: Math.random(), // 沿路径的进度 (0~1)
        speed: 0.003 + Math.random() * 0.003,
        type: i < 15 ? 'spill' : 'normal', // 部分粒子尝试溢出侵入
        quadrant: 1
      });
    }

    // 插值计算
    function getPointOnPath(points, progress) {
      const n = points.length;
      const totalDist = n;
      const idxFloat = (progress % 1) * n;
      const i0 = Math.floor(idxFloat) % n;
      const i1 = (i0 + 1) % n;
      const alpha = idxFloat - Math.floor(idxFloat);

      return {
        x: points[i0].x + (points[i1].x - points[i0].x) * alpha,
        y: points[i0].y + (points[i1].y - points[i0].y) * alpha
      };
    }

    // 更新系统物理状态 (overloadFactor: 0.0 正常 ~ 1.0 深度过载)
    function applySystemState(overloadFactor) {
      // 1. 物理参数估算
      const current = (12.0 + overloadFactor * 88.0).toFixed(1); // 12A ~ 100A
      const B = (1.1 + overloadFactor * 0.78).toFixed(2); // 1.10T ~ 1.88T
      const mu = Math.round(4200 - overloadFactor * 4080); // 4200 -> 120 (急剧跌落)
      const isSaturated = overloadFactor > 0.45;

      // 2. 更新仪表盘文字
      dispCurrent.textContent = `${current} A ${overloadFactor > 0.45 ? '⚠️ [脉冲过载]' : '(标称稳态)'}`;
      dispB.textContent = `${B} T`;
      dispMu.textContent = `${mu} (${isSaturated ? '饱和骤降' : '高导磁率'})`;

      if (isSaturated) {
        dispCrosstalk.textContent = '缩颈已自饱和 · 跨象限完全封锁';
        dispCrosstalk.className = 'status-pill pill-saturated';
        q1Label.setAttribute('fill', '#f87171');
      } else {
        dispCrosstalk.textContent = '常态极低磁阻回流';
        dispCrosstalk.className = 'status-pill pill-normal';
        q1Label.setAttribute('fill', '#38bdf8');
      }

      // 3. 更新缩颈颜色与饱和辉光效应
      if (isSaturated) {
        const satRatio = (overloadFactor - 0.45) / 0.55;
        neckRight.setAttribute('fill', 'url(#bridgeSatGrad)');
        neckTop.setAttribute('fill', 'url(#bridgeSatGrad)');
        neckRight.setAttribute('filter', 'url(#glow-orange)');
        neckTop.setAttribute('filter', 'url(#glow-orange)');
        
        // 阻断屏障波纹呈现
        barrierRight.setAttribute('opacity', Math.min(1, satRatio * 1.4));
        barrierTop.setAttribute('opacity', Math.min(1, satRatio * 1.4));
      } else {
        neckRight.setAttribute('fill', '#0284c7');
        neckTop.setAttribute('fill', '#0284c7');
        neckRight.removeAttribute('filter');
        neckTop.removeAttribute('filter');
        barrierRight.setAttribute('opacity', '0');
        barrierTop.setAttribute('opacity', '0');
      }

      // 4. 更新非线性曲线图上的指示点
      // Rm 曲线位置映射
      const ptX = 22 + overloadFactor * 115;
      let ptY = 72;
      if (overloadFactor < 0.4) {
        ptY = 72 - overloadFactor * 5;
      } else {
        // 急剧非线性攀升
        const p = (overloadFactor - 0.4) / 0.6;
        ptY = 70 - Math.pow(p, 1.8) * 38;
      }
      curvePoint.setAttribute('cx', ptX);
      curvePoint.setAttribute('cy', ptY);
      curvePoint.setAttribute('fill', isSaturated ? '#ef4444' : '#38bdf8');

      // 5. 更新粒子颜色、速率与阻断行为
      particles.forEach(p => {
        if (isSaturated) {
          p.el.setAttribute('fill', 'url(#particleOverload)');
          p.speed = (0.006 + overloadFactor * 0.008); // 饱和推挤,局域流速极快
        } else {
          p.el.setAttribute('fill', 'url(#particleNormal)');
          p.speed = 0.003 + Math.random() * 0.002;
        }

        // 核心机理表现:若为试图侵入的粒子,遇到高饱和缩颈阻断时,被迫掉头或弹回本象限
        let pos;
        if (p.type === 'spill') {
          if (isSaturated) {
            // 被缩颈阻隔:无法跨越 y=400 边界,只在缩颈入口处被强烈反弹,折返本象限
            const clampedProgress = Math.min(0.35, p.t % 0.7);
            pos = getPointOnPath(spillPathQ4, clampedProgress);
            // 阻断振颤
            pos.x += (Math.random() - 0.5) * 8 * overloadFactor;
          } else {
            // 常态下微量正常漏磁分布
            pos = getPointOnPath(spillPathQ4, p.t);
          }
        } else {
          // 常态内闭环流动
          pos = getPointOnPath(normalLoopQ1, p.t);
        }

        p.el.setAttribute('cx', pos.x);
        p.el.setAttribute('cy', pos.y);

        p.t = (p.t + p.speed) % 1;
      });
    }

    // 主动画引擎 (RAF 循环)
    let lastTime = performance.now();
    function animateLoop(now) {
      const dt = now - lastTime;
      lastTime = now;

      let overload = 0;

      if (isAuto) {
        autoTimer = (autoTimer + dt) % CYCLE_DURATION;
        const progress = autoTimer / CYCLE_DURATION;
        timeProgress.style.width = (progress * 100) + '%';

        // 周期逻辑时序设计:
        // 0% ~ 35%: 稳态标称 (overload ~ 0)
        // 35% ~ 55%: 瞬态大电流脉冲注入,缩颈瞬间达 1.85T (overload 陡增到 1.0)
        // 55% ~ 75%: 饱和限幅阻断期,跨象限零泄漏,闭环接管修正 (持续高阻断)
        // 75% ~ 100%: 闭环扣除完成,平稳复位回到基线
        if (progress < 0.35) {
          overload = 0.05 * Math.sin(progress * Math.PI * 4);
        } else if (progress < 0.52) {
          // 脉冲上升沿
          const t = (progress - 0.35) / 0.17;
          overload = Math.min(1.0, Math.pow(t, 2) * 1.0);
        } else if (progress < 0.72) {
          // 饱和保持与闭环动作
          overload = 0.95 + 0.05 * Math.sin(progress * 20);
        } else {
          // 泄放恢复
          const t = (progress - 0.72) / 0.28;
          overload = Math.max(0, 0.95 * (1 - t));
        }
      } else {
        timeProgress.style.width = '0%';
        overload = parseFloat(fluxSlider.value) / 100;
      }

      applySystemState(Math.max(0, Math.min(1, overload)));
      requestAnimationFrame(animateLoop);
    }

    // 页面完全加载后自启动
    window.addEventListener('DOMContentLoaded', () => {
      requestAnimationFrame(animateLoop);
    });

    // 交互模式切换
    btnAuto.addEventListener('click', () => {
      isAuto = true;
      btnAuto.classList.add('active');
      btnManual.classList.remove('active');
      sliderGroup.style.opacity = '0.4';
      sliderGroup.style.pointerEvents = 'none';
    });

    btnManual.addEventListener('click', () => {
      isAuto = false;
      btnManual.classList.add('active');
      btnAuto.classList.remove('active');
      sliderGroup.style.opacity = '1.0';
      sliderGroup.style.pointerEvents = 'auto';
    });

    fluxSlider.addEventListener('input', (e) => {
      sliderValText.textContent = `${e.target.value}%`;
    });
  </script>
</body>
</html>
积分规则:每轮对话扣10分