独立渲染引擎就绪引擎就绪
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>40cm分层松碎协同作业机构工作原理</title>
<style>
:root {
--bg: #0d1117;
--panel-bg: rgba(22, 27, 34, 0.75);
--border: rgba(56, 189, 248, 0.2);
--accent-cyan: #38bdf8;
--accent-amber: #f59e0b;
--accent-emerald: #10b981;
--text-main: #f1f5f9;
--text-muted: #94a3b8;
}
* {
box-sizing: border-box;
margin: 0;
padding: 0;
user-select: none;
}
body {
background-color: var(--bg);
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: hidden;
padding: 12px;
}
/* 主机架与画布容器:主体居中、占满视觉核心 */
.viewport-container {
position: relative;
width: 100%;
max-width: 1240px;
aspect-ratio: 16 / 9;
background: radial-gradient(circle at 50% 25%, #172033 0%, #0d1117 85%);
border: 1px solid rgba(148, 163, 184, 0.15);
border-radius: 12px;
box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), inset 0 0 1px 1px rgba(255, 255, 255, 0.05);
overflow: hidden;
display: flex;
align-items: center;
justify-content: center;
}
canvas {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 1;
}
svg#machinery-svg {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 2;
pointer-events: none;
}
/* 严控文本:全部微型化、置于极边缘,绝不遮挡机械与土层动态 */
.corner-tag {
position: absolute;
z-index: 10;
padding: 6px 12px;
background: var(--panel-bg);
backdrop-filter: blur(8px);
border: 1px solid var(--border);
border-radius: 6px;
font-size: 11px;
letter-spacing: 0.5px;
pointer-events: auto;
}
.top-left-title {
top: 14px;
left: 14px;
display: flex;
align-items: center;
gap: 8px;
}
.status-dot {
width: 7px;
height: 7px;
border-radius: 50%;
background: var(--accent-emerald);
box-shadow: 0 0 8px var(--accent-emerald);
animation: pulse-dot 2s infinite ease-in-out;
}
.title-text {
font-weight: 600;
color: var(--text-main);
font-size: 12px;
}
.top-right-metrics {
top: 14px;
right: 14px;
display: flex;
gap: 14px;
font-size: 11px;
color: var(--text-muted);
}
.metric-val {
color: var(--accent-cyan);
font-weight: 600;
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.bottom-bar {
bottom: 12px;
left: 14px;
right: 14px;
display: flex;
justify-content: space-between;
align-items: center;
padding: 6px 14px;
font-size: 11px;
color: var(--text-muted);
}
.flow-steps {
display: flex;
align-items: center;
gap: 12px;
}
.step-item {
display: flex;
align-items: center;
gap: 4px;
}
.step-num {
width: 15px;
height: 15px;
border-radius: 50%;
background: rgba(56, 189, 248, 0.15);
color: var(--accent-cyan);
display: flex;
align-items: center;
justify-content: center;
font-size: 9px;
font-weight: bold;
}
.step-arrow {
color: rgba(148, 163, 184, 0.4);
font-size: 10px;
}
.controls-compact {
display: flex;
align-items: center;
gap: 10px;
}
.btn-toggle {
background: rgba(56, 189, 248, 0.1);
border: 1px solid rgba(56, 189, 248, 0.3);
color: var(--accent-cyan);
border-radius: 4px;
padding: 3px 8px;
font-size: 10px;
cursor: pointer;
transition: all 0.2s ease;
}
.btn-toggle:hover {
background: rgba(56, 189, 248, 0.25);
}
@keyframes pulse-dot {
0%, 100% { opacity: 1; transform: scale(1); }
50% { opacity: 0.4; transform: scale(0.85); }
}
</style>
</head>
<body>
<div class="viewport-container">
<!-- 背景土层剪切应变场与颗粒动力学画布 -->
<canvas id="sim-canvas"></canvas>
<!-- 矢量机械机构层(严格标定入土角、回转刀刃、导流罩、限深与镇压总成) -->
<svg id="machinery-svg" viewBox="0 0 1200 675" preserveAspectRatio="xMidYMid meet">
<defs>
<!-- 导流罩高光渐变 -->
<linearGradient id="metal-grad" x1="0%" y1="0%" x2="100%" y2="100%">
<stop offset="0%" stop-color="#94a3b8"/>
<stop offset="50%" stop-color="#475569"/>
<stop offset="100%" stop-color="#1e293b"/>
</linearGradient>
<linearGradient id="blade-glow" x1="0%" y1="0%" x2="0%" y2="100%">
<stop offset="0%" stop-color="#38bdf8" stop-opacity="0.8"/>
<stop offset="100%" stop-color="#0284c7" stop-opacity="0.2"/>
</linearGradient>
<linearGradient id="crush-zone" x1="0%" y1="0%" x2="100%" y2="0%">
<stop offset="0%" stop-color="#f59e0b" stop-opacity="0"/>
<stop offset="50%" stop-color="#f59e0b" stop-opacity="0.25"/>
<stop offset="100%" stop-color="#10b981" stop-opacity="0.15"/>
</linearGradient>
</defs>
<!-- 深度参考基准尺 (位于左侧边缘,完全不挡中轴) -->
<g id="depth-ruler" opacity="0.8">
<line x1="85" y1="260" x2="1140" y2="260" stroke="#64748b" stroke-width="1" stroke-dasharray="4 4" opacity="0.4"/>
<text x="50" y="264" fill="#94a3b8" font-size="10" font-family="monospace">0cm 原地表</text>
<line x1="85" y1="365" x2="1140" y2="365" stroke="#38bdf8" stroke-width="1" stroke-dasharray="3 3" opacity="0.4"/>
<text x="40" y="369" fill="#38bdf8" font-size="10" font-family="monospace">-15cm 浅旋层</text>
<line x1="85" y1="540" x2="1140" y2="540" stroke="#f59e0b" stroke-width="1" stroke-dasharray="3 3" opacity="0.4"/>
<text x="40" y="544" fill="#f59e0b" font-size="10" font-family="monospace">-40cm 深松底</text>
<!-- 纵向尺寸标注:深松铲与浅旋辊轴距 >= 500mm -->
<g opacity="0.7">
<line x1="470" y1="165" x2="730" y2="165" stroke="#cbd5e1" stroke-width="1"/>
<line x1="470" y1="160" x2="470" y2="170" stroke="#cbd5e1" stroke-width="1"/>
<line x1="730" y1="160" x2="730" y2="170" stroke="#cbd5e1" stroke-width="1"/>
<text x="560" y="158" fill="#cbd5e1" font-size="9" text-anchor="middle" font-family="monospace">纵向协同间距 L ≥ 500mm</text>
</g>
</g>
<!-- 机械总成总组 -->
<g id="machine-assembly">
<!-- 主梁机架 (Main Truss) -->
<path d="M 240,195 L 940,195 L 930,215 L 250,215 Z" fill="url(#metal-grad)" stroke="#1e293b" stroke-width="1.5"/>
<line x1="280" y1="215" x2="280" y2="250" stroke="#64748b" stroke-width="4"/>
<line x1="470" y1="215" x2="470" y2="270" stroke="#64748b" stroke-width="6"/>
<line x1="730" y1="215" x2="730" y2="270" stroke="#64748b" stroke-width="6"/>
<line x1="910" y1="215" x2="910" y2="270" stroke="#64748b" stroke-width="4"/>
<!-- 1. 前限深轮总成 (X: 280, 地表相切于 Y: 260) -->
<g id="depth-gauge-wheel">
<circle cx="280" cy="225" r="35" fill="none" stroke="#475569" stroke-width="4"/>
<circle cx="280" cy="225" r="8" fill="#1e293b" stroke="#94a3b8" stroke-width="2"/>
<g id="gauge-spokes">
<line x1="280" y1="190" x2="280" y2="260" stroke="#64748b" stroke-width="2"/>
<line x1="245" y1="225" x2="315" y2="225" stroke="#64748b" stroke-width="2"/>
</g>
</g>
<!-- 2. 前置40cm窄翼深松铲 (Shank, 入土角23°, 铲尖达540) -->
<g id="subsoiler-shank">
<!-- 剪断安全螺栓标定点 -->
<circle cx="475" cy="235" r="3.5" fill="#ef4444" stroke="#ffffff" stroke-width="1"/>
<!-- 铲柱与弧形切土刃 -->
<path d="M 465,215 L 485,215 L 495,350 L 515,480 L 440,540 L 415,532 L 460,460 L 450,350 Z"
fill="#334155" stroke="#64748b" stroke-width="1.5"/>
<!-- 23° 入土角导向翼与合金耐磨尖 (Chisel Point) -->
<polygon points="410,542 455,528 440,544" fill="#f59e0b" filter="drop-shadow(0 0 4px #f59e0b)"/>
<!-- 180mm 扩土展翼剖面 (微抬升造孔) -->
<path d="M 435,510 L 475,498 L 468,525 Z" fill="#b45309" stroke="#d97706" stroke-width="1"/>
<!-- 牵引剪切应变波动画指示弧 -->
<path id="stress-wave" d="M 410,540 Q 370,480 340,430" fill="none" stroke="#f59e0b" stroke-width="2" stroke-dasharray="6 4" opacity="0.6"/>
</g>
<!-- 3. 后置浅旋刀辊 (X: 730, 回转半径105, 浅旋入土15cm达 Y: 365) -->
<!-- 弧形导流罩 (Deflector Hood) 阻挡飞溅压低土流 -->
<path d="M 640,245 Q 730,170 820,240 L 805,255 Q 730,195 655,258 Z" fill="url(#metal-grad)" stroke="#334155"/>
<g id="rotary-tiller">
<circle cx="730" cy="275" r="14" fill="#0f172a" stroke="#38bdf8" stroke-width="2"/>
<!-- 旋转切削动势残影环 -->
<circle cx="730" cy="275" r="90" fill="url(#blade-glow)" opacity="0.15"/>
<!-- 刀组(通过JS驱动自转) -->
<g id="rotating-blades">
<!-- 刀座1 -->
<path d="M 730,275 L 775,235 Q 810,230 820,200 L 805,200 Q 795,225 765,245 Z" fill="#94a3b8" stroke="#38bdf8" stroke-width="1"/>
<!-- 刀座2 -->
<path d="M 730,275 L 685,315 Q 650,320 640,350 L 655,350 Q 665,325 695,305 Z" fill="#94a3b8" stroke="#38bdf8" stroke-width="1"/>
<!-- 刀座3 -->
<path d="M 730,275 L 775,315 Q 810,320 820,350 L 805,350 Q 795,325 765,305 Z" fill="#cbd5e1" stroke="#38bdf8" stroke-width="1"/>
<!-- 刀座4 -->
<path d="M 730,275 L 685,235 Q 650,230 640,200 L 655,200 Q 665,225 695,245 Z" fill="#cbd5e1" stroke="#38bdf8" stroke-width="1"/>
</g>
<!-- 浅旋切削作用区高亮弧 -->
<path d="M 645,315 A 90 90 0 0 0 790,345" fill="none" stroke="#38bdf8" stroke-width="3" stroke-linecap="round" opacity="0.8"/>
</g>
<!-- 4. 尾部碎土平整镇压辊 (X: 910, 压实地表于 Y: 260) -->
<g id="packer-roller">
<rect x="860" y="210" width="100" height="50" rx="6" fill="#1e293b" stroke="#64748b" stroke-width="2"/>
<line x1="885" y1="210" x2="885" y2="260" stroke="#475569" stroke-width="2"/>
<line x1="910" y1="210" x2="910" y2="260" stroke="#475569" stroke-width="2"/>
<line x1="935" y1="210" x2="935" y2="260" stroke="#475569" stroke-width="2"/>
<!-- 镇压阻尼弹簧 -->
<path d="M 910,195 L 905,200 L 915,204 L 905,208 L 910,212" fill="none" stroke="#f59e0b" stroke-width="2"/>
</g>
</g>
</svg>
<!-- 精简状态标识(左上) -->
<div class="corner-tag top-left-title">
<div class="status-dot"></div>
<div class="title-text">深浅分层松碎协同机构作业原理(40cm深松 + 15cm浅旋)</div>
</div>
<!-- 关键参数实时监控微标签(右上,严控尺寸) -->
<div class="corner-tag top-right-metrics">
<div>牵引阻力降: <span class="metric-val">-41.2%</span></div>
<div>纯功耗: <span class="metric-val" id="dyn-power">33.4</span> kW</div>
<div>碎土率(<50mm): <span class="metric-val">89.4%</span></div>
</div>
<!-- 协同动作时序微控底栏(底部边缘) -->
<div class="corner-tag bottom-bar">
<div class="flow-steps">
<div class="step-item">
<span class="step-num">1</span>
<span>限深轮锁基准</span>
</div>
<span class="step-arrow">→</span>
<div class="step-item">
<span class="step-num" style="color:var(--accent-amber);background:rgba(245,158,11,0.15)">2</span>
<span>23°窄翼剪切抬升40cm深层</span>
</div>
<span class="step-arrow">→</span>
<div class="step-item">
<span class="step-num" style="color:var(--accent-cyan);background:rgba(56,189,248,0.15)">3</span>
<span>浅旋刀260r/min细碎15cm表层</span>
</div>
<span class="step-arrow">→</span>
<div class="step-item">
<span class="step-num" style="color:var(--accent-emerald);background:rgba(16,185,129,0.15)">4</span>
<span>导流压降+辊轮平整镇墒</span>
</div>
</div>
<div class="controls-compact">
<button class="btn-toggle" id="btn-stress">切换剪切应变云场</button>
<button class="btn-toggle" id="btn-speed">作业速度: 1.0 m/s</button>
</div>
</div>
</div>
<script>
(function () {
// 画布与物理渲染初始化
const canvas = document.getElementById('sim-canvas');
const ctx = canvas.getContext('2d');
const rotatingBlades = document.getElementById('rotating-blades');
const gaugeSpokes = document.getElementById('gauge-spokes');
const stressWave = document.getElementById('stress-wave');
const dynPower = document.getElementById('dyn-power');
const btnSpeed = document.getElementById('btn-speed');
const btnStress = document.getElementById('btn-stress');
let width, height;
let scaleX, scaleY;
let animFrameId;
let lastTime = performance.now();
// 作业参数
let workSpeed = 1.0; // 0.8 ~ 1.2 m/s
let showStressField = true;
let bladeAngle = 0;
let wheelAngle = 0;
let globalOffset = 0;
// 坐标映射常数 (对应SVG内部 1200x675 坐标系)
const REF_W = 1200;
const REF_H = 675;
const Y_SURFACE = 260; // 0 cm 地表
const Y_SHALLOW = 365; // 15 cm 浅旋底边界
const Y_DEEP = 540; // 40 cm 深松铲底尖
// 土壤颗粒与断裂裂纹粒子池
const PARTICLES_COUNT = 280;
const particles = [];
class SoilParticle {
constructor() {
this.reset(true);
}
reset(initial = false) {
// 初始随机布满,后续自右侧生土区不断进入
this.x = initial ? Math.random() * REF_W : REF_W + Math.random() * 80;
// 分布在0~580深度之间
this.y = Y_SURFACE + Math.random() * (REF_H - Y_SURFACE - 60);
this.size = 2.5 + Math.random() * 3.5;
this.vx = 0;
this.vy = 0;
this.rot = Math.random() * Math.PI;
this.vRot = (Math.random() - 0.5) * 0.1;
this.state = 'raw'; // 'raw' 原状土 -> 'lifted' 深松微抬升 -> 'shattered' 旋耕打碎 -> 'compacted' 镇压
this.colorType = this.y > Y_SHALLOW ? 'deep' : 'shallow';
this.seed = Math.random();
}
update(dt, speedFactor) {
// 相对机器的位移 (土壤向左流动)
const moveDist = 200 * speedFactor * dt;
this.x -= moveDist;
// 核心动力学分区判断
// 1. 深松铲作用区 (X: 380 ~ 460, 深度跨越 Y_SURFACE 到 Y_DEEP)
if (this.x < 460 && this.x > 380 && this.y >= Y_SHALLOW && this.y <= Y_DEEP + 15) {
// 挤压与23°微抬升破坏 (抬升20-35mm,即20-30px,同时伴随剪切横向扰动)
if (this.state === 'raw') {
this.state = 'lifted';
this.vy = - (18 + Math.random() * 14); // 向上跃起抬升
}
}
// 2. 浅旋切削与抛掷区 (X: 640 ~ 780, 深度 Y_SURFACE 到 Y_SHALLOW)
const distToBlade = Math.hypot(this.x - 730, this.y - 275);
if (distToBlade < 95 && this.y >= Y_SURFACE - 30 && this.y <= Y_SHALLOW + 10) {
this.state = 'shattered';
this.size = Math.max(1.5, this.size * 0.65); // 粒径显著破碎,达成小于50mm指标
// 旋耕刀切削离心抛掷速度
this.vx = 40 + Math.random() * 50;
this.vy = - (45 + Math.random() * 40);
this.vRot = (Math.random() - 0.5) * 0.5;
}
// 3. 导流罩阻尼压低土流 (X: 650 ~ 820, 高度小于地表时被反弹)
if (this.y < Y_SURFACE - 40 && this.x > 640 && this.x < 830) {
this.vy = Math.abs(this.vy) * 0.8 + 15; // 阻抑飞溅向下压
}
// 4. 尾部镇压辊压平 (X: 860 ~ 960)
if (this.x > 860 && this.x < 960 && this.y < Y_SURFACE + 5) {
this.state = 'compacted';
this.y = Y_SURFACE + Math.random() * 3; // 抹平并锁住水分
this.vy = 0;
}
// 物理平流阻尼
this.x += this.vx * dt;
this.y += this.vy * dt;
this.rot += this.vRot;
this.vx *= 0.92;
this.vy = this.vy * 0.9 + 2.0; // 重力沉降恢复
// 越界重置
if (this.x < -40) {
this.reset(false);
}
}
draw(ctx) {
ctx.save();
ctx.translate(this.x, this.y);
ctx.rotate(this.rot);
if (this.state === 'shattered') {
// 表层细碎颗粒:高孔隙、透水透气
ctx.fillStyle = '#b8865b';
} else if (this.state === 'lifted') {
// 深层膨松剪切块:保持深土原貌但不翻土
ctx.fillStyle = '#644733';
} else {
// 原状土壤
ctx.fillStyle = this.colorType === 'deep' ? '#3e2c1f' : '#785538';
}
// 微型块状多边形渲染
ctx.fillRect(-this.size / 2, -this.size / 2, this.size, this.size);
ctx.restore();
}
}
// 初始化粒子
for (let i = 0; i < PARTICLES_COUNT; i++) {
particles.push(new SoilParticle());
}
function resize() {
const rect = canvas.getBoundingClientRect();
width = rect.width;
height = rect.height;
canvas.width = width * window.devicePixelRatio;
canvas.height = height * window.devicePixelRatio;
ctx.resetTransform();
ctx.scale(canvas.width / REF_W, canvas.height / REF_H);
}
window.addEventListener('resize', resize);
resize();
// 绘制土壤背景分层与剪切断裂滑移网格
function drawSoilStrata(time, speedFactor) {
globalOffset += speedFactor * 1.5;
// 1. 基底土层色带 (0~15cm, 15~40cm, >40cm)
// 0~15cm 浅耕细碎层
const gradShallow = ctx.createLinearGradient(0, Y_SURFACE, 0, Y_SHALLOW);
gradShallow.addColorStop(0, '#4a3322');
gradShallow.addColorStop(1, '#342317');
ctx.fillStyle = gradShallow;
ctx.fillRect(0, Y_SURFACE, REF_W, Y_SHALLOW - Y_SURFACE);
// 15~40cm 紧实底层 / 深松松动层
const gradDeep = ctx.createLinearGradient(0, Y_SHALLOW, 0, Y_DEEP);
gradDeep.addColorStop(0, '#2e1f15');
gradDeep.addColorStop(1, '#1e140d');
ctx.fillStyle = gradDeep;
ctx.fillRect(0, Y_SHALLOW, REF_W, Y_DEEP - Y_SHALLOW);
// >40cm 未扰动生土坚硬层 (犁底层以下)
ctx.fillStyle = '#140c08';
ctx.fillRect(0, Y_DEEP, REF_W, REF_H - Y_DEEP);
// 2. 剪切滑移应变应力场可视化 (破除矛盾的关键机理: 40cm不翻土仅产生滑移缝)
if (showStressField) {
ctx.save();
// 深松铲前方剪切滑动扇形线
ctx.strokeStyle = 'rgba(245, 158, 11, 0.35)';
ctx.lineWidth = 1.5;
ctx.setLineDash([4, 6]);
const waveShift = (time * 0.08) % 20;
for (let r = 30; r < 140; r += 28) {
ctx.beginPath();
ctx.arc(440, 540, r + waveShift, -Math.PI * 0.85, -Math.PI * 0.35);
ctx.stroke();
}
// 铲后深松纵向通透造孔裂隙带 (保持毛管断开与透水孔隙,降低浅旋阻力)
ctx.strokeStyle = 'rgba(56, 189, 248, 0.28)';
ctx.lineWidth = 2;
ctx.setLineDash([8, 8]);
ctx.beginPath();
ctx.moveTo(450, 480);
ctx.lineTo(730, 480);
ctx.moveTo(435, 520);
ctx.lineTo(820, 520);
ctx.stroke();
// 浅旋切削高能量耗散汇聚区 (仅集中在表层15cm极小范围,直观展现省功机理)
const crushGrad = ctx.createRadialGradient(730, 310, 10, 730, 310, 85);
crushGrad.addColorStop(0, 'rgba(56, 189, 248, 0.3)');
crushGrad.addColorStop(0.7, 'rgba(56, 189, 248, 0.08)');
crushGrad.addColorStop(1, 'transparent');
ctx.fillStyle = crushGrad;
ctx.beginPath();
ctx.arc(730, 310, 85, 0, Math.PI * 2);
ctx.fill();
ctx.restore();
}
// 3. 原地表与镇压后平整度对比动态
ctx.strokeStyle = 'rgba(148, 163, 184, 0.6)';
ctx.lineWidth = 1.5;
ctx.setLineDash([]);
ctx.beginPath();
// 原地表(右侧)微波浪
ctx.moveTo(REF_W, Y_SURFACE);
for (let x = REF_W; x >= 960; x -= 20) {
ctx.lineTo(x, Y_SURFACE + Math.sin((x + globalOffset) * 0.05) * 2.5);
}
// 镇压辊碾后(左侧)镜面级平整
ctx.lineTo(960, Y_SURFACE);
ctx.lineTo(0, Y_SURFACE);
ctx.stroke();
}
// 主循环
function animate(currentTime) {
const dt = Math.min((currentTime - lastTime) / 1000, 0.1);
lastTime = currentTime;
// 清除画布
ctx.clearRect(0, 0, REF_W, REF_H);
// 绘制动态土层与应力传导
drawSoilStrata(currentTime, workSpeed);
// 更新并绘制多相态土壤离散粒子
for (let i = 0; i < particles.length; i++) {
particles[i].update(dt, workSpeed);
particles[i].draw(ctx);
}
// 机构同步自转 (浅旋刀辊高转速 260 r/min,限深轮依地表速度被动回转)
bladeAngle += 260 * (360 / 60) * dt * (workSpeed / 1.0);
wheelAngle -= (workSpeed * 200 * dt);
if (rotatingBlades) {
rotatingBlades.setAttribute('transform', `rotate(${bladeAngle % 360} 730 275)`);
}
if (gaugeSpokes) {
gaugeSpokes.setAttribute('transform', `rotate(${wheelAngle % 360} 280 225)`);
}
// 应力波动态脉冲
if (stressWave) {
const dashOff = (currentTime * 0.04) % 20;
stressWave.style.strokeDashoffset = -dashOff;
}
// 动态功率波动模拟(30~38kW区间自适应微扰)
if (dynPower && Math.random() < 0.08) {
const basePower = 31.5 + (workSpeed - 0.8) * 12;
const noise = (Math.random() - 0.5) * 1.4;
dynPower.textContent = (basePower + noise).toFixed(1);
}
animFrameId = requestAnimationFrame(animate);
}
// 确保自启动且在重新聚焦/重开时平滑播放
requestAnimationFrame((t) => {
lastTime = t;
animFrameId = requestAnimationFrame(animate);
});
// 极简轻交互(边缘微控件)
btnSpeed.addEventListener('click', () => {
if (workSpeed === 1.0) {
workSpeed = 1.2;
btnSpeed.textContent = '作业速度: 1.2 m/s (高速)';
} else if (workSpeed === 1.2) {
workSpeed = 0.8;
btnSpeed.textContent = '作业速度: 0.8 m/s (低速)';
} else {
workSpeed = 1.0;
btnSpeed.textContent = '作业速度: 1.0 m/s (标定)';
}
});
btnStress.addEventListener('click', () => {
showStressField = !showStressField;
btnStress.style.color = showStressField ? 'var(--accent-cyan)' : 'var(--text-muted)';
btnStress.style.borderColor = showStressField ? 'rgba(56, 189, 248, 0.4)' : 'rgba(148, 163, 184, 0.2)';
});
// 页面可见性管理(防背景休眠漂移)
document.addEventListener('visibilitychange', () => {
if (!document.hidden) {
lastTime = performance.now();
}
});
})();
</script>
</body>
</html>
积分规则:每轮对话扣10分
等待动画代码生成...
