74 lines
2.5 KiB
TypeScript
74 lines
2.5 KiB
TypeScript
// Decorative zodiac wheel for the login page (pure SVG, no data needed).
|
||||
|
|
|
|||
|
|
const GLYPHS = ["♈", "♉", "♊", "♋", "♌", "♍", "♎", "♏", "♐", "♑", "♒", "♓"];
|
|||
|
|
// A few planets of a sample sky, for the aspect lines in the middle.
|
|||
|
|
const SAMPLE = [12, 75, 131, 200, 247, 302, 338];
|
|||
|
|
|
|||
|
|
function point(deg: number, r: number) {
|
|||
|
|
const t = ((180 - deg) * Math.PI) / 180;
|
|||
|
|
return { x: 50 + r * Math.cos(t), y: 50 - r * Math.sin(t) };
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
export function ZodiacWheel({ className }: { className?: string }) {
|
|||
|
|
const lines: { a: number; b: number; hard: boolean }[] = [];
|
|||
|
|
SAMPLE.forEach((a, i) =>
|
|||
|
|
SAMPLE.slice(i + 1).forEach((b) => {
|
|||
|
|
let d = Math.abs(a - b) % 360;
|
|||
|
|
if (d > 180) d = 360 - d;
|
|||
|
|
if (Math.abs(d - 120) < 8 || Math.abs(d - 60) < 6) lines.push({ a, b, hard: false });
|
|||
|
|
else if (Math.abs(d - 90) < 7 || Math.abs(d - 180) < 8) lines.push({ a, b, hard: true });
|
|||
|
|
}),
|
|||
|
|
);
|
|||
|
|
return (
|
|||
|
|
<svg className={className} viewBox="0 0 100 100" aria-hidden="true">
|
|||
|
|
<circle cx="50" cy="50" r="49" fill="none" stroke="#2c3654" strokeWidth="0.5" />
|
|||
|
|
<circle cx="50" cy="50" r="38" fill="none" stroke="#2c3654" strokeWidth="0.35" />
|
|||
|
|
<circle cx="50" cy="50" r="24" fill="#0f1426" stroke="#263049" strokeWidth="0.35" />
|
|||
|
|
{GLYPHS.map((_, i) => {
|
|||
|
|
const a = point(i * 30, 38);
|
|||
|
|
const b = point(i * 30, 49);
|
|||
|
|
return <line key={`d${i}`} x1={a.x} y1={a.y} x2={b.x} y2={b.y} stroke="#263049" strokeWidth="0.35" />;
|
|||
|
|
})}
|
|||
|
|
{GLYPHS.map((g, i) => {
|
|||
|
|
const p = point(i * 30 + 15, 43.5);
|
|||
|
|
return (
|
|||
|
|
<text
|
|||
|
|
key={g}
|
|||
|
|
x={p.x}
|
|||
|
|
y={p.y}
|
|||
|
|
textAnchor="middle"
|
|||
|
|
dominantBaseline="central"
|
|||
|
|
fontSize="5"
|
|||
|
|
fill={i % 3 === 0 ? "#d9b46a" : "#5a6790"}
|
|||
|
|
style={{ fontFamily: "var(--font-symbols)" }}
|
|||
|
|
>
|
|||
|
|
{g}
|
|||
|
|
{"︎"}
|
|||
|
|
</text>
|
|||
|
|
);
|
|||
|
|
})}
|
|||
|
|
{lines.map(({ a, b, hard }) => {
|
|||
|
|
const p = point(a, 24);
|
|||
|
|
const q = point(b, 24);
|
|||
|
|
return (
|
|||
|
|
<line
|
|||
|
|
key={`${a}-${b}`}
|
|||
|
|
x1={p.x}
|
|||
|
|
y1={p.y}
|
|||
|
|
x2={q.x}
|
|||
|
|
y2={q.y}
|
|||
|
|
stroke={hard ? "#f08a4b" : "#7fb0ff"}
|
|||
|
|
strokeWidth="0.4"
|
|||
|
|
strokeDasharray={hard ? undefined : "1.4 0.8"}
|
|||
|
|
opacity="0.8"
|
|||
|
|
/>
|
|||
|
|
);
|
|||
|
|
})}
|
|||
|
|
{SAMPLE.map((d) => {
|
|||
|
|
const p = point(d, 24);
|
|||
|
|
return <circle key={d} cx={p.x} cy={p.y} r="0.9" fill="#ece6d8" />;
|
|||
|
|
})}
|
|||
|
|
</svg>
|
|||
|
|
);
|
|||
|
|
}
|