From ed4f84ef23a031cb984dc2d9ba13a50336924bda Mon Sep 17 00:00:00 2001 From: mango Date: Sun, 22 Feb 2026 19:37:01 +0800 Subject: [PATCH] feat: live jitter - gauge numbers wobble every 1s --- public/index.html | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/public/index.html b/public/index.html index 3b99884..4b0d94c 100644 --- a/public/index.html +++ b/public/index.html @@ -179,13 +179,17 @@ function renderLogs(){ } function animateNum(el,to,suffix=''){ - const from=parseFloat(el.textContent)||0; - if(from===to)return; - const d=to-from,steps=15,dt=40; - let i=0; - const fn=()=>{i++;el.textContent=(from+d*(i/steps)).toFixed(1)+suffix;if(i{ + document.querySelectorAll('.g-n').forEach(el=>{ + if(el._real==null||el.textContent==='—')return; + const r=el._real,jit=r*(0.02*Math.random()-0.01); + el.textContent=Math.max(0,r+jit).toFixed(1)+'%'; + }); +},1000); function updateNodeCard(n){ const el=document.querySelector(`.nd[data-id="${n.id}"]`); if(!el)return false;