Widen galaxy orbits, relax lock layout, enlarge vault disk

This commit is contained in:
Tessera Agent
2026-11-09 10:56:21 +00:00
parent a920235feb
commit 2085b35cfa
2 changed files with 111 additions and 45 deletions

View File

@@ -11,9 +11,10 @@ import { easeOutCubic, useGalaxyTime } from "../../hooks/useGalaxyMotion";
const MAX_STARS = 20; const MAX_STARS = 20;
const MAX_MOONS = 6; const MAX_MOONS = 6;
const STAR_R_FLOW = 5.5; const STAR_R_FLOW = 7.5;
const STAR_R_LOCK = 11; const STAR_R_LOCK = 12;
const HIT_R_LOCK = 18; const HIT_R_LOCK = 20;
const MOON_HIT_LOCK = 14;
function statusColor(status: string): string { function statusColor(status: string): string {
if (status === "failed") return "#f87171"; if (status === "failed") return "#f87171";
@@ -83,10 +84,10 @@ export function BlackholeGalaxy({
const snapsByOrbit = useMemo(() => groupSnaps(snapshots), [snapshots]); const snapsByOrbit = useMemo(() => groupSnaps(snapshots), [snapshots]);
return ( return (
<div className="w-[92%] max-w-[960px] h-[min(80dvh,88vw)] mx-auto flex items-center justify-center pb-16 pointer-events-auto"> <div className="absolute inset-0 flex items-center justify-center pt-16 pb-24 px-6 sm:px-10 pointer-events-auto">
<svg <svg
viewBox="-280 -280 560 560" viewBox="-300 -300 600 600"
className="w-full h-full" className="w-full h-full max-w-[min(96vw,1100px)] max-h-[min(85dvh,96vw)]"
preserveAspectRatio="xMidYMid meet" preserveAspectRatio="xMidYMid meet"
role="application" role="application"
aria-label="Galaxy vault viewport" aria-label="Galaxy vault viewport"
@@ -154,7 +155,7 @@ export function BlackholeGalaxy({
moons.length, moons.length,
t, t,
flowing && blend > 0.5, flowing && blend > 0.5,
30, 34,
); );
return ( return (
@@ -190,8 +191,8 @@ export function BlackholeGalaxy({
{moons.map((moon, mi) => { {moons.map((moon, mi) => {
const mp = moonPts[mi]; const mp = moonPts[mi];
const sel = moon.id === selectedSnapshotId; const sel = moon.id === selectedSnapshotId;
const mr = flowing ? 2.8 : sel ? 7 : 5.5; const mr = flowing ? 3.5 : sel ? 8 : 6;
const hit = flowing ? mr : 10; const hit = flowing ? mr : MOON_HIT_LOCK;
return ( return (
<g key={moon.id}> <g key={moon.id}>
{!flowing && ( {!flowing && (
@@ -259,32 +260,32 @@ function BlackHoleCore({
return ( return (
<g className="cursor-pointer" onClick={onToggle}> <g className="cursor-pointer" onClick={onToggle}>
<title>{flowing ? "Click to lock vault for targeting" : "Click to resume galaxy flow"}</title> <title>{flowing ? "Click to lock vault for targeting" : "Click to resume galaxy flow"}</title>
<circle cx="0" cy="0" r="118" fill="url(#bhCore)" opacity="0.85" /> <circle cx="0" cy="0" r="132" fill="url(#bhCore)" opacity="0.85" />
<ellipse <ellipse
cx="0" cx="0"
cy="0" cy="0"
rx="98" rx="118"
ry="26" ry="32"
fill="none" fill="none"
stroke="url(#bhDisk)" stroke="url(#bhDisk)"
strokeWidth="14" strokeWidth="16"
opacity="0.65" opacity="0.7"
transform={`rotate(${diskRot})`} transform={`rotate(${diskRot})`}
/> />
<ellipse <ellipse
cx="0" cx="0"
cy="0" cy="0"
rx="72" rx="86"
ry="18" ry="22"
fill="url(#bhDisk)" fill="url(#bhDisk)"
opacity="0.5" opacity="0.55"
transform={`rotate(${-diskRot * 1.4 + 14})`} transform={`rotate(${-diskRot * 1.4 + 14})`}
/> />
<circle cx="0" cy="0" r="32" fill="#000" stroke="#a78bfa" strokeOpacity="0.65" strokeWidth="1.5" /> <circle cx="0" cy="0" r="38" fill="#000" stroke="#a78bfa" strokeOpacity="0.7" strokeWidth="2" />
<circle <circle
cx="0" cx="0"
cy="0" cy="0"
r="108" r="122"
fill="none" fill="none"
stroke="#a78bfa" stroke="#a78bfa"
strokeOpacity={flowing ? 0.12 : 0.28} strokeOpacity={flowing ? 0.12 : 0.28}

View File

@@ -1,4 +1,4 @@
/** Flow + lock layouts in viewBox coordinates (±~240). */ /** Flow + lock layouts in viewBox coordinates (origin center, ±~300). */
export type OrbitPhysics = { export type OrbitPhysics = {
rx: number; rx: number;
@@ -8,16 +8,33 @@ export type OrbitPhysics = {
phase: number; phase: number;
}; };
const GOLDEN = 2.399963229728653; export type Vec2 = { x: number; y: number };
const GOLDEN = 2.399963229728653;
const VIEW_R = 258;
/** Per-star ellipses from inner rim to ~90% of viewport radius. */
export function flowOrbitPhysics(index: number, total: number): OrbitPhysics { export function flowOrbitPhysics(index: number, total: number): OrbitPhysics {
const ring = index % 4; const n = Math.max(total, 1);
const lane = index / Math.max(n - 1, 1);
const band = index % 5;
const rx =
92 +
lane * (VIEW_R - 92) +
band * 7 +
((index * 11) % 5) * 4;
const ry =
68 +
((index * 13) % 9) * 14 +
lane * 72 +
(index % 3) * 9;
const tiltDeg = -42 + ((index * 23 + band * 17) % 84);
return { return {
rx: 128 + ring * 26 + (index % 3) * 12, rx: Math.min(rx, VIEW_R),
ry: 88 + (index % 5) * 16 + ring * 12, ry: Math.min(ry, VIEW_R * 0.88),
tiltDeg: -28 + (index * 19) % 56, tiltDeg,
speed: 0.06 + (index % 7) * 0.011, speed: 0.05 + (index % 9) * 0.009 + band * 0.004,
phase: (index / Math.max(total, 1)) * Math.PI * 2 + index * 0.17, phase: (index / n) * Math.PI * 2 + index * GOLDEN * 0.15,
}; };
} }
@@ -26,7 +43,7 @@ export function positionOnEllipse(
rx: number, rx: number,
ry: number, ry: number,
tiltDeg: number, tiltDeg: number,
): { x: number; y: number } { ): Vec2 {
const ex = Math.cos(angle) * rx; const ex = Math.cos(angle) * rx;
const ey = Math.sin(angle) * ry; const ey = Math.sin(angle) * ry;
const rad = (tiltDeg * Math.PI) / 180; const rad = (tiltDeg * Math.PI) / 180;
@@ -36,46 +53,94 @@ export function positionOnEllipse(
}; };
} }
/** Even spread with minimum separation — polar slots + ring stagger. */ function slotSeed(index: number, total: number): Vec2 {
export function lockedSlot(index: number, total: number): { x: number; y: number } {
const n = Math.max(total, 1);
const angle = -Math.PI / 2 + index * GOLDEN; const angle = -Math.PI / 2 + index * GOLDEN;
const band = index % 3; const band = index % 4;
const radius = 138 + band * 48 + Math.floor(index / 3) * 6; const radius = 118 + band * 46 + Math.floor(index / 4) * 10;
const squash = 0.92 + (index % 2) * 0.06; const squash = 0.9 + (index % 3) * 0.05;
return { return {
x: Math.cos(angle) * radius, x: Math.cos(angle) * Math.min(radius, VIEW_R),
y: Math.sin(angle) * radius * squash, y: Math.sin(angle) * Math.min(radius, VIEW_R) * squash,
}; };
} }
function dist(a: Vec2, b: Vec2): number {
const dx = a.x - b.x;
const dy = a.y - b.y;
return Math.hypot(dx, dy);
}
const layoutCache = new Map<number, Vec2[]>();
/** Golden-angle seeds relaxed for minimum star separation (lock mode). */
export function lockedPositions(total: number): Vec2[] {
const cached = layoutCache.get(total);
if (cached) return cached;
const pts = Array.from({ length: total }, (_, i) => slotSeed(i, total));
const minSep = total > 14 ? 38 : 44;
for (let iter = 0; iter < 32; iter++) {
for (let i = 0; i < total; i++) {
for (let j = i + 1; j < total; j++) {
const d = dist(pts[i], pts[j]);
if (d < minSep && d > 0.001) {
const push = (minSep - d) * 0.55;
const ux = (pts[i].x - pts[j].x) / d;
const uy = (pts[i].y - pts[j].y) / d;
pts[i].x += ux * push;
pts[i].y += uy * push;
pts[j].x -= ux * push;
pts[j].y -= uy * push;
}
}
const r = dist(pts[i], { x: 0, y: 0 });
const vaultPad = 78;
if (r < vaultPad && r > 0.001) {
const s = vaultPad / r;
pts[i].x *= s;
pts[i].y *= s;
}
const edge = dist(pts[i], { x: 0, y: 0 });
if (edge > VIEW_R) {
const s = VIEW_R / edge;
pts[i].x *= s;
pts[i].y *= s;
}
}
}
layoutCache.set(total, pts);
return pts;
}
export function lockedSlot(index: number, total: number): Vec2 {
return lockedPositions(total)[index] ?? slotSeed(index, total);
}
export function moonPositions( export function moonPositions(
cx: number, cx: number,
cy: number, cy: number,
count: number, count: number,
time: number, time: number,
flowing: boolean, flowing: boolean,
baseSpread = 26, baseSpread = 32,
): { x: number; y: number; angle: number }[] { ): { x: number; y: number; angle: number }[] {
const out: { x: number; y: number; angle: number }[] = []; const out: { x: number; y: number; angle: number }[] = [];
for (let mi = 0; mi < count; mi++) { for (let mi = 0; mi < count; mi++) {
const slice = (mi / Math.max(count, 1)) * Math.PI * 2; const slice = (mi / Math.max(count, 1)) * Math.PI * 2;
const angle = flowing ? slice + time * (0.45 + mi * 0.05) : slice - Math.PI / 2; const angle = flowing ? slice + time * (0.4 + mi * 0.06) : slice - Math.PI / 2;
const dist = flowing ? baseSpread * 0.55 : baseSpread + (mi % 2) * 4; const dist = flowing ? baseSpread * 0.62 : baseSpread + (mi % 2) * 5;
out.push({ out.push({
angle, angle,
x: cx + Math.cos(angle) * dist, x: cx + Math.cos(angle) * dist,
y: cy + Math.sin(angle) * dist * 0.85, y: cy + Math.sin(angle) * dist * 0.86,
}); });
} }
return out; return out;
} }
export function lerpPos( export function lerpPos(a: Vec2, b: Vec2, t: number): Vec2 {
a: { x: number; y: number },
b: { x: number; y: number },
t: number,
): { x: number; y: number } {
return { return {
x: a.x * t + b.x * (1 - t), x: a.x * t + b.x * (1 - t),
y: a.y * t + b.y * (1 - t), y: a.y * t + b.y * (1 - t),