(tweens: SurfacedTween[], sel: string)
| 488 | // or orbit returning to its start — still reveals its travel instead of reading |
| 489 | // static (0→0). |
| 490 | function summarizeMotion(tweens: SurfacedTween[], sel: string): string { |
| 491 | const ranges = new Map<string, { min: number; max: number }>(); |
| 492 | const kfs = tweens |
| 493 | .filter((t) => t.target === sel && t.method !== "set") |
| 494 | .flatMap((t) => t.keyframes); |
| 495 | for (const kf of kfs) { |
| 496 | for (const [k, v] of Object.entries(kf.properties)) { |
| 497 | const n = num(v); |
| 498 | if (n !== null) bumpRange(ranges, k, n); |
| 499 | } |
| 500 | } |
| 501 | const varying = [...ranges.entries()] |
| 502 | .filter(([, r]) => r.max - r.min > 0.5) |
| 503 | .map(([k, r]) => `${k} ${Math.round(r.min)}..${Math.round(r.max)}`); |
| 504 | return varying.length ? varying.join(", ") : "(static)"; |
| 505 | } |
| 506 | |
| 507 | function bumpRange(ranges: Map<string, { min: number; max: number }>, k: string, n: number): void { |
| 508 | const r = ranges.get(k); |
no test coverage detected