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_MOONS = 6;
const STAR_R_FLOW = 5.5;
const STAR_R_LOCK = 11;
const HIT_R_LOCK = 18;
const STAR_R_FLOW = 7.5;
const STAR_R_LOCK = 12;
const HIT_R_LOCK = 20;
const MOON_HIT_LOCK = 14;
function statusColor(status: string): string {
if (status === "failed") return "#f87171";
@@ -83,10 +84,10 @@ export function BlackholeGalaxy({
const snapsByOrbit = useMemo(() => groupSnaps(snapshots), [snapshots]);
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
viewBox="-280 -280 560 560"
className="w-full h-full"
viewBox="-300 -300 600 600"
className="w-full h-full max-w-[min(96vw,1100px)] max-h-[min(85dvh,96vw)]"
preserveAspectRatio="xMidYMid meet"
role="application"
aria-label="Galaxy vault viewport"
@@ -154,7 +155,7 @@ export function BlackholeGalaxy({
moons.length,
t,
flowing && blend > 0.5,
30,
34,
);
return (
@@ -190,8 +191,8 @@ export function BlackholeGalaxy({
{moons.map((moon, mi) => {
const mp = moonPts[mi];
const sel = moon.id === selectedSnapshotId;
const mr = flowing ? 2.8 : sel ? 7 : 5.5;
const hit = flowing ? mr : 10;
const mr = flowing ? 3.5 : sel ? 8 : 6;
const hit = flowing ? mr : MOON_HIT_LOCK;
return (
<g key={moon.id}>
{!flowing && (
@@ -259,32 +260,32 @@ function BlackHoleCore({
return (
<g className="cursor-pointer" onClick={onToggle}>
<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
cx="0"
cy="0"
rx="98"
ry="26"
rx="118"
ry="32"
fill="none"
stroke="url(#bhDisk)"
strokeWidth="14"
opacity="0.65"
strokeWidth="16"
opacity="0.7"
transform={`rotate(${diskRot})`}
/>
<ellipse
cx="0"
cy="0"
rx="72"
ry="18"
rx="86"
ry="22"
fill="url(#bhDisk)"
opacity="0.5"
opacity="0.55"
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
cx="0"
cy="0"
r="108"
r="122"
fill="none"
stroke="#a78bfa"
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 = {
rx: number;
@@ -8,16 +8,33 @@ export type OrbitPhysics = {
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 {
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 {
rx: 128 + ring * 26 + (index % 3) * 12,
ry: 88 + (index % 5) * 16 + ring * 12,
tiltDeg: -28 + (index * 19) % 56,
speed: 0.06 + (index % 7) * 0.011,
phase: (index / Math.max(total, 1)) * Math.PI * 2 + index * 0.17,
rx: Math.min(rx, VIEW_R),
ry: Math.min(ry, VIEW_R * 0.88),
tiltDeg,
speed: 0.05 + (index % 9) * 0.009 + band * 0.004,
phase: (index / n) * Math.PI * 2 + index * GOLDEN * 0.15,
};
}
@@ -26,7 +43,7 @@ export function positionOnEllipse(
rx: number,
ry: number,
tiltDeg: number,
): { x: number; y: number } {
): Vec2 {
const ex = Math.cos(angle) * rx;
const ey = Math.sin(angle) * ry;
const rad = (tiltDeg * Math.PI) / 180;
@@ -36,46 +53,94 @@ export function positionOnEllipse(
};
}
/** Even spread with minimum separation — polar slots + ring stagger. */
export function lockedSlot(index: number, total: number): { x: number; y: number } {
const n = Math.max(total, 1);
function slotSeed(index: number, total: number): Vec2 {
const angle = -Math.PI / 2 + index * GOLDEN;
const band = index % 3;
const radius = 138 + band * 48 + Math.floor(index / 3) * 6;
const squash = 0.92 + (index % 2) * 0.06;
const band = index % 4;
const radius = 118 + band * 46 + Math.floor(index / 4) * 10;
const squash = 0.9 + (index % 3) * 0.05;
return {
x: Math.cos(angle) * radius,
y: Math.sin(angle) * radius * squash,
x: Math.cos(angle) * Math.min(radius, VIEW_R),
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(
cx: number,
cy: number,
count: number,
time: number,
flowing: boolean,
baseSpread = 26,
baseSpread = 32,
): { x: number; y: number; angle: number }[] {
const out: { x: number; y: number; angle: number }[] = [];
for (let mi = 0; mi < count; mi++) {
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 dist = flowing ? baseSpread * 0.55 : baseSpread + (mi % 2) * 4;
const angle = flowing ? slice + time * (0.4 + mi * 0.06) : slice - Math.PI / 2;
const dist = flowing ? baseSpread * 0.62 : baseSpread + (mi % 2) * 5;
out.push({
angle,
x: cx + Math.cos(angle) * dist,
y: cy + Math.sin(angle) * dist * 0.85,
y: cy + Math.sin(angle) * dist * 0.86,
});
}
return out;
}
export function lerpPos(
a: { x: number; y: number },
b: { x: number; y: number },
t: number,
): { x: number; y: number } {
export function lerpPos(a: Vec2, b: Vec2, t: number): Vec2 {
return {
x: a.x * t + b.x * (1 - t),
y: a.y * t + b.y * (1 - t),