Prompt specification
Build or customize the Three.js 3D scene "Change Orbital Inclination and Count Alignments" inside the active workspace.
Engineering Constraints:
1. Runtime & Orbit: Use Three.js r160 with OrbitControls (damping enabled) and ACESFilmicToneMapping.
2. Frame Timing: Drive all motion strictly with clock.getDelta() so animation speed is FPS-independent.
3. Viewport Hygiene: Handle window resize cleanly, cap DPR at Math.min(window.devicePixelRatio, 2), and dispose geometries/materials/renderer on unmount.
Scene Metadata:
Scene: Change Orbital Inclination and Count Alignments
Category: Voxel Worlds · Style: Voxel 3D
License: MIT · Reference: https://three3d.app/scene/change-orbital-inclination-and-count-alignments-x3776
Scene Description Prompt:
Make one HTML file using Three.js from cdnjs for this voxel scene: Create an idealized eclipse-alignment explorer varying inclination only. Show which passes satisfy the geometric condition and avoid presenting the toy count as a real eclipse prediction.
Working Three.js Starter (change-orbital-inclination-and-count-alignments-x3776):
```html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Umbra Lab — Idealized Eclipse Alignment Explorer</title>
<style>
:root {
color-scheme: dark;
--bg: #05070c;
--panel: rgba(12, 18, 28, 0.9);
--panel-solid: #0b111b;
--line: rgba(154, 191, 205, 0.16);
--line-strong: rgba(154, 191, 205, 0.3);
--text: #e9f1f3;
--muted: #91a4ad;
--faint: #60727b;
--cyan: #72e1d4;
--cyan-dark: #173d40;
--green: #6be5ae;
--amber: #ffc96b;
--red: #ff7084;
--mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
--sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* {
box-sizing: border-box;
}
html {
min-width: 320px;
background: var(--bg);
}
body {
margin: 0;
min-height: 100vh;
color: var(--text);
background:
radial-gradient(circle at 16% 0%, rgba(46, 119, 126, 0.11), transparent 30rem),
radial-gradient(circle at 92% 30%, rgba(73, 60, 119, 0.08), transparent 28rem),
var(--bg);
font-family: var(--sans);
}
button,
input {
font: inherit;
}
button {
color: inherit;
}
.app {
width: min(1680px, 100%);
margin: 0 auto;
}
.topbar {
min-height: 74px;
padding: 18px 24px;
display: flex;
align-items: center;
justify-content: space-between;
gap: 20px;
border-bottom: 1px solid var(--line);
}
.brand {
display: flex;
align-items: center;
gap: 13px;
}
.brand-mark {
width: 38px;
height: 38px;
display: grid;
place-items: center;
position: relative;
border: 1px solid rgba(114, 225, 212, 0.45);
border-radius: 10px;
background: rgba(114, 225, 212, 0.06);
box-shadow: inset 0 0 22px rgba(114, 225, 212, 0.08);
}
.brand-mark::before {
content: "";
width: 17px;
height: 17px;
border-radius: 50%;
background: var(--cyan);
box-shadow: 0 0 16px rgba(114, 225, 212, 0.46);
}
.brand-mark::after {
content: "";
position: absolute;
width: 23px;
height: 7px;
left: 7px;
top: 15px;
border-radius: 50%;
background: #05070c;
transform: rotate(-18deg);
}
.eyebrow,
.micro-label {
font-family: var(--mono);
font-size: 10px;
line-height: 1.3;
letter-spacing: 0.13em;
text-transform: uppercase;
}
.eyebrow {
color: var(--cyan);
}
h1 {
margin: 2px 0 0;
font-size: clamp(17px, 2vw, 22px);
line-height: 1.1;
letter-spacing: -0.025em;
font-weight: 650;
}
.header-note {
display: flex;
align-items: center;
gap: 10px;
color: var(--muted);
font-size: 12px;
text-align: right;
}
.forecast-badge,
.tiny-badge {
border: 1px solid rgba(255, 201, 107, 0.35);
color: var(--amber);
background: rgba(255, 201, 107, 0.07);
border-radius: 999px;
font-family: var(--mono);
font-size: 9px;
letter-spacing: 0.09em;
text-transform: uppercase;
}
.forecast-badge {
padding: 8px 10px;
white-space: nowrap;
}
.workspace {
display: grid;
grid-template-columns: minmax(0, 1fr) 350px;
min-height: 630px;
height: calc(100vh - 288px);
}
.viewport {
position: relative;
min-width: 0;
overflow: hidden;
border-right: 1px solid var(--line);
background:
radial-gradient(circle at 50% 50%, rgba(21, 46, 61, 0.16), transparent 50%),
#04070c;
}
#scene {
width: 100%;
height: 100%;
display: block;
touch-action: none;
cursor: grab;
outline: none;
}
#scene:active {
cursor: grabbing;
}
.viewport::after {
content: "";
position: absolute;
inset: 0;
pointer-events: none;
background:
linear-gradient(to bottom, rgba(3, 6, 10, 0.28), transparent 18%, transparent 75%, rgba(3, 6, 10, 0.7)),
radial-gradient(circle at center, transparent 55%, rgba(0, 0, 0, 0.35));
}
.scene-header {
position: absolute;
z-index: 4;
top: 20px;
left: 22px;
right: 22px;
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 15px;
pointer-events: none;
}
.scene-title {
max-width: 390px;
}
.scene-title h2 {
margin: 5px 0 4px;
font-size: 18px;
letter-spacing: -0.02em;
font-weight: 600;
}
.scene-title p {
margin: 0;
color: var(--muted);
font-size: 12px;
line-height: 1.5;
}
.scene-status {
display: inline-flex;
align-items: center;
gap: 8px;
padding: 9px 11px;
border: 1px solid var(--line-strong);
border-radius: 8px;
background: rgba(6, 10, 16, 0.76);
backdrop-filter: blur(12px);
font-family: var(--mono);
font-size: 10px;
letter-spacing: 0.06em;
white-space: nowrap;
}
.status-dot {
width: 7px;
height: 7px;
border-radius: 50%;
background: var(--green);
box-shadow: 0 0 10px currentColor;
}
.scene-labels {
position: absolute;
inset: 0;
z-index: 3;
pointer-events: none;
}
.object-label {
position: absolute;
transform: translate(-50%, -100%);
padding: 5px 8px;
border: 1px solid rgba(177, 213, 221, 0.22);
border-radius: 5px;
background: rgba(4, 8, 13, 0.76);
color: #b9cbd0;
font-family: var(--mono);
font-size: 9px;
letter-spacing: 0.12em;
text-transform: uppercase;
white-space: nowrap;
}
.object-label strong {
display: block;
margin-top: 2px;
color: var(--text);
font-size: 10px;
letter-spacing: 0.04em;
text-transform: none;
}
.control-dock {
position: absolute;
z-index: 5;
left: 22px;
right: 22px;
bottom: 20px;
display: grid;
grid-template-columns: minmax(260px, 1fr) auto;
gap: 16px;
align-items: center;
padding: 14px 15px;
border: 1px solid var(--line-strong);
border-radius: 12px;
background: rgba(7, 12, 19, 0.82);
backdrop-filter: blur(18px);
box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
}
.slider-head {
display: flex;
align-items: baseline;
justify-content: space-between;
gap: 12px;
margin-bottom: 9px;
}
.slider-head label {
color: #c7d5d9;
font-size: 12px;
font-weight: 600;
}
#inclinationValue {
color: var(--cyan);
font-family: var(--mono);
font-size: 20px;
font-weight: 600;
}
.range-wrap {
position: relative;
}
input[type="range"] {
width: 100%;
height: 5px;
margin: 0;
appearance: none;
border-radius: 999px;
outline: none;
background: linear-gradient(
to right,
var(--cyan) 0%,
var(--cyan) var(--fill, 10%),
#1a2932 var(--fill, 10%),
#1a2932 100%
);
cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
width: 16px;
height: 16px;
appearance: none;
border: 3px solid #081018;
border-radius: 50%;
background: var(--cyan);
box-shadow: 0 0 0 1px rgba(114, 225, 212, 0.65), 0 0 14px rgba(114, 225, 212, 0.35);
}
input[type="range"]::-moz-range-thumb {
width: 11px;
height: 11px;
border: 3px solid #081018;
border-radius: 50%;
background: var(--cyan);
box-shadow: 0 0 0 1px rgba(114, 225, 212, 0.65);
}
.range-labels {
display: flex;
justify-content: space-between;
margin-top: 7px;
color: var(--faint);
font-family: var(--mono);
font-size: 9px;
}
.presets,
.view-buttons {
display: flex;
gap: 6px;
flex-wrap: wrap;
}
.preset,
.icon-button {
border: 1px solid var(--line-strong);
background: rgba(255, 255, 255, 0.025);
color: var(--muted);
border-radius: 7px;
cursor: pointer;
transition: 150ms ease;
}
.preset {
min-width: 46px;
padding: 8px 9px;
font-family: var(--mono);
font-size: 10px;
}
.preset:hover,
.preset.active,
.icon-button:hover {
color: var(--cyan);
border-color: rgba(114, 225, 212, 0.52);
background: rgba(114, 225, 212, 0.08);
}
.view-buttons {
align-self: center;
}
.icon-button {
width: 34px;
height: 34px;
display: grid;
place-items: center;
font-size: 16px;
}
.side-panel {
min-width: 0;
padding: 18px;
overflow: auto;
background: rgba(8, 13, 21, 0.78);
}
.panel-section {
padding-bottom: 18px;
margin-bottom: 18px;
border-bottom: 1px solid var(--line);
}
.panel-section:last-child {
margin-bottom: 0;
border-bottom: 0;
}
.section-heading {
display: flex;
align-items: center;
justify-content: space-between;
gap: 10px;
margin-bottom: 12px;
}
.section-heading h3 {
margin: 0;
font-size: 13px;
font-weight: 650;
letter-spacing: -0.01em;
}
.tiny-badge {
padding: 5px 7px;
border-color: var(--line-strong);
color: var(--muted);
background: rgba(255, 255, 255, 0.025);
}
.result-card {
padding: 15px;
border: 1px solid var(--line-strong);
border-radius: 11px;
background:
linear-gradient(145deg, rgba(255, 255, 255, 0.045), transparent 60%),
#0b121c;
}
.result-card.good {
border-color: rgba(107, 229, 174, 0.36);
}
.result-card.warn {
border-color: rgba(255, 201, 107, 0.38);
}
.result-card.bad {
border-color: rgba(255, 112, 132, 0.38);
}
.result-pass {
color: var(--muted);
font-family: var(--mono);
font-size: 10px;
letter-spacing: 0.09em;
}
.result-state {
margin: 8px 0 5px;
font-size: 17px;
line-height: 1.22;
font-weight: 650;
letter-spacing: -0.025em;
}
.result-card.good .result-state {
color: var(--green);
}
.result-card.warn .result-state {
color: var(--amber);
}
.result-card.bad .result-state {
color: var(--red);
}
.result-copy {
min-height: 42px;
color: var(--muted);
font-size: 11px;
line-height: 1.55;
}
.metric-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 8px;
margin-top: 12px;
}
.metric {
padding: 10px;
border: 1px solid var(--line);
border-radius: 8px;
background: rgba(255, 255, 255, 0.02);
}
.metric-label {
color: var(--faint);
font-family: var(--mono);
font-size: 8px;
letter-spacing: 0.08em;
text-transform: uppercase;
}
.metric-value {
margin-top: 5px;
color: #dce9eb;
font-family: var(--mono);
font-size: 15px;
}
.count-row {
display: grid;
grid-template-columns: 1fr auto;
align-items: end;
gap: 15px;
margin-bottom: 12px;
}
.count-number {
color: var(--cyan);
font-family: var(--mono);
font-size: 34px;
line-height: 1;
letter-spacing: -0.06em;
}
.count-number small {
color: var(--faint);
font-size: 15px;
letter-spacing: -0.02em;
}
.count-copy {
color: var(--muted);
font-size: 10px;
line-height: 1.45;
text-align: right;
}
.gate-layout {
display: grid;
grid-template-columns: 118px 1fr;
align-items: center;
gap: 15px;
}
.gate {
position: relative;
width: 112px;
height: 112px;
border: 1px solid var(--line);
border-radius: 50%;
background:
linear-gradient(to bottom, transparent 49.5%, rgba(151, 190, 201, 0.17) 49.5%, rgba(151, 190, 201, 0.17) 50.5%, transparent 50.5%),
radial-gradient(circle, rgba(114, 225, 212, 0.07), transparent 65%);
}
.gate::before {
content: "";
position: absolute;
inset: 13px;
border: 1px dashed rgba(114, 225, 212, 0.34);
border-radius: 50%;
}
.gate-label {
position: absolute;
top: 50%;
left: 50%;
width: 6px;
height: 6px;
border-radius: 50%;
background: var(--cyan);
transform: translate(-50%, -50%);
box-shadow: 0 0 0 4px rgba(114, 225, 212, 0.1);
}
.gate-dot {
position: absolute;
top: 50%;
left: 50%;
width: 12px;
height: 12px;
border: 2px solid #071018;
border-radius: 50%;
background: var(--green);
box-shadow: 0 0 12px currentColor;
transform: translate(-50%, -50%);
transition: top 180ms ease, background 180ms ease;
z-index: 2;
}
.gate-legend {
color: var(--muted);
font-size: 10px;
line-height: 1.65;
}
.gate-legend strong {
color: var(--text);
font-family: var(--mono);
font-size: 11px;
}
.constant-row {
display: flex;
justify-content: space-between;
gap: 12px;
padding: 7px 0;
color: var(--muted);
font-size: 10px;
border-bottom: 1px solid rgba(154, 191, 205, 0.08);
}
.constant-row:last-child {
border-bottom: 0;
}
.constant-row span:last-child {
color: #c8d7da;
font-family: var(--mono);
text-align: right;
}
details {
color: var(--muted);
font-size: 11px;
line-height: 1.6;
}
summary {
cursor: pointer;
color: #c6d5d9;
font-weight: 600;
}
details p {
margin: 10px 0 0;
}
code {
color: var(--cyan);
font-family: var(--mono);
font-size: 10px;
}
.pass-section {
padding: 17px 24px 18px;
border-top: 1px solid var(--line);
border-bottom: 1px solid var(--line);
background: rgba(7, 11, 18, 0.88);
}
.pass-heading {
display: flex;
align-items: flex-end;
justify-content: space-between;
gap: 18px;
margin-bottom: 12px;
}
.pass-heading h2 {
margin: 0 0 3px;
font-size: 14px;
font-weight: 650;
}
.pass-heading p {
margin: 0;
color: var(--muted);
font-size: 10px;
}
.pass-legend {
display: flex;
gap: 13px;
color: var(--faint);
font-family: var(--mono);
font-size: 9px;
}
.legend-item {
display: inline-flex;
align-items: center;
gap: 5px;
}
.legend-swatch {
width: 7px;
height: 7px;
border-radius: 50%;
}
.pass-list {
display: grid;
grid-auto-flow: column;
grid-auto-columns: minmax(145px, 1fr);
gap: 8px;
overflow-x: auto;
padding: 1px 1px 7px;
scrollbar-color: #263b45 transparent;
}
.pass-card {
position: relative;
min-height: 103px;
padding: 11px;
text-align: left;
border: 1px solid var(--line);
border-radius: 9px;
background: rgba(255, 255, 255, 0.018);
cursor: pointer;
transition: border-color 140ms ease, transform 140ms ease, background 140ms ease;
}
.pass-card:hover {
transform: translateY(-1px);
background: rgba(255, 255, 255, 0.035);
}
.pass-card.selected {
border-color: rgba(114, 225, 212, 0.58);
background: rgba(114, 225, 212, 0.055);
box-shadow: inset 0 0 0 1px rgba(114, 225, 212, 0.08);
}
.pass-top {
display: flex;
align-items: center;
justify-content: space-between;
gap: 8px;
}
.pass-id {
color: #d9e6e8;
font-family: var(--mono);
font-size: 11px;
font-weight: 650;
}
.pass-badge {
padding: 4px 5px;
border-radius: 4px;
font-family: var(--mono);
font-size: 7px;
letter-spacing: 0.06em;
text-transform: uppercase;
}
.pass-badge.good {
color: var(--green);
background: rgba(107, 229, 174, 0.09);
}
.pass-badge.warn {
color: var(--amber);
background: rgba(255, 201, 107, 0.09);
}
.pass-badge.bad {
color: var(--red);
background: rgba(255, 112, 132, 0.09);
}
.pass-lambda {
margin-top: 10px;
color: var(--faint);
font-family: var(--mono);
font-size: 8px;
letter-spacing: 0.07em;
}
.pass-separation {
margin-top: 3px;
color: #c6d5d8;
font-family: var(--mono);
font-size: 12px;
}
.warning-footer {
min-height: 54px;
padding: 13px 24px;
display: flex;
align-items: center;
gap: 12px;
color: #a8b5ba;
font-size: 10px;
line-height: 1.5;
}
.warning-icon {
flex: 0 0 auto;
width: 24px;
height: 24px;
display: grid;
place-items: center;
border: 1px solid rgba(255, 201, 107, 0.35);
border-radius: 50%;
color: var(--amber);
font-family: var(--mono);
font-size: 12px;
}
.warning-footer strong {
color: var(--amber);
font-weight: 600;
}
@media (max-width: 980px) {
.workspace {
grid-template-columns: 1fr;
height: auto;
}
.viewport {
min-height: 610px;
border-right: 0;
border-bottom: 1px solid var(--line);
}
.side-panel {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 20px;
overflow: visible;
}
.panel-section {
margin: 0;
}
}
@media (max-width: 650px) {
.topbar {
padding: 14px;
align-items: flex-start;
}
.header-note > span:last-child {
display: none;
}
.viewport {
min-height: 560px;
}
.scene-header {
top: 14px;
left: 14px;
right: 14px;
}
.scene-title h2 {
font-size: 15px;
}
.scene-title p {
display: none;
}
.scene-status {
padding: 8px;
font-size: 8px;
}
.control-dock {
left: 12px;
right: 12px;
bottom: 12px;
grid-template-columns: 1fr;
gap: 10px;
}
.presets {
justify-content: space-between;
}
.preset {
flex: 1;
}
.view-buttons {
position: absolute;
right: 14px;
bottom: 142px;
}
.side-panel {
display: block;
padding: 15px;
}
.panel-section {
margin-bottom: 18px;
}
.pass-section {
padding: 15px;
}
.pass-heading {
align-items: flex-start;
flex-direction: column;
gap: 9px;
}
.pass-list {
grid-auto-columns: 142px;
}
.warning-footer {
padding: 13px 15px;
align-items: flex-start;
}
}
@media (prefers-reduced-motion: reduce) {
*,
*::before,
*::after {
scroll-behavior: auto !important;
transition-duration: 0.001ms !important;
}
}
</style>
</head>
<body>
<div class="app">
<header class="topbar">
<div class="brand">
<div class="brand-mark" aria-hidden="true"></div>
<div>
<div class="eyebrow">Umbra Lab / Geometry Study 01</div>
<h1>Idealized Eclipse Alignment Explorer</h1>
</div>
</div>
<div class="header-note">
<span>Inclination is the only parameter being varied.</span>
<span class="forecast-badge">Synthetic — not a forecast</span>
</div>
</header>
<main class="workspace">
<section class="viewport" id="viewport" aria-label="Interactive voxel alignment scene">
<canvas id="scene" aria-label="Voxel scene of the Sun, Earth, inclined lunar orbit, and selected synthetic alignment pass"></canvas>
<div class="scene-header">
<div class="scene-title">
<div class="eyebrow">Circular orbit / fixed node</div>
<h2>One inclination. Twelve synthetic longitude gates.</h2>
<p>Drag to orbit the camera, scroll to zoom, and select a pass below.</p>
</div>
<div class="scene-status" id="sceneStatus">
<span class="status-dot"></span>
<span id="sceneStatusText">UPDATING</span>
</div>
</div>
<div class="scene-labels" aria-hidden="true">
<div class="object-label" id="sunLabel">Sun<strong>mean angular radius</strong></div>
<div class="object-label" id="earthLabel">Earth<strong>fixed observer</strong></div>
<div class="object-label" id="moonLabel">Moon<strong>selected pass</strong></div>
</div>
<div class="control-dock">
<div class="inclination-control">
<div class="slider-head">
<label for="inclination">Orbital inclination</label>
<output id="inclinationValue" for="inclination">1.00°</output>
</div>
<div class="range-wrap">
<input
id="inclination"
type="range"
min="0"
max="10"
step="0.05"
value="1"
aria-label="Orbital inclination in degrees"
>
<div class="range-labels">
<span>0° / ecliptic</span>
<span>10° / high tilt</span>
</div>
</div>
</div>
<div class="presets" aria-label="Inclination presets">
<button class="preset" data-inclination="0">0°</button>
<button class="preset" data-inclination="0.5">0.5°</button>
<button class="preset active" data-inclination="1">1°</button>
<button class="preset" data-inclination="2.5">2.5°</button>
<button class="preset" data-inclination="6">6°</button>
</div>
<div class="view-buttons" aria-label="Camera controls">
<button class="icon-button" id="zoomOut" aria-label="Zoom out">−</button>
<button class="icon-button" id="zoomIn" aria-label="Zoom in">+</button>
<button class="icon-button" id="resetView" aria-label="Reset camera view" title="Reset view">↺</button>
</div>
</div>
</section>
<aside class="side-panel">
<section class="panel-section">
<div class="section-heading">
<h3>Selected pass</h3>
<span class="tiny-badge" id="selectedPassBadge">S02</span>
</div>
<div class="result-card" id="resultCard">
<div class="result-pass" id="resultPass">S02 / SOLAR LONGITUDE 030°</div>
<div class="result-state" id="resultState">SATISFIES</div>
<div class="result-copy" id="resultCopy">
The Moon–Sun center separation is within the sum of their apparent angular radii.
</div>
<div class="metric-grid">
<div class="metric">
<div class="metric-label">Center separation</div>
<div class="metric-value" id="separationValue">0.000°</div>
</div>
<div class="metric">
<div class="metric-label">Combined limit</div>
<div class="metric-value" id="limitValue">0.526°</div>
</div>
</div>
</div>
</section>
<section class="panel-section">
<div class="section-heading">
<h3>Synthetic pass set</h3>
<span class="tiny-badge">geometry only</span>
</div>
<div class="count-row">
<div class="count-number"><span id="passCount">6</span><small> / 12</small></div>
<div class="count-copy">
sample gates satisfy<br>the disk-overlap test
</div>
</div>
<div class="gate-layout">
<div class="gate" aria-label="Angular separation gauge">
<span class="gate-label" title="Exact alignment"></span>
<span class="gate-dot" id="gateDot"></span>
</div>
<div class="gate-legend">
<div><strong id="gateSeparation">0.000°</strong> separation</div>
<div>dashed ring = <strong id="gateLimit">0.526°</strong></div>
<div id="gateVerdict">inside threshold</div>
</div>
</div>
</section>
<section class="panel-section">
<div class="section-heading">
<h3>Fixed assumptions</h3>
</div>
<div class="constant-row">
<span>Sun angular radius</span>
<span>0.2666°</span>
</div>
<div class="constant-row">
<span>Moon angular radius</span>
<span>0.2590°</span>
</div>
<div class="constant-row">
<span>Combined limit</span>
<span>0.5256°</span>
</div>
<div class="constant-row">
<span>Orbit</span>
<span>circular</span>
</div>
<div class="constant-row">
<span>Ascending node</span>
<span>fixed at 000°</span>
</div>
<div class="constant-row">
<span>Samples</span>
<span>12 longitude gates</span>
</div>
</section>
<section class="panel-section">
<details>
<summary>What is being tested?</summary>
<p>
Every sample places the Sun and Moon at the same ecliptic longitude.
For a circular orbit with inclination <code>i</code>, the model computes
the Moon’s ecliptic latitude:
</p>
<p>
<code>β = asin(sin(i) · sin(u))</code><br>
<code>u = atan2(sin λ, cos λ / cos i)</code>
</p>
<p>
The center separation is <code>|β|</code>. The sample satisfies the
idealized geometric condition when
<code>|β| ≤ α☉ + α☾ = 0.5256°</code>.
</p>
</details>
<details style="margin-top:12px">
<summary>What this deliberately omits</summary>
<p>
No dates, eclipse seasons, Saros cycles, node regression, orbital
eccentricity, ΔT, topography, weather, or local circumstances are
modeled. The 12 passes are longitude samples, not predicted events.
</p>
</details>
</section>
</aside>
</main>
<section class="pass-section" aria-labelledby="passesHeading">
<div class="pass-heading">
<div>
<h2 id="passesHeading">Synthetic alignment passes</h2>
<p>Select a gate to inspect its geometry in the voxel scene.</p>
</div>
<div class="pass-legend" aria-label="Pass status legend">
<span class="legend-item"><span class="legend-swatch" style="background:var(--green)"></span>satisfies</span>
<span class="legend-item"><span class="legend-swatch" style="background:var(--amber)"></span>grazing</span>
<span class="legend-item"><span class="legend-swatch" style="background:var(--red)"></span>misses</span>
</div>
</div>
<div class="pass-list" id="passList"></div>
</section>
<footer class="warning-footer">
<span class="warning-icon" aria-hidden="true">!</span>
<div>
<strong>Not an eclipse prediction.</strong>
This is a synthetic geometric sampler with exaggerated visual distances and sizes.
Its count is a toy-model result and must not be interpreted as a real eclipse tally.
</div>
</footer>
</div>
<script type="module">
import * as THREE from "https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
const DEG = Math.PI / 180;
const SUN_ANGULAR_RADIUS = 0.2666;
const MOON_ANGULAR_RADIUS = 0.2590;
const COMBINED_LIMIT = SUN_ANGULAR_RADIUS + MOON_ANGULAR_RADIUS;
const ORBIT_RADIUS = 5.4;
const SUN_DISTANCE = 16;
const EARTH_RADIUS = 1.16;
const SUN_RADIUS = 1.7;
const MOON_RADIUS = 0.43;
const state = {
inclination: 1,
selectedPass: 1
};
const colors = {
cyan: new THREE.Color(0x72e1d4),
green: new THREE.Color(0x6be5ae),
amber: new THREE.Color(0xffc96b),
red: new THREE.Color(0xff7084),
muted: new THREE.Color(0x6f8993)
};
const passes = Array.from({ length: 12 }, (_, index) => ({
id: `S${String(index + 1).padStart(2, "0")}`,
index,
longitude: index * 30
}));
const elements = {
viewport: document.querySelector("#viewport"),
canvas: document.querySelector("#scene"),
inclination: document.querySelector("#inclination"),
inclinationValue: document.querySelector("#inclinationValue"),
passList: document.querySelector("#passList"),
selectedPassBadge: document.querySelector("#selectedPassBadge"),
resultCard: document.querySelector("#resultCard"),
resultPass: document.querySelector("#resultPass"),
resultState: document.querySelector("#resultState"),
resultCopy: document.querySelector("#resultCopy"),
separationValue: document.querySelector("#separationValue"),
limitValue: document.querySelector("#limitValue"),
passCount: document.querySelector("#passCount"),
gateDot: document.querySelector("#gateDot"),
gateSeparation: document.querySelector("#gateSeparation"),
gateLimit: document.querySelector("#gateLimit"),
gateVerdict: document.querySelector("#gateVerdict"),
sceneStatus: document.querySelector("#sceneStatus"),
sceneStatusText: document.querySelector("#sceneStatusText"),
sunLabel: document.querySelector("#sunLabel"),
earthLabel: document.querySelector("#earthLabel"),
moonLabel: document.querySelector("#moonLabel"),
zoomIn: document.querySelector("#zoomIn"),
zoomOut: document.querySelector("#zoomOut"),
resetView: document.querySelector("#resetView")
};
elements.limitValue.textContent = `${COMBINED_LIMIT.toFixed(3)}°`;
elements.gateLimit.textContent = `${COMBINED_LIMIT.toFixed(3)}°`;
function clamp(value, minimum, maximum) {
return Math.min(maximum, Math.max(minimum, value));
}
function evaluatePass(pass, inclinationDegrees) {
const inclination = inclinationDegrees * DEG;
const longitude = pass.longitude * DEG;
const cosineInclination = Math.cos(inclination);
// Exact longitude solution for the circular, node-fixed toy orbit.
const argument = Math.atan2(
Math.sin(longitude),
Math.cos(longitude) / cosineInclination
);
const sinArgument = Math.sin(argument);
const beta = Math.asin(clamp(sinArgument * Math.sin(inclination), -1, 1));
const signedSeparation = beta / DEG;
const separation = Math.abs(signedSeparation);
const ratio = separation / COMBINED_LIMIT;
const qualifies = separation <= COMBINED_LIMIT + 1e-9;
let accent = "bad";
if (qualifies && ratio > 0.82) accent = "warn";
else if (qualifies) accent = "good";
return {
...pass,
argument,
beta,
signedSeparation,
separation,
ratio,
qualifies,
accent
};
}
function formatSignedDegrees(value) {
if (Math.abs(value) < 0.00005) return "0.000°";
return `${value > 0 ? "+" : "−"}${Math.abs(value).toFixed(3)}°`;
}
const passElements = new Map();
for (const pass of passes) {
const button = document.createElement("button");
button.className = "pass-card";
button.type = "button";
button.dataset.passIndex = pass.index;
button.setAttribute("aria-pressed", "false");
button.innerHTML = `
<div class="pass-top">
<span class="pass-id">${pass.id}</span>
<span class="pass-badge">checking</span>
</div>
<div class="pass-lambda">λ ${String(pass.longitude).padStart(3, "0")}°</div>
<div class="pass-separation">0.000° separation</div>
`;
button.addEventListener("click", () => {
state.selectedPass = pass.index;
updateModel();
});
elements.passList.appendChild(button);
passElements.set(pass.index, {
button,
badge: button.querySelector(".pass-badge"),
separation: button.querySelector(".pass-separation")
});
}
// -------------------------------------------------------------------------
// Three.js scene
// -------------------------------------------------------------------------
const scene = new THREE.Scene();
scene.background = new THREE.Color(0x04070c);
const camera = new THREE.PerspectiveCamera(42, 1, 0.1, 180);
let renderer;
try {
renderer = new THREE.WebGLRenderer({
canvas: elements.canvas,
antialias: true,
alpha: false,
powerPreference: "high-performance"
});
} catch (error) {
elements.viewport.innerHTML = `
<div style="padding:30px;color:#ff7084;font-family:monospace">
WebGL could not be initialized. Please open this file in a browser with WebGL enabled.
</div>
`;
throw error;
}
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1.12;
const ambient = new THREE.HemisphereLight(0x91b9d3, 0x11111a, 1.65);
scene.add(ambient);
const pointLight = new THREE.PointLight(0xffd49c, 78, 55, 1.7);
scene.add(pointLight);
const rimLight = new THREE.DirectionalLight(0x5c8fff, 1.1);
rimLight.position.set(-8, 7, -10);
scene.add(rimLight);
function hash3(x, y, z) {
let h = Math.imul(x + 31, 374761393);
h ^= Math.imul(y + 47, 668265263);
h ^= Math.imul(z + 79, 2246822519);
h = Math.imul(h ^ (h >>> 13), 1274126177);
return ((h ^ (h >>> 16)) >>> 0) / 4294967295;
}
function createVoxelSphere(radius, cellSize, kind) {
const positions = [];
const colorsForInstances = [];
const limit = Math.ceil(radius / cellSize);
const earthTexture =
Math.sin((1.7 + 3.1 * hash3(limit, 2, 4)) * 2.7) +
Math.cos((1.4 + 2.9 * hash3(limit, 5, 1)) * 3.4) +
Math.sin((1.2 + 3.7 * hash3(limit, 7, 6)) * 1.9);
for (let x = -limit; x <= limit; x++) {
for (let y = -limit; y <= limit; y++) {
for (let z = -limit; z <= limit; z++) {
const px = x * cellSize;
const py = y * cellSize;
const pz = z * cellSize;
const distance = Math.hypot(px, py, pz);
if (distance > radius - cellSize * 0.18) continue;
if (distance < radius - cellSize * 1.65) continue;
const random = hash3(x, y, z);
positions.push(px, py, pz);
let color;
if (kind === "earth") {
const polar = Math.abs(py) > radius * 0.64;
const land = earthTexture > 0.45 && !polar;
if (polar) {
color = new THREE.Color(0xc9d9d8);
} else if (land) {
color = new THREE.Color().setHSL(
0.28 + random * 0.08,
0.30 + random * 0.13,
0.25 + random * 0.10
);
} else {
color = new THREE.Color().setHSL(
0.54 + random * 0.025,
0.52 + random * 0.16,
0.20 + random * 0.12
);
}
} else if (kind === "sun") {
color = new THREE.Color().setHSL(
0.075 + random * 0.035,
0.82,
0.46 + random * 0.16
);
} else {
color = new THREE.Color().setHSL(
0.57,
0.05 + random * 0.05,
0.43 + random * 0.18
);
}
colorsForInstances.push(color.r, color.g, color.b);
}
}
}
const geometry = new THREE.BoxGeometry(cellSize * 0.88, cellSize * 0.88, cellSize * 0.88);
const material = new THREE.MeshStandardMaterial({
roughness: kind === "sun" ? 0.62 : 0.88,
metalness: kind === "sun" ? 0.04 : 0.01,
vertexColors: true
});
const mesh = new THREE.InstancedMesh(geometry, material, positions.length / 3);
const matrix = new THREE.Matrix4();
for (let i = 0; i < positions.length / 3; i++) {
matrix.makeTranslation(positions[i * 3], positions[i * 3 + 1], positions[i * 3 + 2]);
mesh.setMatrixAt(i, matrix);
mesh.setColorAt(
i,
new THREE.Color(
colorsForInstances[i * 3],
colorsForInstances[i * 3 + 1],
colorsForInstances[i * 3 + 2]
)
);
}
mesh.instanceMatrix.needsUpdate = true;
if (mesh.instanceColor) mesh.instanceColor.needsUpdate = true;
return mesh;
}
const earth = new THREE.Group();
earth.rotation.z = 0.18;
earth.add(createVoxelSphere(EARTH_RADIUS, 0.145, "earth"));
const atmosphere = new THREE.Mesh(
new THREE.SphereGeometry(EARTH_RADIUS * 1.11, 32, 20),
new THREE.MeshBasicMaterial({
color: 0x58a9ff,
transparent: true,
opacity: 0.075,
side: THREE.BackSide,
blending: THREE.AdditiveBlending,
depthWrite: false
})
);
earth.add(atmosphere);
scene.add(earth);
const sun = new THREE.Group();
sun.add(createVoxelSphere(SUN_RADIUS, 0.19, "sun"));
const sunGlow = new THREE.Mesh(
new THREE.SphereGeometry(SUN_RADIUS * 1.25, 28, 18),
new THREE.MeshBasicMaterial({
color: 0xffa544,
transparent: true,
opacity: 0.095,
side: THREE.BackSide,
blending: THREE.AdditiveBlending,
depthWrite: false
})
);
sun.add(sunGlow);
scene.add(sun);
const moon = new THREE.Group();
moon.add(createVoxelSphere(MOON_RADIUS, 0.103, "moon"));
const moonHaloMaterial = new THREE.MeshBasicMaterial({
color: colors.green,
transparent: true,
opacity: 0.13,
side: THREE.BackSide,
blending: THREE.AdditiveBlending,
depthWrite: false
});
const moonHalo = new THREE.Mesh(
new THREE.SphereGeometry(MOON_RADIUS * 1.4, 24, 16),
moonHaloMaterial
);
moon.add(moonHalo);
scene.add(moon);
// Ecliptic reference plane.
const grid = new THREE.GridHelper(42, 42, 0x24505b, 0x102630);
grid.position.y = -1.48;
grid.material.transparent = true;
grid.material.opacity = 0.26;
grid.material.depthWrite = false;
scene.add(grid);
const eclipticRing = new THREE.Mesh(
new THREE.RingGeometry(7.93, 8, 160),
new THREE.MeshBasicMaterial({
color: 0x315966,
transparent: true,
opacity: 0.32,
side: THREE.DoubleSide,
depthWrite: false
})
);
eclipticRing.rotation.x = -Math.PI / 2;
scene.add(eclipticRing);
// Inclined lunar orbit.
const orbitSegments = 240;
const orbitPositions = new Float32Array(orbitSegments * 3);
const orbitGeometry = new THREE.BufferGeometry();
orbitGeometry.setAttribute("position", new THREE.BufferAttribute(orbitPositions, 3));
const orbitLine = new THREE.LineLoop(
orbitGeometry,
new THREE.LineBasicMaterial({
color: 0x64d8d0,
transparent: true,
opacity: 0.64
})
);
scene.add(orbitLine);
const nodeMaterial = new THREE.MeshBasicMaterial({ color: 0xffc96b });
const ascendingNode = new THREE.Mesh(new THREE.BoxGeometry(0.15, 0.15, 0.15), nodeMaterial);
const descendingNode = new THREE.Mesh(new THREE.BoxGeometry(0.15, 0.15, 0.15), nodeMaterial);
ascendingNode.position.set(ORBIT_RADIUS, 0, 0);
descendingNode.position.set(-ORBIT_RADIUS, 0, 0);
scene.add(ascendingNode, descendingNode);
// Lines from Earth show the two directions whose separation is being tested.
const unitCylinder = new THREE.CylinderGeometry(1, 1, 1, 8, 1, true);
const sunDirectionLine = new THREE.Mesh(
unitCylinder,
new THREE.MeshBasicMaterial({
color: 0xffd092,
transparent: true,
opacity: 0.28,
depthWrite: false
})
);
const moonDirectionLine = new THREE.Mesh(
unitCylinder,
new THREE.MeshBasicMaterial({
color: colors.green,
transparent: true,
opacity: 0.88,
depthWrite: false
})
);
scene.add(sunDirectionLine, moonDirectionLine);
// Background stars.
let seed = 481516;
function random() {
seed = (Math.imul(seed, 1664525) + 1013904223) >>> 0;
return seed / 4294967296;
}
const starCount = 720;
const starPositions = new Float32Array(starCount * 3);
const starColors = new Float32Array(starCount * 3);
for (let i = 0; i < starCount; i++) {
const radius = 38 + random() * 45;
const theta = random() * Math.PI * 2;
const phi = Math.acos(2 * random() - 1);
starPositions[i * 3] = radius * Math.sin(phi) * Math.cos(theta);
starPositions[i * 3 + 1] = radius * Math.cos(phi);
starPositions[i * 3 + 2] = radius * Math.sin(phi) * Math.sin(theta);
const tint = 0.62 + random() * 0.32;
starColors[i * 3] = tint * 0.86;
starColors[i * 3 + 1] = tint * 0.94;
starColors[i * 3 + 2] = tint;
}
const starGeometry = new THREE.BufferGeometry();
starGeometry.setAttribute("position", new THREE.BufferAttribute(starPositions, 3));
starGeometry.setAttribute("color", new THREE.BufferAttribute(starColors, 3));
const stars = new THREE.Points(
starGeometry,
new THREE.PointsMaterial({
size: 0.075,
vertexColors: true,
transparent: true,
opacity: 0.82,
sizeAttenuation: true,
depthWrite: false
})
);
scene.add(stars);
// -------------------------------------------------------------------------
// Custom camera controls — no addons.
// -------------------------------------------------------------------------
const cameraState = {
yaw: 0.68,
pitch: 0.31,
radius: 27,
target: new THREE.Vector3(0, 0, 0),
dragging: false,
lastX: 0,
lastY: 0
};
function updateCamera() {
const horizontal = cameraState.radius * Math.cos(cameraState.pitch);
camera.position.set(
cameraState.target.x + horizontal * Math.sin(cameraState.yaw),
cameraState.target.y + cameraState.radius * Math.sin(cameraState.pitch),
cameraState.target.z + horizontal * Math.cos(cameraState.yaw)
);
camera.lookAt(cameraState.target);
}
function resetCamera() {
cameraState.yaw = 0.68;
cameraState.pitch = 0.31;
cameraState.radius = 27;
updateCamera();
}
elements.canvas.addEventListener("pointerdown", event => {
cameraState.dragging = true;
cameraState.lastX = event.clientX;
cameraState.lastY = event.clientY;
elements.canvas.setPointerCapture(event.pointerId);
});
elements.canvas.addEventListener("pointermove", event => {
if (!cameraState.dragging) return;
const deltaX = event.clientX - cameraState.lastX;
const deltaY = event.clientY - cameraState.lastY;
cameraState.lastX = event.clientX;
cameraState.lastY = event.clientY;
cameraState.yaw -= deltaX * 0.006;
cameraState.pitch = clamp(cameraState.pitch + deltaY * 0.005, -1.25, 1.25);
updateCamera();
});
function endCameraDrag(event) {
cameraState.dragging = false;
if (event.pointerId !== undefined && elements.canvas.hasPointerCapture(event.pointerId)) {
elements.canvas.releasePointerCapture(event.pointerId);
}
}
elements.canvas.addEventListener("pointerup", endCameraDrag);
elements.canvas.addEventListener("pointercancel", endCameraDrag);
elements.canvas.addEventListener(
"wheel",
event => {
event.preventDefault();
cameraState.radius = clamp(
cameraState.radius * Math.exp(event.deltaY * 0.001),
12,
45
);
updateCamera();
},
{ passive: false }
);
elements.canvas.addEventListener("dblclick", resetCamera);
elements.zoomIn.addEventListener("click", () => {
cameraState.radius = clamp(cameraState.radius - 2, 12, 45);
updateCamera();
});
elements.zoomOut.addEventListener("click", () => {
cameraState.radius = clamp(cameraState.radius + 2, 12, 45);
updateCamera();
});
elements.resetView.addEventListener("click", resetCamera);
const resizeObserver = new ResizeObserver(() => {
const width = elements.viewport.clientWidth;
const height = elements.viewport.clientHeight;
renderer.setSize(width, height, false);
camera.aspect = width / Math.max(1, height);
camera.updateProjectionMatrix();
});
resizeObserver.observe(elements.viewport);
updateCamera();
// -------------------------------------------------------------------------
// Model and scene updates
// -------------------------------------------------------------------------
const yAxis = new THREE.Vector3(0, 1, 0);
const origin = new THREE.Vector3(0, 0, 0);
function eclipticToWorld(x, y, z) {
// Ecliptic X/Y lie in the horizontal X/Z plane; ecliptic Z becomes world Y.
return new THREE.Vector3(x, z, y);
}
function setCylinderBetween(mesh, start, end) {
const direction = end.clone().sub(start);
const length = direction.length();
mesh.position.copy(start).add(end).multiplyScalar(0.5);
mesh.quaternion.setFromUnitVectors(yAxis, direction.normalize());
mesh.scale.set(1, length, 1);
}
function updateOrbit(inclinationDegrees) {
const inclination = inclinationDegrees * DEG;
for (let i = 0; i < orbitSegments; i++) {
const argument = (i / orbitSegments) * Math.PI * 2;
const position = eclipticToWorld(
ORBIT_RADIUS * Math.cos(argument),
ORBIT_RADIUS * Math.sin(argument) * Math.cos(inclination),
ORBIT_RADIUS * Math.sin(argument) * Math.sin(inclination)
);
orbitPositions[i * 3] = position.x;
orbitPositions[i * 3 + 1] = position.y;
orbitPositions[i * 3 + 2] = position.z;
}
orbitGeometry.attributes.position.needsUpdate = true;
orbitGeometry.computeBoundingSphere();
}
function updateModel() {
const inclination = state.inclination;
const results = passes.map(pass => evaluatePass(pass, inclination));
const selected = results[state.selectedPass];
const satisfying = results.filter(result => result.qualifies);
const nearest = results.reduce((best, result) =>
result.separation < best.separation ? result : best
);
elements.inclination.value = inclination.toFixed(2);
elements.inclinationValue.textContent = `${inclination.toFixed(2)}°`;
elements.inclination.style.setProperty(
"--fill",
`${(inclination / 10) * 100}%`
);
document.querySelectorAll(".preset").forEach(button => {
button.classList.toggle(
"active",
Math.abs(Number(button.dataset.inclination) - inclination) < 0.001
);
});
for (const result of results) {
const entry = passElements.get(result.index);
entry.badge.className = `pass-badge ${result.accent}`;
entry.badge.textContent = result.accent === "warn"
? "grazing"
: result.qualifies
? "satisfies"
: "misses";
entry.separation.textContent = `${result.separation.toFixed(3)}° separation`;
entry.button.classList.toggle("selected", result.index === state.selectedPass);
entry.button.setAttribute("aria-pressed", String(result.index === state.selectedPass));
}
elements.selectedPassBadge.textContent = selected.id;
elements.resultPass.textContent =
`${selected.id} / SOLAR LONGITUDE ${String(selected.longitude).padStart(3, "0")}°`;
elements.resultCard.className = `result-card ${selected.accent}`;
elements.resultState.textContent = selected.qualifies
? selected.accent === "warn" ? "SATISFIES / GRAZING" : "SATISFIES"
: "MISSES";
const signedMargin = COMBINED_LIMIT - selected.separation;
if (selected.qualifies) {
elements.resultCopy.textContent =
`The apparent disks overlap in this model, leaving ${signedMargin.toFixed(3)}° of angular room.`;
} else {
elements.resultCopy.textContent =
`The apparent disks remain separated, exceeding the combined radius limit by ${Math.abs(signedMargin).toFixed(3)}°.`;
}
elements.separationValue.textContent = `${selected.separation.toFixed(3)}°`;
elements.passCount.textContent = satisfying.length;
elements.gateSeparation.textContent = `${selected.separation.toFixed(3)}°`;
const accentColor = { good: colors.green, warn: colors.amber, bad: colors.red }[selected.accent];
const gateRatio = selected.signedSeparation / COMBINED_LIMIT;
const gateOffset = clamp(gateRatio, -1.45, 1.45) * 43;
elements.gateDot.style.top = `calc(50% - ${gateOffset}px)`;
elements.gateDot.style.background = `#${accentColor.getHexString()}`;
elements.gateDot.style.color = `#${accentColor.getHexString()}`;
elements.gateVerdict.textContent = selected.qualifies
? selected.accent === "warn" ? "inside, near the edge" : "inside threshold"
: "outside threshold";
elements.gateVerdict.style.color = `#${accentColor.getHexString()}`;
elements.sceneStatusText.textContent =
`${selected.id} / ${selected.qualifies ? "SATISFIES" : "MISSES"} / ${selected.separation.toFixed(3)}°`;
elements.sceneStatus.querySelector(".status-dot").style.background =
`#${accentColor.getHexString()}`;
// Scene geometry.
const sunLongitude = selected.longitude * DEG;
const sunPosition = eclipticToWorld(
Math.cos(sunLongitude) * SUN_DISTANCE,
Math.sin(sunLongitude) * SUN_DISTANCE,
0
);
const moonEcliptic = eclipticToWorld(
ORBIT_RADIUS * Math.cos(selected.argument),
ORBIT_RADIUS * Math.sin(selected.argument) * Math.cos(inclination * DEG),
ORBIT_RADIUS * Math.sin(selected.argument) * Math.sin(inclination * DEG)
);
sun.position.copy(sunPosition);
moon.position.copy(moonEcliptic);
pointLight.position.copy(sunPosition);
moonHaloMaterial.color.copy(accentColor);
setCylinderBetween(sunDirectionLine, origin, sunPosition);
setCylinderBetween(moonDirectionLine, origin, moonEcliptic);
moonDirectionLine.material.color.copy(accentColor);
updateOrbit(inclination);
elements.moonLabel.querySelector("strong").textContent =
`${selected.id} / ${selected.separation.toFixed(3)}°`;
// Keep the nearest-pass statistic available in the UI without introducing
// an additional model variable.
elements.sceneStatus.title =
`Nearest synthetic pass: ${nearest.id} at ${nearest.separation.toFixed(3)}° separation.`;
}
elements.inclination.addEventListener("input", event => {
state.inclination = Number(event.target.value);
updateModel();
});
document.querySelectorAll(".preset").forEach(button => {
button.addEventListener("click", () => {
state.inclination = Number(button.dataset.inclination);
updateModel();
});
});
// Project DOM labels into the rendered scene.
const projected = new THREE.Vector3();
function placeLabel(element, worldPosition) {
projected.copy(worldPosition).project(camera);
const visible = projected.z > -1 && projected.z < 1;
element.style.display = visible ? "block" : "none";
if (!visible) return;
const width = elements.viewport.clientWidth;
const height = elements.viewport.clientHeight;
const x = (projected.x * 0.5 + 0.5) * width;
const y = (-projected.y * 0.5 + 0.5) * height;
element.style.left = `${x}px`;
element.style.top = `${y}px`;
}
function updateLabels() {
placeLabel(elements.sunLabel, sun.position.clone().add(new THREE.Vector3(0, 2.25, 0)));
placeLabel(elements.earthLabel, new THREE.Vector3(0, EARTH_RADIUS + 0.55, 0));
placeLabel(elements.moonLabel, moon.position.clone().add(new THREE.Vector3(0, 0.78, 0)));
}
updateModel();
const reducedMotion = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
const startTime = performance.now();
function animate(now) {
requestAnimationFrame(animate);
if (!reducedMotion) {
earth.rotation.y = (now - startTime) * 0.000055;
sun.rotation.y = -(now - startTime) * 0.000035;
moon.rotation.y = (now - startTime) * 0.00011;
stars.rotation.y = (now - startTime) * 0.000004;
}
updateLabels();
renderer.render(scene, camera);
}
requestAnimationFrame(animate);
</script>
</body>
</html>
```