diff --git a/web/src/components/scene/BlackholeGalaxy.tsx b/web/src/components/scene/BlackholeGalaxy.tsx
index 4b80ba0..dd76833 100644
--- a/web/src/components/scene/BlackholeGalaxy.tsx
+++ b/web/src/components/scene/BlackholeGalaxy.tsx
@@ -1,18 +1,19 @@
import { useEffect, useMemo, useRef, useState } from "react";
import type { Orbit, Snapshot } from "../../api";
+import {
+ flowOrbitPhysics,
+ lockedSlot,
+ lerpPos,
+ moonPositions,
+ positionOnEllipse,
+} from "../../lib/galaxyLayout";
import { easeOutCubic, useGalaxyTime } from "../../hooks/useGalaxyMotion";
const MAX_STARS = 20;
const MAX_MOONS = 6;
-
-type StarLayout = {
- orbit: Orbit;
- rx: number;
- ry: number;
- speed: number;
- phase: number;
- size: number;
-};
+const STAR_R_FLOW = 5.5;
+const STAR_R_LOCK = 11;
+const HIT_R_LOCK = 18;
function statusColor(status: string): string {
if (status === "failed") return "#f87171";
@@ -64,53 +65,45 @@ export function BlackholeGalaxy({
}
let raf = 0;
const tick = () => {
- const dt = (performance.now() - blendStart.current) / 600;
- setBlend(flowing ? Math.min(1, dt) : Math.max(0, 1 - easeOutCubic(Math.min(1, dt))));
+ const dt = (performance.now() - blendStart.current) / 800;
+ setBlend(
+ flowing ? Math.min(1, dt) : Math.max(0, 1 - easeOutCubic(Math.min(1, dt))),
+ );
if (dt < 1) raf = requestAnimationFrame(tick);
};
raf = requestAnimationFrame(tick);
return () => cancelAnimationFrame(raf);
}, [flowing]);
- const stars = useMemo((): StarLayout[] => {
- const list = orbits.slice(0, MAX_STARS);
- return list.map((orbit, i) => {
- const n = Math.max(list.length, 1);
- const tier = i % 3;
- return {
- orbit,
- rx: 92 + tier * 22 + (i % 4) * 6,
- ry: 56 + tier * 14 + (i % 3) * 8,
- speed: 0.08 + (i % 7) * 0.012,
- phase: (i / n) * Math.PI * 2,
- size: 5 + (orbit.name.length % 3),
- };
- });
- }, [orbits]);
+ const starOrbits = useMemo(
+ () => orbits.slice(0, MAX_STARS),
+ [orbits],
+ );
const snapsByOrbit = useMemo(() => groupSnaps(snapshots), [snapshots]);
return (
-
+