feat: draw orbits as stars in the realistic look and follow the radar wave

The orbit overlay fit the radar look but read as a diagram laid over the
realistic one. Give each look its own grammar over the same data.

- Realistic look: each orbit is a star with a bright core, a status-tinted
  glow and four tapered diffraction spikes, which the sky's own stars never
  have. Status still shows by shape as well as colour. Tracks recede to a faint
  trace, hovering a marker reveals its shell, and the selected orbit keeps its
  dashed ring. Moving markers trail a tapered comet tail along their orbit.
- Stars shimmer out of phase on the scene loop that already runs, more for
  working and failed ones. A stopped map is still, and reduced motion turns it
  off. Hovering a star enlarges it with the shared spring.
- Radar look: plain instrument dots and full-strength tracks, as before.
- The overlay takes the look at each marker's and ring's own distance from the
  hole, so it changes as the radar wave front passes. The renderer exposes this
  as signal.lookAt and calls signal.onLook while the wave runs.
- Slow the wave spring so the front takes about 0.4 s to cross the orbit area
  instead of 0.2 s, and end it at 99.5% progress.
- Test that a marker's trail points back along its motion.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-13 22:11:49 +07:00
parent 34e9afc8a4
commit d0f22c4ad0
8 changed files with 187 additions and 18 deletions

View File

@@ -1,6 +1,6 @@
import assert from "node:assert/strict";
import test from "node:test";
import { capturePhases, assignOrbitSlots, orbitPose, groupSnapshots, moonPoses } from "../src/lib/galaxyLayout.ts";
import { capturePhases, assignOrbitSlots, orbitPose, groupSnapshots, moonPoses, trailAngle } from "../src/lib/galaxyLayout.ts";
import { placeLabels } from "../src/lib/galaxyLabelLayout.ts";
test("slot identities survive reordering, insertion and removal", () => {
@@ -84,3 +84,16 @@ test("the selected label searches farther when nearby orbit markers crowd it out
assert.deepEqual(placeLabels([selected], 300, 300, [cluster]), []);
assert.equal(placeLabels([selected], 300, 300, [cluster], selected.id)[0]?.id, selected.id);
});
test("a marker's trail points back along the direction it came from", () => {
const slots = assignOrbitSlots(Array.from({ length: 30 }, (_, i) => String(i)));
for (const slot of slots.values()) {
for (const time of [0, 3.7, 41]) {
const now = orbitPose(slot, time);
const next = orbitPose(slot, time + 0.01);
const tail = Math.atan2(-(next.y - now.y), -(next.x - now.x));
const diff = Math.atan2(Math.sin(trailAngle(slot, time) - tail), Math.cos(trailAngle(slot, time) - tail));
assert.ok(Math.abs(diff) < 0.01, `trail off by ${diff}`);
}
}
});