From 7872e729cb3d0ff908c383ccc03bcd282b35d47d Mon Sep 17 00:00:00 2001 From: TianXuan Developer Date: Sat, 25 Jul 2026 14:43:33 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BA=A4=E5=8F=89=E6=B7=A1=E5=85=A5?= =?UTF-8?q?=E6=B7=A1=E5=87=BA=E5=8F=AF=E8=A7=81=E2=80=94=E6=9D=83=E9=87=8D?= =?UTF-8?q?=E8=8C=83=E5=9B=B4=E6=89=A9=E5=A4=A7=E5=88=B08%-100%?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - alpha: 0.08+0.92*weight (之前0.4+0.6导致不活跃边仍40%可见) - weight<0.05直接跳过(不可见) - 不再Math.max累积权重(每帧重新计算) 效果: t=0时w0边~100%可见+w1边~8%几乎不可见, 真正的淡入淡出 Co-Authored-By: Claude --- .../templates/simple_analysis/simple_analysis.html | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/simple_analysis/templates/simple_analysis/simple_analysis.html b/simple_analysis/templates/simple_analysis/simple_analysis.html index ab6adc6..71e898d 100644 --- a/simple_analysis/templates/simple_analysis/simple_analysis.html +++ b/simple_analysis/templates/simple_analysis/simple_analysis.html @@ -2781,14 +2781,16 @@ function renderTrafficCrossfade() { const w1 = mix.i + 1 < wins.length ? wins[mix.i + 1] : null; const t = mix.t; + // Each frame: add w0 edges with fade-out, w1 edges with fade-in const edgeMap = {}; function add(edges, w) { - if (!edges) return; + if (!edges || w <= 0) return; edges.forEach(e => { const k = e.source + '|' + e.target; if (!edgeMap[k]) edgeMap[k] = {source:e.source, target:e.target, weight:0, count:0}; - edgeMap[k].weight = Math.max(edgeMap[k].weight, w); - edgeMap[k].count = Math.max(edgeMap[k].count, e.count||0); + // Use the FRESHEST weight (not max accumulation), so old edges fade out + if (w > edgeMap[k].weight) edgeMap[k].weight = w; + if ((e.count||0) > edgeMap[k].count) edgeMap[k].count = e.count||0; }); } add(w0?w0.edges:[], 1-t); @@ -2813,8 +2815,9 @@ function renderTrafficCrossfade() { if (!p1 || !p2) return; const midX = (p1.x + p2.x) / 2; const midY = (p1.y + p2.y) / 2 - Math.abs(p2.x - p1.x) * 0.1; + if (e.weight < 0.05) return; // skip near-invisible edges const ratio = Math.min(1, e.count / maxCount); - const alpha = 0.4 + 0.6 * e.weight; + const alpha = 0.08 + 0.92 * e.weight; // Edge trace with src→dst color gradient const grad = ctx.createLinearGradient(p1.x, p1.y, p2.x, p2.y);