diff --git a/.gitattributes b/.gitattributes index a6344aac8c09253b3b630fb776ae94478aa0275b..2e51565abff82c59fb65434db8d872002910fb53 100644 --- a/.gitattributes +++ b/.gitattributes @@ -33,3 +33,24 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text *.zip filter=lfs diff=lfs merge=lfs -text *.zst filter=lfs diff=lfs merge=lfs -text *tfevents* filter=lfs diff=lfs merge=lfs -text +models/cassini.glb filter=lfs diff=lfs merge=lfs -text +models/clipper.glb filter=lfs diff=lfs merge=lfs -text +models/galileo.glb filter=lfs diff=lfs merge=lfs -text +models/hubble.glb filter=lfs diff=lfs merge=lfs -text +models/hubbleB.glb filter=lfs diff=lfs merge=lfs -text +models/juice.glb filter=lfs diff=lfs merge=lfs -text +models/juno.glb filter=lfs diff=lfs merge=lfs -text +models/jwst.glb filter=lfs diff=lfs merge=lfs -text +models/jwstB.glb filter=lfs diff=lfs merge=lfs -text +models/voyager.glb filter=lfs diff=lfs merge=lfs -text +models/voyagerA.glb filter=lfs diff=lfs merge=lfs -text +textures/dione.jpg filter=lfs diff=lfs merge=lfs -text +textures/earth_clouds.jpg filter=lfs diff=lfs merge=lfs -text +textures/earth.jpg filter=lfs diff=lfs merge=lfs -text +textures/ganymede.jpg filter=lfs diff=lfs merge=lfs -text +textures/jupiter.jpg filter=lfs diff=lfs merge=lfs -text +textures/mimas.jpg filter=lfs diff=lfs merge=lfs -text +textures/moon.jpg filter=lfs diff=lfs merge=lfs -text +textures/rhea.jpg filter=lfs diff=lfs merge=lfs -text +textures/tethys.jpg filter=lfs diff=lfs merge=lfs -text +textures/titan.jpg filter=lfs diff=lfs merge=lfs -text diff --git a/README.md b/README.md index dab5d9f3ea63c427d1e43a3681ee4548834455a6..6e811a72b166d280dcd3e272d081f53d6ca74247 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,69 @@ --- -title: MOP Tutorial -emoji: 🐠 -colorFrom: red -colorTo: pink +title: Magnetospheres of the Outer Planets +emoji: 🪐 +colorFrom: indigo +colorTo: purple sdk: static +app_file: index.html pinned: false +short_description: Interactive 3D guide to giant-planet magnetospheres & aurora --- -Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference +# Magnetospheres of the Outer Planets · 3D Explorer + +An interactive public-outreach website, inspired by the [MOP 2028 conference](https://www.lsr.hku.hk/MOP/index.html) (Hong Kong, 10–14 January 2028), that explains the magnetospheres and aurora of Jupiter, Saturn, Uranus and Neptune to high-school students and the public. + +Languages: English, 简体中文, 繁體中文 (switch in the top-right corner; the choice is remembered). + +## Features + +- **3D explorer** (three.js): planets with procedural surfaces, dipole field lines that are compressed by the solar wind and stretched into a magnetotail, magnetopause and bow shock, flowing solar-wind particles, the Io and Enceladus plasma tori, moons with flux tubes and auroral footprints, and layered aurora ovals. Uranus and Neptune use tilted, offset dipoles, so their magnetospheres wobble as they spin. +- **Guided tour** in six steps (dynamo → solar wind → boundaries → moon plasma → aurora → ice giants). +- **Real textures** for the planets, Saturn's rings, Earth's clouds and the Milky Way background. +- **Moons**: 18 moons with mission mosaics (Earth's Moon; Io, Europa, Ganymede, Callisto; Mimas, Enceladus, Tethys, Dione, Rhea, Titan, Iapetus; Miranda, Ariel, Umbriel, Titania, Oberon; Triton). Click a moon in 3D, or use the Moons section, to fly to it and read about its role in the magnetosphere. +- **Spacecraft**: 3D models of Voyager 2, Galileo, Cassini–Huygens, Juno, Hubble, JWST, JUICE and Europa Clipper, grouped by the 8 MOP 2028 conference themes. Tap the numbered markers to learn what each instrument does; each craft also lists its main discoveries. +- **Aurora gallery**: animated polar views of the aurora on Earth, Jupiter, Saturn, Uranus and Neptune, drawn over the planet textures. +- **Size comparison**, **why study it**, **missions timeline** and a short **quiz**. + +## Files + +``` +index.html page structure +css/style.css styles +js/main.js UI, language switching, tour, quiz +js/scene.js three.js scene +js/aurora2d.js 2D aurora animations +js/i18n.js all text in three languages +js/i18n_moons.js moon text in three languages +js/i18n_craft.js spacecraft, instruments and MOP themes in three languages +js/models.js procedural spacecraft models +js/craft.js spacecraft viewer +textures/ planet, ring, cloud, sky and moon textures (~2.9 MB) +``` + +No build step. three.js r160 is loaded from the jsDelivr CDN through an import map. + +## Deploy to Hugging Face + +1. Create a new Space and choose **Static** as the SDK. +2. Upload all files (keep this `README.md`, its header configures the Space), or push with git: + +```bash +git remote add space https://huggingface.co/spaces// +git push space main +``` + +## Run locally + +```bash +python -m http.server 8000 +# open http://localhost:8000 +``` + +Opening `index.html` directly from disk does not work because browsers block ES modules on `file://`. + +## Notes + +The visualisation is simplified and not to scale. Aurora colours on the giant planets are false colour, because their aurora shine mainly in ultraviolet and infrared. Facts come from NASA, ESA, the MOP 2028 conference site and published research. + +Texture credits: planet, Moon, ring, cloud and Milky Way textures are from Solar System Scope (CC BY 4.0), based on NASA imagery. Moon mosaics are NASA/JPL/USGS (Galileo, Cassini, Voyager 2) via NOAA Science On a Sphere. All were taken from the AK51/SatelliteMap Space. diff --git a/_pick.html b/_pick.html new file mode 100644 index 0000000000000000000000000000000000000000..e4a5c3564464b59b181bbacf30e588031c85d1f4 --- /dev/null +++ b/_pick.html @@ -0,0 +1,58 @@ + + + + + +
+ diff --git a/_prev.html b/_prev.html new file mode 100644 index 0000000000000000000000000000000000000000..24a821594f274928e72bc58c3dda084ddfb35978 --- /dev/null +++ b/_prev.html @@ -0,0 +1,46 @@ + + + + + + diff --git a/css/style.css b/css/style.css new file mode 100644 index 0000000000000000000000000000000000000000..7ae250386a9b55fa0f5a514e392dcaf1408cde8f --- /dev/null +++ b/css/style.css @@ -0,0 +1,342 @@ +:root { + --bg: #03040c; + --bg2: #0a0d1f; + --panel: rgba(10, 14, 34, 0.72); + --line: rgba(140, 170, 255, 0.18); + --text: #e8ecff; + --muted: #a8b1d6; + --accent: #8f7bff; + --accent2: #39d6ff; + --aurora: #6bffb0; + --radius: 14px; + --font: "Inter", "Segoe UI", system-ui, -apple-system, "PingFang SC", "PingFang TC", "Microsoft YaHei", "Microsoft JhengHei", "Noto Sans SC", "Noto Sans TC", sans-serif; +} +* { box-sizing: border-box; } +html { scroll-behavior: smooth; } +body { margin: 0; overflow-x: hidden; background: var(--bg); color: var(--text); font-family: var(--font); line-height: 1.6; } +a { color: var(--accent2); } +h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; } +button { font-family: inherit; } + +/* ------------------------------------------------------------ top bar */ +.topbar { + position: fixed; inset: 0 0 auto 0; z-index: 50; height: 58px; + display: flex; align-items: center; gap: 18px; padding: 0 18px; + background: linear-gradient(to bottom, rgba(3,4,12,.85), rgba(3,4,12,.45)); + backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); +} +.brand { display: flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; font-weight: 700; letter-spacing: .02em; white-space: nowrap; } +.brand-icon { font-size: 1.3em; } +.nav { display: flex; gap: 4px; margin-left: auto; flex-wrap: nowrap; } +.nav a { color: var(--muted); text-decoration: none; padding: 6px 10px; border-radius: 8px; font-size: .92rem; white-space: nowrap; } +.nav a:hover { color: var(--text); background: rgba(255,255,255,.06); } +.lang { display: flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; } +.lang button { background: transparent; color: var(--muted); border: 0; padding: 6px 12px; cursor: pointer; font-size: .9rem; } +.lang button.active { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; } +.menu-btn { display: none; background: none; border: 1px solid var(--line); color: var(--text); border-radius: 8px; font-size: 1.1rem; padding: 4px 10px; cursor: pointer; } + +/* ------------------------------------------------------------- viewer */ +.viewer { position: relative; height: 100vh; min-height: 560px; max-height: 1200px; overflow: hidden; background: #02030a; } +.stage { position: absolute; inset: 0; z-index: 0; overflow: hidden; } +.stage canvas { display: block; width: 100% !important; height: 100% !important; } +.label-layer { position: absolute; inset: 0; pointer-events: none; } +.scene-label { + font-size: 12px; color: #dfe6ff; padding: 2px 7px; border-radius: 6px; white-space: nowrap; + background: rgba(5, 8, 25, .55); border: 1px solid rgba(160,190,255,.25); text-shadow: 0 0 6px #000; +} +.scene-label.mp { color: #8fd8ff; border-color: rgba(80,180,255,.5); } +.scene-label.bs { color: #ffbd8a; border-color: rgba(255,150,80,.5); } +.scene-label.wind { color: #ffe9a8; border-color: rgba(255,220,120,.4); } +.scene-label.tail { color: #b8c4ff; } +.scene-label.torus { color: #ffb58a; } +.scene-label.moon { font-size: 11px; background: rgba(5,8,25,.35); } + +.hero { + position: absolute; left: 0; top: 0; bottom: 0; width: min(620px, 100%); + display: flex; flex-direction: column; justify-content: center; padding: 90px 48px 48px; + background: linear-gradient(90deg, rgba(3,4,12,.88) 0%, rgba(3,4,12,.55) 70%, rgba(3,4,12,0) 100%); + transition: opacity .6s, transform .6s; z-index: 5; +} +.kicker { color: var(--aurora); text-transform: uppercase; letter-spacing: .12em; font-size: .8rem; font-weight: 600; margin: 0 0 12px; } +.hero h1 { + font-size: clamp(2.2rem, 5vw, 3.8rem); font-weight: 800; margin-bottom: .35em; + background: linear-gradient(120deg, #fff 10%, #b9a8ff 45%, #5ff2c2 90%); -webkit-background-clip: text; background-clip: text; color: transparent; +} +.hero-sub { font-size: 1.1rem; color: #cfd6f5; max-width: 520px; } +.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin: 22px 0 14px; } +.hint { color: var(--muted); font-size: .85rem; } +body.exploring .hero { opacity: 0; transform: translateX(-40px); pointer-events: none; } + +.btn { + display: inline-flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer; text-decoration: none; + border-radius: 999px; padding: 11px 22px; font-weight: 600; font-size: 1rem; border: 1px solid transparent; color: #fff; +} +.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent2)); box-shadow: 0 6px 24px rgba(120, 110, 255, .35); } +.btn.primary:hover { filter: brightness(1.12); } +.btn.ghost { background: rgba(255,255,255,.04); border-color: var(--line); color: var(--text); } +.btn.ghost:hover { background: rgba(255,255,255,.1); } +.btn.small { padding: 7px 14px; font-size: .88rem; } +.btn:disabled { opacity: .4; cursor: default; } + +.ui { position: absolute; inset: 0; pointer-events: none; z-index: 4; } +.ui > * { pointer-events: auto; } +.ui .panel, .ui .planet-tabs { opacity: 0; transition: opacity .6s; pointer-events: none; } +body.exploring .ui .panel, body.exploring .ui .planet-tabs { opacity: 1; pointer-events: auto; } + +.planet-tabs { + position: absolute; top: 72px; left: 50%; transform: translateX(-50%); + display: flex; gap: 6px; padding: 6px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); backdrop-filter: blur(10px); +} +.planet-tabs button { background: transparent; color: var(--muted); border: 0; padding: 8px 16px; border-radius: 999px; cursor: pointer; font-size: .95rem; font-weight: 600; } +.planet-tabs button:hover { color: var(--text); } +.planet-tabs button.active { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; } + +.panel { + position: absolute; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); + backdrop-filter: blur(12px); padding: 16px 18px; font-size: .9rem; +} +.panel h3 { font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 14px 0 8px; } +.panel h3:first-child { margin-top: 0; } +.panel.left { top: 130px; left: 16px; width: 250px; max-height: calc(100% - 150px); overflow: auto; } +.panel.right { top: 130px; right: 16px; width: 330px; max-height: calc(100% - 150px); overflow: auto; } +.panel label { display: flex; align-items: center; gap: 8px; padding: 3px 0; cursor: pointer; user-select: none; } +.panel input[type=checkbox] { accent-color: var(--accent); width: 16px; height: 16px; } +.sw { width: 18px; height: 4px; border-radius: 2px; flex: none; } +.sw-field { background: #7fb6ff; } .sw-wind { background: #ffe39a; } .sw-mp { background: linear-gradient(90deg, #4fb5ff, #ff9a50); } +.sw-aurora { background: linear-gradient(90deg, #5fffa0, #c27bff); } .sw-torus { background: #ff8a4a; } .sw-moons { background: #ffd25a; } .sw-labels { background: #ccc; } +.panel input[type=range] { width: 100%; accent-color: var(--accent2); } +.views { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 12px; } +.views button { background: rgba(255,255,255,.05); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 7px 6px; cursor: pointer; font-size: .8rem; } +.views button:hover { background: rgba(255,255,255,.12); } +.panel .note { color: var(--muted); font-size: .78rem; margin: 12px 0 0; } +.panel .tag { color: var(--aurora); font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; margin: 0 0 4px; } +.panel.right h2 { font-size: 1.7rem; margin-bottom: .3em; } +.panel.right p { color: #d4dbf7; margin: 0 0 6px; } +.panel dl { margin: 0; display: grid; gap: 2px 0; } +.panel dt { color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; margin-top: 8px; } +.panel dd { margin: 0; } + +.tour { + position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%); width: min(660px, 94vw); + background: rgba(10, 12, 32, .86); border: 1px solid rgba(160, 140, 255, .45); border-radius: var(--radius); + padding: 16px 20px; backdrop-filter: blur(12px); box-shadow: 0 10px 40px rgba(0,0,0,.5); +} +.tour[hidden] { display: none; } +.tour-step { color: var(--aurora); font-size: .78rem; text-transform: uppercase; letter-spacing: .12em; } +.tour h3 { font-size: 1.25rem; margin: 4px 0 6px; } +.tour p { margin: 0 0 12px; color: #d6dcf6; font-size: .95rem; } +.tour-actions { display: flex; gap: 8px; justify-content: flex-end; } +body.touring .panel.right { opacity: .0; pointer-events: none; } + +.noscript { color: var(--muted); padding: 120px 24px; text-align: center; } + +/* ---------------------------------------------------------- sections */ +.section { padding: 90px max(5vw, 20px); max-width: 1280px; margin: 0 auto; } +.section.dark { max-width: none; background: radial-gradient(1200px 500px at 50% 0%, rgba(110, 80, 255, .12), transparent), var(--bg2); } +.section.dark > * { max-width: 1280px; margin-left: auto; margin-right: auto; } +.section h2 { font-size: clamp(1.7rem, 3.4vw, 2.5rem); } +.lead { color: var(--muted); max-width: 820px; font-size: 1.05rem; margin-bottom: 36px; } +.section h3 { font-size: 1.15rem; } + +.steps { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; } +.step-card { + background: linear-gradient(180deg, rgba(255,255,255,.045), rgba(255,255,255,.015)); border: 1px solid var(--line); + border-radius: var(--radius); padding: 22px; display: flex; flex-direction: column; +} +.step-card p { color: #c9d1f2; flex: 1; } +.step-card .btn { align-self: flex-start; } +.step-num { display: flex; align-items: center; gap: 10px; font-size: 1.8rem; margin-bottom: 8px; } +.step-num span { font-size: .85rem; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 1px 9px; } + +.aurora-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 20px; } +.au-card { margin: 0; background: rgba(255,255,255,.03); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; } +.au-canvas { position: relative; aspect-ratio: 1; background: #02030a; } +.au-canvas canvas { width: 100%; height: 100%; display: block; } +.badge { position: absolute; top: 10px; right: 10px; font-size: .72rem; padding: 3px 9px; border-radius: 999px; background: rgba(150, 110, 255, .25); border: 1px solid rgba(170, 140, 255, .5); color: #e5dcff; } +.badge.vis { background: rgba(80, 255, 160, .15); border-color: rgba(80, 255, 160, .5); color: #c9ffe2; } +.au-card figcaption { padding: 16px 18px 20px; } +.au-card figcaption p { color: #c9d1f2; margin: 0; font-size: .95rem; } +.info-card { padding: 22px; justify-content: flex-start; } +.info-card p { color: #c9d1f2; } +.spectrum { display: flex; height: 26px; border-radius: 8px; overflow: hidden; margin: 6px 0 22px; font-size: .75rem; font-weight: 700; } +.spectrum span { display: flex; align-items: center; justify-content: center; } +.spectrum .uv { width: 25%; background: linear-gradient(90deg, #1b0b3a, #5a2bd9); color: #e6dcff; } +.spectrum .vis-band { flex: 1; background: linear-gradient(90deg, #7b2cff, #2b6bff, #20d0ff, #2fff8c, #f8ff3a, #ff9a2a, #ff2a2a); } +.spectrum .ir { width: 25%; background: linear-gradient(90deg, #8a0f0f, #2a0606); color: #ffd0d0; } + +.bars { display: grid; gap: 12px; margin-bottom: 26px; } +.bar-row { display: grid; grid-template-columns: 140px 1fr 160px; align-items: center; gap: 14px; } +.bar-name { font-weight: 600; } +.bar-track { height: 18px; background: rgba(255,255,255,.04); border-radius: 999px; overflow: hidden; border: 1px solid var(--line); } +.bar { height: 100%; width: 0; background: linear-gradient(90deg, color-mix(in srgb, var(--c) 40%, transparent), var(--c)); border-radius: 999px; transition: width 1.6s cubic-bezier(.2,.7,.2,1); box-shadow: 0 0 14px var(--c); } +.bars.grow .bar { width: var(--w); } +.bar-row.sun .bar { background: repeating-linear-gradient(90deg, var(--c) 0 10px, rgba(255,204,85,.5) 10px 16px); } +.bar-val { color: var(--muted); font-variant-numeric: tabular-nums; } +.callout { border-left: 3px solid var(--aurora); padding: 10px 16px; background: rgba(80,255,160,.05); border-radius: 0 10px 10px 0; color: #d6f7e6; max-width: 900px; margin-bottom: 40px; } +.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); } +table { border-collapse: collapse; width: 100%; font-size: .9rem; min-width: 760px; } +th, td { padding: 10px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); } +thead th { background: rgba(255,255,255,.05); color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; } +tbody th { color: var(--text); white-space: nowrap; } +tbody td { color: #c9d1f2; } + +.why-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; } +.why-card { padding: 24px; border-radius: var(--radius); border: 1px solid var(--line); background: linear-gradient(160deg, rgba(143,123,255,.1), rgba(57,214,255,.04)); } +.why-card p { color: #c9d1f2; margin: 0; } +.why-icon { font-size: 2rem; margin-bottom: 8px; } + +.timeline { list-style: none; padding: 0; margin: 0; position: relative; } +.timeline::before { content: ""; position: absolute; left: 132px; top: 6px; bottom: 6px; width: 2px; background: linear-gradient(var(--accent), var(--accent2), var(--aurora)); opacity: .6; } +.timeline li { display: grid; grid-template-columns: 120px 1fr; gap: 34px; padding: 12px 0; position: relative; } +.timeline li::before { content: ""; position: absolute; left: 127px; top: 20px; width: 12px; height: 12px; border-radius: 50%; background: var(--bg); border: 2px solid var(--accent2); } +.tl-year { text-align: right; color: var(--aurora); font-weight: 700; font-variant-numeric: tabular-nums; padding-top: 2px; } +.tl-body h3 { margin: 0 0 2px; font-size: 1.05rem; } +.tl-body p { margin: 0; color: #c9d1f2; } + +.quiz { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 18px; } +.q { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; background: rgba(255,255,255,.03); } +.q-text { font-weight: 600; margin: 0 0 12px; } +.q-text span { color: var(--accent2); } +.q-opts { display: grid; gap: 8px; } +.q-opts button { text-align: left; background: rgba(255,255,255,.04); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; cursor: pointer; font-size: .93rem; } +.q-opts button:hover:not(:disabled) { background: rgba(143,123,255,.15); border-color: var(--accent); } +.q-opts button.right { background: rgba(80,255,160,.15); border-color: #4dffa0; } +.q-opts button.wrong { background: rgba(255,80,100,.15); border-color: #ff5a6e; } +.q-opts button:disabled { cursor: default; } +.q-explain { margin: 12px 0 0; color: #c9d1f2; font-size: .92rem; } +.quiz-footer { display: flex; align-items: center; gap: 16px; margin-top: 22px; font-weight: 600; } + +.mop { max-width: none; background: radial-gradient(800px 400px at 80% 50%, rgba(57,214,255,.15), transparent), radial-gradient(700px 400px at 10% 30%, rgba(107,255,176,.12), transparent), #050818; } +.mop-inner { max-width: 900px; margin: 0 auto; text-align: center; } +.mop-inner p { color: #d0d7f5; font-size: 1.05rem; } +.mop-date { color: var(--aurora) !important; font-weight: 600; margin-bottom: 24px; } + +.footer { padding: 36px max(5vw, 20px); border-top: 1px solid var(--line); color: var(--muted); font-size: .88rem; text-align: center; } +.footer p { margin: 6px 0; } + +/* ------------------------------------------------------------ mobile */ +@media (max-width: 1100px) { + .nav a { padding: 6px 7px; font-size: .85rem; } +} +@media (max-width: 960px) { + .menu-btn { display: block; } + .nav { display: none; position: absolute; top: 58px; left: 0; right: 0; flex-direction: column; background: rgba(5,7,20,.97); padding: 10px; border-bottom: 1px solid var(--line); } + body.menu-open .nav { display: flex; } + .lang { margin-left: auto; } + .viewer { height: auto; min-height: 0; overflow: visible; } + .stage { position: relative; height: 68vh; min-height: 380px; } + .hero { position: relative; width: 100%; padding: 26px 20px 30px; background: var(--bg); } + body.exploring .hero { display: none; } + .ui { position: static; } + .ui .panel, .ui .planet-tabs { display: none; } + body.exploring .ui .panel, body.exploring .ui .planet-tabs { display: flex; } + .planet-tabs { position: absolute; top: 66px; max-width: 96vw; overflow-x: auto; } + .planet-tabs button { padding: 7px 11px; font-size: .85rem; white-space: nowrap; flex: none; } + .topbar { gap: 10px; padding: 0 12px; } + .lang button { padding: 6px 9px; } + .panel { position: static !important; width: auto !important; max-height: none !important; margin: 12px; flex-direction: column; } + .tour { position: absolute; bottom: auto; top: calc(68vh - 10px); transform: translate(-50%, -100%); } + body.touring .panel.right { display: none; } + .bar-row { grid-template-columns: 90px 1fr; } + .bar-val { grid-column: 2; font-size: .85rem; margin-top: -8px; } + .timeline::before { left: 8px; } + .timeline li { grid-template-columns: 1fr; gap: 4px; padding-left: 30px; } + .timeline li::before { left: 3px; } + .tl-year { text-align: left; } + .quiz { grid-template-columns: 1fr; } +} +@media (max-width: 520px) { + .brand span:last-child { display: none; } +} + +/* ------------------------------------------------------------- moons */ +.moon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 18px; } +.moon-card { display: flex; gap: 18px; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(160deg, rgba(255,255,255,.045), rgba(255,255,255,.01)); } +.moon-body { flex: 1; min-width: 0; display: flex; flex-direction: column; } +.moon-body .tag { color: var(--aurora); font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; margin: 0 0 4px; } +.moon-body h3 { margin-bottom: 6px; } +.moon-body p { color: #c9d1f2; font-size: .93rem; margin: 0 0 10px; } +.moon-body .btn { align-self: flex-start; margin-top: auto; } +.moon-facts { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 0 0 12px; font-size: .82rem; } +.moon-facts dt { color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; } +.moon-facts dd { margin: 0; } +.globe { + flex: none; width: 110px; height: 110px; border-radius: 50%; + background-size: 220px 110px; background-repeat: repeat-x; + box-shadow: inset -28px -10px 36px rgba(0,0,0,.9), inset 6px 4px 16px rgba(255,255,255,.12), 0 0 30px rgba(120,140,255,.15); + animation: globe-spin 24s linear infinite; +} +@keyframes globe-spin { from { background-position-x: 0; } to { background-position-x: -220px; } } +.moon-chips { display: flex; flex-wrap: wrap; gap: 6px; } +.moon-chips button { + display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 4px; border-radius: 999px; cursor: pointer; + background: rgba(255,255,255,.05); border: 1px solid var(--line); color: var(--text); font-size: .82rem; +} +.moon-chips button:hover { background: rgba(143,123,255,.18); border-color: var(--accent); } +.chip-globe { width: 22px; height: 22px; border-radius: 50%; background-size: 44px 22px; box-shadow: inset -5px -2px 6px rgba(0,0,0,.85); } +.moon-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; } +@media (max-width: 960px) { + .moon-grid { grid-template-columns: 1fr; } + .moon-card { flex-direction: column; align-items: center; text-align: left; } +} + +/* -------------------------------------------------------- spacecraft */ +.themes h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-bottom: 10px; } +.theme-chips { display: flex; flex-wrap: wrap; gap: 8px; } +.theme-chips button, .theme-badges button { + background: rgba(255,255,255,.04); color: var(--text); border: 1px solid var(--line); border-radius: 999px; + padding: 7px 14px; cursor: pointer; font-size: .86rem; +} +.theme-chips button b { color: var(--aurora); margin-right: 4px; } +.theme-chips button:hover, .theme-badges button:hover { border-color: var(--accent); background: rgba(143,123,255,.14); } +.theme-chips button.active { background: linear-gradient(135deg, var(--accent), var(--accent2)); border-color: transparent; color: #fff; } +.theme-chips button.active b { color: #fff; } +.theme-desc { color: #cfd6f5; min-height: 1.6em; margin: 12px 0 20px; max-width: 900px; } +.craft-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-bottom: 18px; } +.craft-picker button { + display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; cursor: pointer; + background: rgba(255,255,255,.04); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; color: var(--text); + transition: opacity .3s, border-color .2s, background .2s; +} +.craft-picker button:hover { border-color: var(--accent); } +.craft-picker button.active { border-color: var(--accent2); background: rgba(57,214,255,.12); box-shadow: 0 0 0 1px var(--accent2) inset; } +.craft-picker button.dim { opacity: .35; } +.cp-name { font-weight: 700; font-size: .95rem; } +.cp-years { color: var(--muted); font-size: .75rem; } +.craft-layout { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(320px, 1fr); gap: 18px; } +.craft-stage { position: relative; height: 620px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: #03040c; } +.craft-stage canvas { display: block; width: 100% !important; height: 100% !important; } +.craft-note { position: absolute; left: 12px; bottom: 8px; z-index: 2; margin: 0; font-size: .78rem; color: var(--muted); pointer-events: none; } +.hotspot { + width: 26px; height: 26px; border-radius: 50%; border: 2px solid #fff; cursor: pointer; pointer-events: auto; + background: rgba(57,214,255,.85); color: #001018; font-weight: 800; font-size: .8rem; box-shadow: 0 0 12px rgba(57,214,255,.8); +} +.hotspot:hover, .hotspot.active { background: #ffd25a; box-shadow: 0 0 18px rgba(255,210,90,.95); transform: scale(1.15); } +.craft-stage .label-layer { z-index: 1; } +.craft-info { border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; background: rgba(255,255,255,.03); max-height: 620px; overflow: auto; } +.craft-info .tag { color: var(--aurora); font-size: .75rem; text-transform: uppercase; letter-spacing: .1em; margin: 0; } +.craft-name { font-size: 1.6rem !important; margin: 2px 0 8px; } +.craft-info p { color: #cfd6f5; } +.craft-info h4 { font-size: .75rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 18px 0 8px; } +.craft-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 0; } +.craft-facts dt { color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; } +.craft-facts dd { margin: 0; font-size: .88rem; } +.theme-badges { display: flex; flex-wrap: wrap; gap: 6px; } +.theme-badges button { font-size: .78rem; padding: 5px 10px; } +.inst-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; } +.inst-list li { border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.02); } +.inst-list li.open { border-color: #ffd25a; background: rgba(255,210,90,.06); } +.inst-list button { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: none; border: 0; color: var(--text); padding: 8px 10px; cursor: pointer; font-size: .9rem; font-weight: 600; } +.inst-list .num { flex: none; width: 22px; height: 22px; border-radius: 50%; background: rgba(57,214,255,.85); color: #001018; display: grid; place-items: center; font-size: .75rem; font-weight: 800; } +.inst-list li.open .num { background: #ffd25a; } +.inst-list p { margin: 0; padding: 0 12px 10px 42px; font-size: .9rem; } +.saw-list { margin: 0; padding-left: 20px; color: #cfd6f5; font-size: .92rem; } +.saw-list li { margin-bottom: 4px; } +.future-card { margin-top: 18px; padding: 18px 22px; border-radius: var(--radius); border: 1px dashed rgba(107,255,176,.45); background: rgba(107,255,176,.05); } +.future-card p { margin: 0; color: #d6f7e6; } +@media (max-width: 960px) { + .craft-layout { grid-template-columns: 1fr; } + .craft-stage { height: 420px; } + .craft-info { max-height: none; } + .craft-facts { grid-template-columns: 1fr 1fr; } +} diff --git a/index.html b/index.html index b0c4b3666032a737f3903db53e6a8a9272483e28..c55ee3c23f9d7fce67d949ea28bcdc7bc8d6983c 100644 --- a/index.html +++ b/index.html @@ -1,19 +1,246 @@ - - - - - My static Space - - - -
-

Welcome to your static Space!

-

You can modify this app directly by editing index.html in the Files and versions tab.

-

- Also don't forget to check the - Spaces documentation. -

-
- + + + + + Magnetospheres of the Outer Planets · 3D Explorer + + + + + + +
+ 🪐Outer Planets + +
+ + + +
+ +
+ + +
+
+ +
+

+

+

+
+ + +
+

+
+ +
+
+ + + + + +
+ + + + + + +
+ +
+ +
+ +
+

+

+
+
+ + +
+

+

+
+
+
+

+
+
+
+

+
+
+
+

+
+
+
+

+
+
+
+

+
+
+

+

+
+ UVIR +
+

+

+
+
+
+ + +
+

+

+
+
+ + +
+

+

+
+

+
+

+
+
+
+
+

+
+
+
+
+

+

+
+
+ + +
+

+

+
+

+

+
+
+ + +
+

+

+
+
+ + +
+

+

+
    +
    + + +
    +

    +

    +
    + +
    + + +
    +
    +

    +

    +

    + +
    +
    +
    + + + + + diff --git a/js/aurora2d.js b/js/aurora2d.js new file mode 100644 index 0000000000000000000000000000000000000000..fe8923864b362687aacdd1798305b02f043eba8e --- /dev/null +++ b/js/aurora2d.js @@ -0,0 +1,263 @@ +// Animated polar views of the aurora on each planet (2D canvas). +// View: looking down on the north spin pole, Sun towards the top of the image. + +const TAU = Math.PI * 2; +const D = Math.PI / 180; + +// periodic pseudo-noise in azimuth, 0..1 +const pn = (a, t, s) => 0.5 + 0.22 * Math.sin(3 * a + 0.7 * t + s) + 0.16 * Math.sin(7 * a - 1.1 * t + 2.1 * s) + 0.12 * Math.sin(13 * a + 1.9 * t + 3.7 * s); +const wrap = a => Math.atan2(Math.sin(a), Math.cos(a)); +const rgba = (c, a) => `rgba(${c[0]},${c[1]},${c[2]},${Math.max(0, Math.min(1, a)).toFixed(3)})`; + +function sph(colat, az) { return [Math.sin(colat) * Math.cos(az), Math.sin(colat) * Math.sin(az), Math.cos(colat)]; } +function basis(P) { + const ref = Math.abs(P[2]) < 0.9 ? [0, 0, 1] : [1, 0, 0]; + const cr = (u, v) => [u[1] * v[2] - u[2] * v[1], u[2] * v[0] - u[0] * v[2], u[0] * v[1] - u[1] * v[0]]; + const nz = v => { const l = Math.hypot(...v); return v.map(x => x / l); }; + const t1 = nz(cr(P, ref)); const t2 = cr(P, t1); + return [t1, t2]; +} +function ovalPoint(P, t1, t2, rho, b) { + const c = Math.cos(rho), s = Math.sin(rho), cb = Math.cos(b), sb = Math.sin(b); + return [c * P[0] + s * (cb * t1[0] + sb * t2[0]), c * P[1] + s * (cb * t1[1] + sb * t2[1]), c * P[2] + s * (cb * t1[2] + sb * t2[2])]; +} + +const STYLES = { + earth: { + disc: [[40, 80, 140], [6, 14, 34]], + draw(g, t) { + const cyc = (t % 11) / 11; + const sub = cyc < 0.12 ? cyc / 0.12 : Math.exp(-(cyc - 0.12) * 6); + g.oval({ + pole: sph(4 * D, -Math.PI / 2), + rho: b => (19.5 + 2.5 * (pn(b, t * 0.5, 1) - 0.5) - 4.5 * sub * Math.exp(-(wrap(b + Math.PI / 2) ** 2) / 0.35)) * D, + I: b => 0.35 + 0.65 * pn(b, t * 1.3, 2) + 1.4 * sub * Math.exp(-(wrap(b + Math.PI / 2) ** 2) / 0.25), + color: [90, 255, 150], glow: [40, 255, 120], ray: 3.5 * D, width: 7 + }); + g.oval({ + pole: sph(4 * D, -Math.PI / 2), + rho: b => (17.5 + 2 * (pn(b, t * 0.4, 5) - 0.5)) * D, + I: b => 0.25 + 0.4 * pn(b, t, 6) + 0.6 * sub * Math.exp(-(wrap(b + Math.PI / 2) ** 2) / 0.3), + color: [255, 70, 110], glow: [255, 40, 90], ray: 2 * D, width: 14, glowOnly: true + }); + } + }, + jupiter: { + disc: [[120, 95, 70], [20, 14, 10]], + draw(g, t) { + const pole = sph(7 * D, -2.4); + g.oval({ + pole, + rho: b => (15 + 2.6 * Math.cos(b - 2.3) + 1.2 * (pn(b, t * 0.3, 1) - 0.5)) * D, + I: b => 0.55 + 0.45 * pn(b, t * 1.1, 3) + 0.7 * Math.exp(-(wrap(b - 0.1) ** 2) / 0.25) * (0.6 + 0.4 * Math.sin(t * 0.6)), + color: [205, 160, 255], glow: [150, 90, 255], ray: 2.2 * D, width: 9 + }); + // polar flares inside the main oval + for (let i = 0; i < 6; i++) { + const ph = i * 1.7; + const f = Math.pow(Math.max(0, Math.sin(t * (1.5 + i * 0.37) + ph)), 6); + g.blob(pole, (3 + (i * 1.3) % 7) * D, ph + t * 0.05, 18 + i * 3, [230, 170, 255], f * 0.9); + } + // moon footprints (Io has a long tail) + const io = 0.4 + t * 0.33, eu = 2.3 + t * 0.21, ga = 4.4 + t * 0.14; + g.foot(pole, 23 * D, io, [255, 235, 255], 1.0, 0.9); + g.foot(pole, 20.5 * D, eu, [235, 210, 255], 0.75, 0.25); + g.foot(pole, 18.8 * D, ga, [225, 200, 255], 0.75, 0.2); + } + }, + saturn: { + disc: [[130, 115, 80], [18, 15, 10]], + draw(g, t) { + const pole = sph(0.5 * D, 0); + const gust = 0.5 + 0.5 * Math.sin(t * 0.25); + g.oval({ + pole, + rho: b => (15 + 1.6 * Math.sin(b + t * 0.2) - 2.2 * gust * Math.exp(-(wrap(b + 0.4) ** 2) / 0.6)) * D, + I: b => 0.25 + 0.75 * Math.pow(0.5 + 0.5 * Math.sin(3 * (b - t * 0.45)), 3) + 0.9 * gust * Math.exp(-(wrap(b - 0.0) ** 2) / 0.4), + color: [140, 170, 255], glow: [110, 110, 255], ray: 2.8 * D, width: 9 + }); + g.oval({ + pole, + rho: () => 12.5 * D, + I: b => 0.25 * pn(b, t * 0.6, 4), + color: [230, 130, 255], glow: [210, 90, 255], ray: 1.5 * D, width: 10, glowOnly: true + }); + } + }, + uranus: { + disc: [[90, 160, 175], [10, 22, 26]], + draw(g, t) { + const ap = t * 0.28; + [[sph(59 * D, ap), 0], [sph(121 * D, ap + Math.PI), 3]].forEach(([P, s]) => { + g.oval({ + pole: P, + rho: b => (15 + 2 * (pn(b, t * 0.4, s) - 0.5)) * D, + I: b => Math.max(0, pn(b * 0.7, t * 0.8, s + 1) - 0.45) * 2.6, + color: [150, 255, 235], glow: [80, 230, 220], ray: 2.6 * D, width: 9 + }); + }); + } + }, + neptune: { + disc: [[40, 70, 160], [6, 10, 30]], + draw(g, t) { + const ap = 1.2 + t * 0.3; + const P = sph(47 * D, ap); + g.oval({ + pole: P, + rho: b => (16 + 2.5 * (pn(b, t * 0.4, 2) - 0.5)) * D, + I: b => Math.max(0, pn(b * 0.8, t * 0.7, 3) - 0.5) * 2.0, + color: [130, 220, 255], glow: [90, 160, 255], ray: 2.2 * D, width: 9 + }); + } + } +}; + +class AuroraCanvas { + constructor(canvas, planet) { + this.c = canvas; this.ctx = canvas.getContext('2d'); this.style = STYLES[planet]; + this.running = false; this.t0 = performance.now() / 1000 + Math.random() * 20; + this.stars = Array.from({ length: 70 }, () => [Math.random(), Math.random(), Math.random() * 0.8 + 0.2]); + this.planet = planet; + this.img = new Image(); + this.img.onload = () => { this.polar = null; }; + this.img.src = `textures/${planet}.jpg`; + new ResizeObserver(() => this.resize()).observe(canvas); + new IntersectionObserver(es => { + this.running = es[0].isIntersecting; + if (this.running && !this.raf) this.raf = requestAnimationFrame(() => this.loop()); + }).observe(canvas); + this.resize(); + } + resize() { + const dpr = Math.min(window.devicePixelRatio || 1, 2); + const w = this.c.clientWidth || 300; + this.c.width = Math.round(w * dpr); this.c.height = Math.round(w * dpr); + this.W = this.c.width; this.R = this.W * 0.42; this.cx = this.W / 2; this.cy = this.W / 2 + this.W * 0.02; + this.s = this.W / 400; + this.polar = null; + } + // Orthographic view of the north pole, sampled from the equirectangular texture (built once per size). + buildPolar() { + if (!this.img.complete || !this.img.naturalWidth) return null; + const iw = this.img.naturalWidth, ih = this.img.naturalHeight; + const src = document.createElement('canvas'); src.width = iw; src.height = ih; + const sg = src.getContext('2d'); sg.drawImage(this.img, 0, 0); + const sd = sg.getImageData(0, 0, iw, ih).data; + const size = Math.round(this.R * 2), out = document.createElement('canvas'); out.width = out.height = size; + const og = out.getContext('2d'), od = og.createImageData(size, size); + for (let y = 0; y < size; y++) for (let x = 0; x < size; x++) { + const nx = (x + 0.5) / size * 2 - 1, ny = 1 - (y + 0.5) / size * 2, rr = nx * nx + ny * ny; + if (rr > 1) continue; + const colat = Math.asin(Math.sqrt(rr)); + const lon = Math.atan2(ny, nx); + const u = ((lon / TAU) % 1 + 1) % 1, v = colat / Math.PI; + const si = ((Math.min(ih - 1, Math.floor(v * ih)) * iw) + Math.floor(u * iw)) * 4, di = (y * size + x) * 4; + od.data[di] = sd[si]; od.data[di + 1] = sd[si + 1]; od.data[di + 2] = sd[si + 2]; od.data[di + 3] = 255; + } + og.putImageData(od, 0, 0); + return out; + } + P(v) { return [this.cx + this.R * v[0], this.cy - this.R * v[1]]; } + + oval({ pole, rho, I, color, glow, ray, width, glowOnly }) { + const g = this.ctx, [t1, t2] = basis(pole), N = 220; + let prev = null; + for (let k = 0; k <= N; k++) { + const b = (k / N) * TAU; + const r = rho(b), inten = Math.max(0, I(b)); + const p = ovalPoint(pole, t1, t2, r, b); + if (p[2] <= 0.02) { prev = null; continue; } + const limb = 0.6 + 0.6 * (1 - p[2]); // brighter near the limb (longer path) + const sp = this.P(p); + if (prev) { + g.strokeStyle = rgba(glow, 0.13 * inten * limb); + g.lineWidth = width * this.s * 1.8; + g.beginPath(); g.moveTo(prev[0], prev[1]); g.lineTo(sp[0], sp[1]); g.stroke(); + g.lineWidth = width * this.s * 0.6; + g.strokeStyle = rgba(glow, 0.22 * inten * limb); + g.stroke(); + } + if (!glowOnly && k % 1 === 0) { + const q = ovalPoint(pole, t1, t2, r + ray * (0.4 + inten), b); + if (q[2] > 0) { + const sq = this.P(q); + const grd = g.createLinearGradient(sp[0], sp[1], sq[0], sq[1]); + grd.addColorStop(0, rgba(color, Math.min(1, 0.85 * inten * limb))); + grd.addColorStop(1, rgba(color, 0)); + g.strokeStyle = grd; g.lineWidth = 1.6 * this.s; + g.beginPath(); g.moveTo(sp[0], sp[1]); g.lineTo(sq[0], sq[1]); g.stroke(); + } + } + prev = sp; + } + } + blob(pole, rho, b, size, color, a) { + if (a < 0.01) return; + const [t1, t2] = basis(pole); + const p = ovalPoint(pole, t1, t2, rho, b); if (p[2] <= 0) return; + const [x, y] = this.P(p), r = size * this.s, g = this.ctx; + const grd = g.createRadialGradient(x, y, 0, x, y, r); + grd.addColorStop(0, rgba(color, a)); grd.addColorStop(1, rgba(color, 0)); + g.fillStyle = grd; g.beginPath(); g.arc(x, y, r, 0, TAU); g.fill(); + } + foot(pole, rho, b, color, a, tail) { + const [t1, t2] = basis(pole); + const n = Math.round(60 * tail) + 1; + for (let i = n; i >= 0; i--) { + const bb = b + (i / 60) * 1.2; + const p = ovalPoint(pole, t1, t2, rho, bb); if (p[2] <= 0) continue; + const [x, y] = this.P(p), g = this.ctx; + const f = i === 0 ? 1 : 0.35 * Math.exp(-i / 25); + const r = (i === 0 ? 16 : 7) * this.s; + const grd = g.createRadialGradient(x, y, 0, x, y, r); + grd.addColorStop(0, rgba(color, a * f)); grd.addColorStop(1, rgba(color, 0)); + g.fillStyle = grd; g.beginPath(); g.arc(x, y, r, 0, TAU); g.fill(); + } + } + background() { + const g = this.ctx, W = this.W, R = this.R; + g.globalCompositeOperation = 'source-over'; + g.fillStyle = '#02030a'; g.fillRect(0, 0, W, W); + for (const [x, y, b] of this.stars) { g.fillStyle = `rgba(255,255,255,${b * 0.6})`; g.fillRect(x * W, y * W, 1.2 * this.s, 1.2 * this.s); } + if (!this.polar) this.polar = this.buildPolar(); + if (this.polar) { + g.save(); g.translate(this.cx, this.cy); g.rotate(-this.spin || 0); + g.drawImage(this.polar, -R, -R, 2 * R, 2 * R); g.restore(); + // day side (towards the Sun, top) to night side (bottom) + const sh = g.createLinearGradient(0, this.cy - R, 0, this.cy + R); + sh.addColorStop(0, 'rgba(0,0,8,0.15)'); sh.addColorStop(0.45, 'rgba(0,0,8,0.55)'); sh.addColorStop(0.62, 'rgba(0,0,8,0.86)'); sh.addColorStop(1, 'rgba(0,0,8,0.9)'); + g.fillStyle = sh; g.beginPath(); g.arc(this.cx, this.cy, R, 0, TAU); g.fill(); + } else { + const [cDay, cNight] = this.style.disc; + const lin = g.createLinearGradient(0, this.cy - R, 0, this.cy + R); + lin.addColorStop(0, rgba(cDay, 1)); lin.addColorStop(0.55, rgba(cNight, 1)); lin.addColorStop(1, rgba(cNight, 1)); + g.fillStyle = lin; g.beginPath(); g.arc(this.cx, this.cy, R, 0, TAU); g.fill(); + } + // limb darkening + const rad = g.createRadialGradient(this.cx, this.cy, R * 0.55, this.cx, this.cy, R); + rad.addColorStop(0, 'rgba(0,0,0,0)'); rad.addColorStop(1, 'rgba(0,0,0,0.55)'); + g.fillStyle = rad; g.beginPath(); g.arc(this.cx, this.cy, R, 0, TAU); g.fill(); + // latitude grid + g.strokeStyle = 'rgba(255,255,255,0.08)'; g.lineWidth = 1 * this.s; + [30, 60].forEach(c => { g.beginPath(); g.arc(this.cx, this.cy, R * Math.sin(c * D), 0, TAU); g.stroke(); }); + for (let i = 0; i < 4; i++) { const a = i * Math.PI / 4; g.beginPath(); g.moveTo(this.cx - R * Math.cos(a), this.cy - R * Math.sin(a)); g.lineTo(this.cx + R * Math.cos(a), this.cy + R * Math.sin(a)); g.stroke(); } + // Sun marker + g.fillStyle = 'rgba(255,220,140,0.95)'; g.font = `${18 * this.s}px system-ui, sans-serif`; g.textAlign = 'center'; g.textBaseline = 'middle'; + g.fillText('☀', this.cx, this.cy - R - 14 * this.s); + } + loop() { + this.raf = 0; + if (!this.running) return; + const t = performance.now() / 1000 - this.t0; + this.spin = t * 0.04; // slow planet rotation under the aurora + this.background(); + this.ctx.globalCompositeOperation = 'lighter'; + this.style.draw(this, t); + this.raf = requestAnimationFrame(() => this.loop()); + } +} + +export function initAuroraGallery(root = document) { + root.querySelectorAll('canvas.aurora2d').forEach(c => new AuroraCanvas(c, c.dataset.planet)); +} diff --git a/js/craft.js b/js/craft.js new file mode 100644 index 0000000000000000000000000000000000000000..42a1405cd2f8feac0527d2b3ca54b54f3c2d98cc --- /dev/null +++ b/js/craft.js @@ -0,0 +1,153 @@ +// Standalone 3D viewer for spacecraft models with numbered instrument hotspots. + +import * as THREE from 'three'; +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { CSS2DRenderer, CSS2DObject } from 'three/addons/renderers/CSS2DRenderer.js'; +import { RoomEnvironment } from 'three/addons/environments/RoomEnvironment.js'; +import { buildCraft, hotspots } from './models.js'; + +export function createCraftViewer(container, { onPick = () => {}, backdrop = () => null } = {}) { + const renderer = new THREE.WebGLRenderer({ antialias: true, alpha: false }); + renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2)); + renderer.outputColorSpace = THREE.SRGBColorSpace; + renderer.toneMapping = THREE.ACESFilmicToneMapping; + renderer.toneMappingExposure = 1.05; + renderer.setClearColor(0x03040c, 1); + container.appendChild(renderer.domElement); + + const labels = new CSS2DRenderer(); + labels.domElement.className = 'label-layer'; + container.appendChild(labels.domElement); + + const scene = new THREE.Scene(); + const pmrem = new THREE.PMREMGenerator(renderer); + scene.environment = pmrem.fromScene(new RoomEnvironment(), 0.04).texture; + scene.environmentIntensity = 0.6; + + const camera = new THREE.PerspectiveCamera(38, 1, 0.05, 2000); + camera.position.set(6, 3.5, 8); + const controls = new OrbitControls(camera, renderer.domElement); + controls.enableDamping = true; controls.dampingFactor = 0.07; + controls.autoRotate = true; controls.autoRotateSpeed = 0.6; + controls.minDistance = 2.5; controls.maxDistance = 30; + controls.enablePan = false; + controls.addEventListener('start', () => { controls.autoRotate = false; }); + + const sun = new THREE.DirectionalLight(0xfff4e0, 3.2); + sun.position.set(10, 6, 7); + scene.add(sun); + scene.add(new THREE.HemisphereLight(0x8fa8ff, 0x1a1208, 0.35)); + const rim = new THREE.DirectionalLight(0x6f8cff, 0.9); + rim.position.set(-8, -2, -6); + scene.add(rim); + + // stars + { + const n = 1500, p = new Float32Array(n * 3); + for (let i = 0; i < n; i++) { const v = new THREE.Vector3().randomDirection().multiplyScalar(500 + Math.random() * 300); p.set([v.x, v.y, v.z], i * 3); } + const g = new THREE.BufferGeometry(); g.setAttribute('position', new THREE.BufferAttribute(p, 3)); + scene.add(new THREE.Points(g, new THREE.PointsMaterial({ color: 0xffffff, size: 1.3, sizeAttenuation: false }))); + } + + // planet backdrop (destination of the mission) + const loader = new THREE.TextureLoader(); + const planetMat = new THREE.MeshStandardMaterial({ roughness: 1, metalness: 0 }); + const planet = new THREE.Mesh(new THREE.SphereGeometry(60, 96, 48), planetMat); + planet.position.set(-150, -70, -330); + scene.add(planet); + const texCache = {}; + function setBackdrop(name) { + planet.visible = !!name; + if (!name) return; + if (!texCache[name]) { const t = loader.load(`textures/${name}.jpg`); t.colorSpace = THREE.SRGBColorSpace; texCache[name] = t; } + planetMat.map = texCache[name]; planetMat.needsUpdate = true; + } + + const state = { key: null, root: null, spots: null, markers: [], selected: null, glow: 0 }; + const holder = new THREE.Group(); + scene.add(holder); + + function clear() { + if (!state.root) return; + state.markers.forEach(m => m.element.remove()); + state.root.traverse(o => { if (o.geometry) o.geometry.dispose(); if (o.material && o.userData.inst) o.material.dispose(); }); + holder.remove(state.root); + state.root = null; state.markers = []; state.selected = null; + } + + function show(key, instOrder = []) { + clear(); + const { group, fit } = buildCraft(key); + const s = 3.2 / fit; + group.scale.setScalar(s); + holder.add(group); + state.key = key; state.root = group; + state.spots = hotspots(group); + instOrder.forEach((id, i) => { + const sp = state.spots.get(id); + if (!sp) return; + const el = document.createElement('button'); + el.className = 'hotspot'; el.textContent = i + 1; el.dataset.inst = id; + el.addEventListener('pointerdown', e => e.stopPropagation()); + el.addEventListener('click', e => { e.stopPropagation(); onPick(id); }); + const obj = new CSS2DObject(el); + obj.position.copy(sp.pos); + group.add(obj); + state.markers.push(obj); + }); + setBackdrop(backdrop(key)); + // frame the model + const dist = 9.5; + camera.position.set(dist * 0.62, dist * 0.38, dist * 0.7); + controls.target.set(0, 0, 0); + controls.autoRotate = true; + controls.update(); + } + + function select(id) { + if (state.selected) state.selected.meshes.forEach(m => { m.material.emissive?.setHex(0x000000); }); + state.selected = id ? { id, meshes: state.spots?.get(id)?.meshes || [] } : null; + state.markers.forEach(m => m.element.classList.toggle('active', m.element.dataset.inst === id)); + } + + // click a mesh to pick its instrument + const ray = new THREE.Raycaster(), ptr = new THREE.Vector2(); + let down = null; + renderer.domElement.addEventListener('pointerdown', e => { down = [e.clientX, e.clientY]; }); + renderer.domElement.addEventListener('pointerup', e => { + if (!down || Math.hypot(e.clientX - down[0], e.clientY - down[1]) > 6 || !state.root) return; + const r = renderer.domElement.getBoundingClientRect(); + ptr.set(((e.clientX - r.left) / r.width) * 2 - 1, -((e.clientY - r.top) / r.height) * 2 + 1); + ray.setFromCamera(ptr, camera); + const hit = ray.intersectObject(state.root, true).find(h => h.object.userData.inst && state.markers.some(m => m.element.dataset.inst === h.object.userData.inst)); + if (hit) onPick(hit.object.userData.inst); + }); + + function resize() { + const w = container.clientWidth, h = container.clientHeight; + if (!w || !h) return; + renderer.setSize(w, h, false); labels.setSize(w, h); + camera.aspect = w / h; camera.updateProjectionMatrix(); + } + new ResizeObserver(resize).observe(container); + let visible = false; + new IntersectionObserver(es => { visible = es[0].isIntersecting; }).observe(container); + + const clock = new THREE.Clock(); + (function loop() { + requestAnimationFrame(loop); + const dt = clock.getDelta(); + if (!visible) return; + planet.rotation.y += dt * 0.01; + if (state.selected) { + const k = 0.35 + 0.35 * Math.sin(clock.elapsedTime * 4); + state.selected.meshes.forEach(m => m.material.emissive?.setRGB(0.25 * k, 0.75 * k, 1.0 * k)); + } + controls.update(); + renderer.render(scene, camera); + labels.render(scene, camera); + })(); + resize(); + + return { show, select, get key() { return state.key; } }; +} diff --git a/js/i18n.js b/js/i18n.js new file mode 100644 index 0000000000000000000000000000000000000000..30e7a18fca0d1f1a740fef5f3aa3b19403424bac --- /dev/null +++ b/js/i18n.js @@ -0,0 +1,513 @@ +// All user-facing text in English, Simplified Chinese and Traditional Chinese. +// Static text is bound with data-i18n="dotted.key"; lists are rendered by main.js. + +export const LANGS = ["en", "zh-Hans", "zh-Hant"]; + +export const I18N = { + /* ------------------------------------------------------------------ EN */ + en: { + meta: { title: "Magnetospheres of the Outer Planets · 3D Explorer" }, + brand: "Outer Planets", + nav: { explore: "3D Explorer", how: "How it works", aurora: "Aurora", compare: "Size", why: "Why study", missions: "Missions", quiz: "Quiz", mop: "MOP 2028" }, + hero: { + kicker: "Inspired by the MOP 2028 conference · Hong Kong", + title: "Magnetospheres of the Outer Planets", + sub: "Invisible magnetic bubbles, some larger than the Sun, surround Jupiter, Saturn, Uranus and Neptune. They trap electrified gas, roar in radio waves and paint the poles with aurora. Fly through them in 3D.", + cta: "Explore in 3D", + cta2: "How does it work?", + hint: "Drag to rotate · scroll or pinch to zoom" + }, + ex: { + layers: "Layers", + notscale: "Not to scale: distances are compressed so everything fits on screen.", + speed: "Time speed", + views: "Camera", + tour: "Guided tour", + tourStart: "▶ Start guided tour", + prev: "◀ Back", + next: "Next ▶", + exit: "Close", + stepFmt: "Step {i} of {n}", + facts: "Key facts", + intro: "Show intro" + }, + layer: { field: "Magnetic field lines", wind: "Solar wind", mp: "Magnetopause & bow shock", aurora: "Aurora", torus: "Plasma torus", moons: "Moons & flux tubes", labels: "Labels" }, + view: { overview: "Whole magnetosphere", close: "Planet close-up", aurora: "Aurora (north pole)", south: "Aurora (south pole)" }, + info: { field: "Magnetic field", tilt: "Field tilt", mp: "Magnetopause", source: "Main plasma source", rot: "Day length", aurora: "Aurora", visited: "Visited by" }, + lbl: { mp: "Magnetopause", bs: "Bow shock", tail: "Magnetotail →", wind: "← Solar wind from the Sun", torusJ: "Io plasma torus", torusS: "Enceladus neutral & plasma torus" }, + moons: { io: "Io", europa: "Europa", ganymede: "Ganymede", enceladus: "Enceladus", titan: "Titan", triton: "Triton" }, + planets: { + earth: { + name: "Earth", tag: "Our home, for comparison", + desc: "Earth’s magnetic field holds off the solar wind about 10 Earth radii from the planet. Energy from the solar wind drives the green and red aurora near the poles.", + field: "≈0.3 gauss at the equator (our reference)", tilt: "≈11°", mp: "≈10 Earth radii (≈64,000 km)", + source: "Solar wind and the ionosphere", rot: "24 h", + aurora: "Visible green and red light from oxygen; blue and purple from nitrogen", visited: "Hundreds of satellites" + }, + jupiter: { + name: "Jupiter", tag: "The giant", + desc: "Jupiter’s magnetosphere is the largest single structure inside the Sun’s heliosphere. Its fast 10-hour spin and the volcanoes of Io fill it with plasma, and its aurora are hundreds of times more energetic than Earth’s.", + field: "≈4.2 gauss (≈14× Earth); magnetic moment ≈20,000× Earth", tilt: "≈10°", mp: "45–100 Jupiter radii (3–7 million km)", + source: "Io’s volcanoes: about 1 tonne of gas every second", rot: "9.9 h", + aurora: "A permanent ultraviolet main oval, plus glowing ‘footprints’ of Io, Europa and Ganymede", + visited: "Pioneer, Voyager, Ulysses, Galileo, Cassini, New Horizons, Juno; JUICE and Europa Clipper on the way" + }, + saturn: { + name: "Saturn", tag: "The ringed laboratory", + desc: "Saturn’s magnetic field is almost perfectly lined up with its spin axis, a puzzle for scientists. Water from the geysers of the moon Enceladus fills it with plasma, and charged particles from the rings rain into its atmosphere.", + field: "≈0.21 gauss (≈0.7× Earth); magnetic moment ≈580× Earth", tilt: "< 0.1°", mp: "≈20–25 Saturn radii (≈1.2–1.5 million km)", + source: "Water vapour from Enceladus’ plumes (hundreds of kg per second)", rot: "10.6 h", + aurora: "Ultraviolet and infrared ovals that brighten when gusts of solar wind arrive", + visited: "Pioneer 11, Voyager 1 & 2, Cassini (2004–2017)" + }, + uranus: { + name: "Uranus", tag: "The tumbling ice giant", + desc: "Uranus spins on its side, and its magnetic field is tilted 59° from the spin axis and shifted away from the centre. As the planet turns, the whole magnetosphere wobbles and twists like a corkscrew. Watch the field lines swing as it rotates.", + field: "≈0.23 gauss; magnetic moment ≈50× Earth", tilt: "≈59°, offset ≈0.3 radii from centre", mp: "≈18 Uranus radii (≈460,000 km)", + source: "Solar wind and Uranus’ own upper atmosphere", rot: "17.2 h", + aurora: "Patchy aurora far from the spin poles; seen in ultraviolet (Hubble) and infrared (H₃⁺)", + visited: "Only Voyager 2 (1986)" + }, + neptune: { + name: "Neptune", tag: "The distant ice giant", + desc: "Neptune’s field is tilted 47° and offset by more than half a planet radius. Its large moon Triton orbits backwards. In 2025 the James Webb Space Telescope revealed Neptune’s infrared aurora for the first time.", + field: "≈0.14 gauss; magnetic moment ≈25× Earth", tilt: "≈47°, offset ≈0.55 radii from centre", mp: "≈23–26 Neptune radii (≈0.6 million km)", + source: "Triton and Neptune’s atmosphere", rot: "16.1 h", + aurora: "Faint aurora at mid-latitudes; infrared H₃⁺ glow seen by JWST", + visited: "Only Voyager 2 (1989)" + } + }, + how: { + title: "How does a magnetosphere work?", + sub: "Six ideas explain almost everything you see in the 3D explorer. Press “See it in 3D” on any card to jump to that step.", + see: "See it in 3D", + steps: [ + { title: "A planet-sized dynamo", text: "Deep inside each giant planet, electrically conducting fluid swirls as the planet spins: liquid metallic hydrogen in Jupiter and Saturn, and probably salty, watery ‘ice’ in Uranus and Neptune. Moving charges make electric currents, and the currents make a magnetic field. Its field lines loop from one magnetic pole to the other." }, + { title: "The solar wind", text: "The Sun constantly blows out a thin wind of charged particles (plasma) at about 400 km per second, carrying the Sun’s magnetic field with it. When the wind meets a planet’s magnetic field, it cannot simply pass through." }, + { title: "Bow shock and magnetopause", text: "The solar wind slows down suddenly at the bow shock, like water piling up at the front of a boat. Closer in, at the magnetopause, the wind’s pressure balances the planet’s magnetic pressure. Inside is the magnetosphere. Behind the planet it is stretched into a long magnetotail." }, + { title: "Moons fill it with plasma", text: "Jupiter’s moon Io has hundreds of volcanoes and releases about one tonne of gas every second. The gas is ionised and forms a doughnut of plasma, the Io torus, which spins with Jupiter. At Saturn, the geysers of Enceladus do the same with water. The fast-spinning plasma is flung outward and stretches the field into a disc." }, + { title: "Aurora: the light show", text: "Charged particles race along the field lines into the upper atmosphere near the magnetic poles. When they hit gas atoms and molecules, the gas glows: this is aurora. On Earth the solar wind is the main power source. On Jupiter most of the energy comes from the planet’s own spin, so its aurora never switches off. Moons such as Io even leave their own glowing ‘footprints’." }, + { title: "Tilted, wobbling ice giants", text: "At Uranus and Neptune the magnetic field is strongly tilted and shifted off-centre. As the planet spins, the magnetosphere swings around and opens and closes to the solar wind every day. Only Voyager 2 has visited them, so scientists want a new orbiter to learn more." } + ] + }, + au: { + title: "Aurora across the solar system", + sub: "Each animation looks down on a planet’s north pole, with the Sun at the top. Earth’s aurora is visible light. On the giant planets the aurora glows mostly in ultraviolet and infrared light that our eyes cannot see, so the colours here are ‘false colour’, as in the images from Hubble, Juno and JWST.", + visible: "Visible light", + falsec: "False colour", + sun: "Sun", + cards: { + earth: { title: "Earth: curtains of green and red", text: "Electrons from the magnetotail hit oxygen atoms 100–300 km above the ground. Oxygen glows green lower down and red higher up, and nitrogen adds blue and purple. During a magnetic storm the oval grows and moves towards the equator. Watch for the bright ‘substorm’ bursts on the night side." }, + jupiter: { title: "Jupiter: a permanent ultraviolet crown", text: "The main oval is powered by Jupiter’s spin as plasma from Io is dragged around the planet. The spots on the equator side are the footprints of Io, Europa and Ganymede, linked to their moons by electric currents. Inside the oval, bright flares flicker within seconds." }, + saturn: { title: "Saturn: an oval that answers the Sun", text: "Saturn’s aurora behaves partly like Earth’s and partly like Jupiter’s. It brightens and forms spirals when gusts of solar wind squeeze the magnetosphere, and bright patches rotate with the planet. Hydrogen glows in ultraviolet and the H₃⁺ ion in infrared." }, + uranus: { title: "Uranus: aurora in strange places", text: "The magnetic poles of Uranus are far from its spin poles, so its aurora appears in patches at unusual latitudes and sweeps around as the planet turns. Hubble has photographed it in ultraviolet, and its infrared glow was reported in 2023." }, + neptune: { title: "Neptune: the faint glow found by JWST", text: "Neptune’s tilted field puts its aurora at mid-latitudes, not near the poles. Voyager 2 saw hints of it in 1989. In 2025 the James Webb Space Telescope finally imaged Neptune’s infrared aurora." } + }, + colorsTitle: "Why are the colours different?", + colorsText: "The colour of an aurora depends on which gas is glowing. Earth’s air is mostly nitrogen and oxygen, which glow in colours we can see. The upper atmospheres of the giant planets are mostly hydrogen. Hydrogen molecules glow in ultraviolet and the H₃⁺ ion glows in infrared, so we need space telescopes and spacecraft to see them.", + powerTitle: "How powerful?", + powerText: "Jupiter’s aurora are hundreds of times more energetic than Earth’s. Juno has seen its electrons hit the atmosphere with energies above a million electron-volts, far more than at Earth." + }, + cmp: { + title: "How big are they?", + sub: "Distance from each planet’s centre to the nose of its magnetic bubble (the dayside magnetopause), drawn to the same scale. The Sun’s diameter is shown for comparison.", + sun: "Sun (diameter)", + note: "If our eyes could see Jupiter’s magnetosphere, it would look larger than the full Moon in the night sky. Its magnetotail stretches beyond the orbit of Saturn.", + tableTitle: "Side-by-side comparison", + planet: "Planet" + }, + why: { + title: "Why study the magnetospheres of the outer planets?", + sub: "These invisible giants are natural laboratories that help us understand space, protect technology and search for life.", + cards: [ + { icon: "⚛️", title: "A natural plasma laboratory", text: "More than 99% of the visible matter in the universe is plasma. Giant-planet magnetospheres let us study plasma physics on scales that no laboratory on Earth can reach." }, + { icon: "🌍", title: "Space weather at home", text: "Solar storms can damage satellites, disturb GPS and radio, and overload power grids. Comparing different magnetospheres tests our theories and improves space-weather forecasts for Earth." }, + { icon: "🌊", title: "Finding hidden oceans", text: "Jupiter’s changing magnetic field drives electric currents in salty water. Galileo’s magnetometer used this to reveal an ocean under Europa’s ice, and Hubble’s view of Ganymede’s aurora pointed to an ocean there too. These oceans are among the best places to look for life." }, + { icon: "🛰️", title: "Keeping spacecraft safe", text: "Jupiter’s radiation belts are among the harshest places in the solar system. Juno protects its electronics in a titanium vault. Mapping the radiation helps engineers design missions such as JUICE and Europa Clipper." }, + { icon: "🔭", title: "Clues to planetary interiors", text: "A magnetic field is a window into a planet’s interior. Saturn’s oddly aligned field and the tilted fields of Uranus and Neptune tell us how fluids flow deep inside, where no probe can go." }, + { icon: "✨", title: "Planets around other stars", text: "Astronomers are searching for radio waves from the magnetospheres of exoplanets. Jupiter’s powerful radio emissions show us what to look for, and a magnetic field may help a world keep its atmosphere." } + ] + }, + ms: { + title: "Exploring the giants: missions", + sub: "Everything we know comes from a small number of brave spacecraft and powerful telescopes.", + items: [ + { year: "1973–79", name: "Pioneer 10 & 11", text: "The first spacecraft to reach Jupiter and Saturn, measuring their intense radiation belts." }, + { year: "1979–89", name: "Voyager 1 & 2", text: "Discovered Io’s volcanoes and toured the four giant planets. Voyager 2 is still the only visitor to Uranus (1986) and Neptune (1989)." }, + { year: "1990–", name: "Hubble Space Telescope", text: "Has photographed ultraviolet aurora on Jupiter, Saturn and Uranus for more than three decades." }, + { year: "1995–2003", name: "Galileo", text: "The first Jupiter orbiter. Found evidence of hidden oceans in Europa, Ganymede and Callisto, and discovered Ganymede’s own magnetic field." }, + { year: "2004–17", name: "Cassini–Huygens", text: "Spent 13 years at Saturn, discovered the Enceladus plumes and ended with the ‘Grand Finale’ dives between the planet and its rings." }, + { year: "2016–", name: "Juno", text: "Flies over Jupiter’s poles in a polar orbit, imaging the aurora up close and measuring the particles that create it." }, + { year: "2021–", name: "James Webb Space Telescope", text: "Images Jupiter’s infrared aurora in fine detail and revealed Neptune’s aurora in 2025." }, + { year: "2023 → 2031", name: "JUICE (ESA)", text: "Launched in 2023, it will reach Jupiter in 2031 and become the first spacecraft to orbit another planet’s moon: Ganymede." }, + { year: "2024 → 2030", name: "Europa Clipper (NASA)", text: "Launched in 2024, it will arrive in 2030 and fly past Europa dozens of times to study its ocean and the radiation around it." }, + { year: "Future", name: "Uranus Orbiter and Probe", text: "Recommended as NASA’s top-priority new flagship mission, to explore the strange, tilted magnetosphere of Uranus." } + ] + }, + qz: { + title: "Test yourself", + sub: "Six quick questions. Tap an answer to check it.", + score: "Score", + reset: "Try again", + correct: "Correct!", + wrong: "Not quite.", + items: [ + { q: "What creates the magnetic field of a giant planet?", options: ["A giant iron bar magnet in the core", "Electric currents in swirling, conducting fluid inside the planet (a dynamo)", "The solar wind blowing on the planet", "Its rings"], answer: 1, explain: "Moving conducting fluid, such as metallic hydrogen inside Jupiter, makes electric currents that create the magnetic field. This is called a dynamo." }, + { q: "Which moon is the main source of plasma in Jupiter’s magnetosphere?", options: ["Europa", "Ganymede", "Io", "Titan"], answer: 2, explain: "Io’s volcanoes release about one tonne of gas every second. It is ionised and forms the Io plasma torus." }, + { q: "What is the boundary where the solar wind’s pressure balances the planet’s magnetic field?", options: ["Magnetopause", "Equator", "Ionosphere", "Event horizon"], answer: 0, explain: "The magnetopause is the edge of the magnetosphere. Further out, the solar wind first slows down at the bow shock." }, + { q: "Why are pictures of Jupiter’s aurora usually in false colour?", options: ["Jupiter is too far away to have colours", "The aurora glows mostly in ultraviolet and infrared light that our eyes cannot see", "It only happens in daytime", "Cameras cannot photograph it"], answer: 1, explain: "Hydrogen in Jupiter’s upper atmosphere gives off mainly ultraviolet and infrared light, so scientists add colours to show it." }, + { q: "Which spacecraft is the only one to have visited Uranus and Neptune?", options: ["Cassini", "Juno", "Voyager 2", "JUICE"], answer: 2, explain: "Voyager 2 flew past Uranus in 1986 and Neptune in 1989. Scientists hope to send a new orbiter to Uranus." }, + { q: "Which planet’s magnetic field is almost perfectly lined up with its spin axis?", options: ["Saturn", "Uranus", "Neptune", "Earth"], answer: 0, explain: "Saturn’s field is tilted by less than 0.1°. Dynamo theory struggles to explain this, which makes it an exciting puzzle." } + ] + }, + mop: { + title: "About the MOP conference", + text: "Since the 1970s, the Magnetospheres of the Outer Planets (MOP) conference has brought together the international community studying the space environments of Jupiter, Saturn, Uranus, Neptune and their moons. MOP 2028 will be held in Hong Kong for the first time, at the University of Hong Kong, from 10 to 14 January 2028.", + date: "10–14 January 2028 · LE1, Library Extension Building, The University of Hong Kong", + link: "Visit the MOP 2028 website" + }, + ft: { + note: "Made for students and the public. The 3D scenes are simplified and not to scale; aurora colours on the giant planets are false colour.", + sources: "Facts from NASA, ESA, the MOP 2028 conference and published research.", + learn: "Learn more" + } + }, + + /* ------------------------------------------------------------- 简体中文 */ + "zh-Hans": { + meta: { title: "外行星磁层 · 3D 探索" }, + brand: "外行星磁层", + nav: { explore: "3D 探索", how: "运作原理", aurora: "极光", compare: "大小比较", why: "为何研究", missions: "探测任务", quiz: "小测验", mop: "MOP 2028" }, + hero: { + kicker: "灵感来自 2028 年香港 MOP 国际会议", + title: "外行星磁层", + sub: "木星、土星、天王星和海王星周围,包裹着看不见的磁“泡泡”,有些甚至比太阳还要大。它们困住带电气体、发出强烈的无线电波,还在两极点亮绚丽的极光。一起用 3D 飞进去看看吧!", + cta: "进入 3D 探索", + cta2: "它是怎样运作的?", + hint: "拖动旋转 · 滚轮或双指缩放" + }, + ex: { + layers: "图层", + notscale: "非真实比例:为了在屏幕上显示全部内容,距离已被压缩。", + speed: "时间速度", + views: "视角", + tour: "导览", + tourStart: "▶ 开始导览", + prev: "◀ 上一步", + next: "下一步 ▶", + exit: "关闭", + stepFmt: "第 {i} 步,共 {n} 步", + facts: "重要数据", + intro: "显示简介" + }, + layer: { field: "磁力线", wind: "太阳风", mp: "磁层顶与弓形激波", aurora: "极光", torus: "等离子体环", moons: "卫星与磁通管", labels: "标签" }, + view: { overview: "整个磁层", close: "行星近景", aurora: "极光(北极)", south: "极光(南极)" }, + info: { field: "磁场强度", tilt: "磁轴倾角", mp: "磁层顶距离", source: "主要等离子体来源", rot: "一天长度", aurora: "极光", visited: "到访探测器" }, + lbl: { mp: "磁层顶", bs: "弓形激波", tail: "磁尾 →", wind: "← 来自太阳的太阳风", torusJ: "木卫一等离子体环", torusS: "土卫二中性气体与等离子体环" }, + moons: { io: "木卫一", europa: "木卫二", ganymede: "木卫三", enceladus: "土卫二", titan: "土卫六", triton: "海卫一" }, + planets: { + earth: { + name: "地球", tag: "我们的家园,用作比较", + desc: "地球的磁场在距离地球约 10 个地球半径处挡住太阳风。来自太阳风的能量驱动两极附近绿色和红色的极光。", + field: "赤道约 0.3 高斯(作为参照)", tilt: "约 11°", mp: "约 10 个地球半径(约 64,000 公里)", + source: "太阳风与电离层", rot: "24 小时", + aurora: "氧原子发出绿色和红色可见光;氮分子发出蓝色和紫色光", visited: "数以百计的人造卫星" + }, + jupiter: { + name: "木星", tag: "巨无霸", + desc: "木星磁层是太阳日球层内最大的单一结构。木星约 10 小时自转一周,加上木卫一(艾奥)的火山,令磁层充满等离子体;它的极光比地球的强数百倍。", + field: "约 4.2 高斯(约地球的 14 倍);磁矩约为地球的 20,000 倍", tilt: "约 10°", mp: "45–100 个木星半径(300–700 万公里)", + source: "木卫一的火山:每秒约 1 吨气体", rot: "9.9 小时", + aurora: "永不熄灭的紫外主极光环,以及木卫一、木卫二和木卫三的发光“足迹”", + visited: "先驱者号、旅行者号、尤利西斯号、伽利略号、卡西尼号、新视野号、朱诺号;JUICE 和欧罗巴快船正在途中" + }, + saturn: { + name: "土星", tag: "带光环的实验室", + desc: "土星的磁轴几乎与自转轴完全重合,这是令科学家困惑的谜题。土卫二(恩克拉多斯)喷泉喷出的水汽为磁层提供等离子体,而光环中的带电粒子会像雨一样落入土星大气。", + field: "约 0.21 高斯(约地球的 0.7 倍);磁矩约为地球的 580 倍", tilt: "小于 0.1°", mp: "约 20–25 个土星半径(约 120–150 万公里)", + source: "土卫二羽流喷出的水汽(每秒数百公斤)", rot: "10.6 小时", + aurora: "紫外和红外极光环,在太阳风阵风到达时增亮", + visited: "先驱者 11 号、旅行者 1 号和 2 号、卡西尼号(2004–2017)" + }, + uranus: { + name: "天王星", tag: "“躺着”自转的冰巨星", + desc: "天王星侧躺着自转,它的磁轴与自转轴相差 59°,而且偏离行星中心。行星转动时,整个磁层像开瓶器一样摆动和扭转。留意磁力线如何随着自转摆动。", + field: "约 0.23 高斯;磁矩约为地球的 50 倍", tilt: "约 59°,偏离中心约 0.3 个半径", mp: "约 18 个天王星半径(约 46 万公里)", + source: "太阳风与天王星自身的高层大气", rot: "17.2 小时", + aurora: "远离自转极、呈斑块状的极光;哈勃在紫外波段、地面望远镜在红外(H₃⁺)波段观测到", + visited: "只有旅行者 2 号(1986 年)" + }, + neptune: { + name: "海王星", tag: "遥远的冰巨星", + desc: "海王星的磁轴倾斜 47°,并偏离中心超过半个行星半径。它的大卫星海卫一(特里同)逆向公转。2025 年,詹姆斯·韦布空间望远镜首次拍到海王星的红外极光。", + field: "约 0.14 高斯;磁矩约为地球的 25 倍", tilt: "约 47°,偏离中心约 0.55 个半径", mp: "约 23–26 个海王星半径(约 60 万公里)", + source: "海卫一与海王星大气", rot: "16.1 小时", + aurora: "位于中纬度的微弱极光;韦布望远镜看到红外 H₃⁺ 辉光", + visited: "只有旅行者 2 号(1989 年)" + } + }, + how: { + title: "磁层是怎样运作的?", + sub: "掌握以下六个概念,就能看懂 3D 探索中几乎所有的现象。按任何卡片上的“在 3D 中查看”即可跳到该步骤。", + see: "在 3D 中查看", + steps: [ + { title: "行星大小的发电机", text: "在每颗巨行星深处,导电流体随着行星自转而翻滚:木星和土星内部是液态金属氢,天王星和海王星内部可能是含盐的水质“冰”。移动的电荷形成电流,电流产生磁场。磁力线从一个磁极绕到另一个磁极。" }, + { title: "太阳风", text: "太阳不断吹出由带电粒子(等离子体)组成的稀薄“风”,速度约每秒 400 公里,并携带着太阳的磁场。当太阳风遇到行星的磁场时,不能直接穿过。" }, + { title: "弓形激波与磁层顶", text: "太阳风在弓形激波处突然减速,就像船头前堆起的水浪。再往里,在磁层顶,太阳风的压力与行星的磁压力达到平衡。磁层顶以内就是磁层;在行星背后,磁层被拉成长长的磁尾。" }, + { title: "卫星为磁层注入等离子体", text: "木卫一有数百座火山,每秒释放约一吨气体。这些气体被电离,形成一个随木星自转的甜甜圈状等离子体环——木卫一环。在土星,土卫二的喷泉以水做同样的事。高速旋转的等离子体被甩向外,把磁场拉伸成一个圆盘。" }, + { title: "极光:天空的灯光秀", text: "带电粒子沿着磁力线冲进磁极附近的高层大气,撞击气体原子和分子,使气体发光,这就是极光。地球极光主要由太阳风供能;木星极光的能量大多来自木星自身的自转,所以永不熄灭。木卫一等卫星甚至会留下自己的发光“足迹”。" }, + { title: "倾斜摇摆的冰巨星", text: "天王星和海王星的磁场严重倾斜并偏离中心。行星自转时,磁层随之摆动,每天都会对太阳风“开门”和“关门”。只有旅行者 2 号到访过它们,因此科学家希望派出新的轨道器深入研究。" } + ] + }, + au: { + title: "太阳系中的极光", + sub: "每个动画都是从行星北极上空俯视,太阳位于上方。地球极光是可见光;巨行星的极光主要发出紫外线和红外线,人眼看不见,所以这里的颜色是“假色”,就像哈勃、朱诺号和韦布望远镜的图像一样。", + visible: "可见光", + falsec: "假色", + sun: "太阳", + cards: { + earth: { title: "地球:绿色与红色的光幕", text: "来自磁尾的电子在离地 100–300 公里处撞击氧原子。氧在较低处发出绿光、在较高处发出红光,氮则添上蓝色和紫色。磁暴期间,极光环会扩大并向赤道移动。留意夜侧突然增亮的“亚暴”。" }, + jupiter: { title: "木星:永恒的紫外光冠", text: "主极光环由木星自转供能:来自木卫一的等离子体被拖着绕木星转动。靠赤道一侧的光点是木卫一、木卫二和木卫三的“足迹”,由电流与这些卫星相连。极光环内,明亮的闪焰在几秒内忽明忽暗。" }, + saturn: { title: "土星:回应太阳的极光环", text: "土星极光的行为一部分像地球,一部分像木星。当太阳风阵风挤压磁层时,极光会增亮并形成螺旋,明亮的斑块随行星一起转动。氢分子发出紫外光,H₃⁺ 离子发出红外光。" }, + uranus: { title: "天王星:出现在奇怪位置的极光", text: "天王星的磁极远离自转极,所以极光以斑块形式出现在不寻常的纬度,并随着行星自转扫过。哈勃望远镜拍到过它的紫外极光,2023 年天文学家亦报告了它的红外辉光。" }, + neptune: { title: "海王星:韦布望远镜发现的微光", text: "海王星倾斜的磁场令极光出现在中纬度,而不是两极附近。旅行者 2 号在 1989 年看到一些迹象;2025 年,韦布空间望远镜终于拍到海王星的红外极光。" } + }, + colorsTitle: "为什么颜色不同?", + colorsText: "极光的颜色取决于是哪种气体在发光。地球大气主要是氮和氧,会发出我们看得见的颜色。巨行星的高层大气主要是氢:氢分子发出紫外光,H₃⁺ 离子发出红外光,所以我们需要空间望远镜和探测器才能看见。", + powerTitle: "有多强?", + powerText: "木星极光的能量比地球极光强数百倍。朱诺号发现撞入木星大气的电子能量可超过一百万电子伏特,远高于地球的情况。" + }, + cmp: { + title: "它们有多大?", + sub: "按相同比例绘出由行星中心到磁“泡泡”前端(日侧磁层顶)的距离,并以太阳的直径作比较。", + sun: "太阳(直径)", + note: "假如我们的眼睛能看见木星磁层,它在夜空中会比满月还大。它的磁尾甚至延伸到土星轨道以外。", + tableTitle: "并列比较", + planet: "行星" + }, + why: { + title: "为什么要研究外行星磁层?", + sub: "这些看不见的巨物是天然的实验室,帮助我们认识太空、保护科技,并寻找生命。", + cards: [ + { icon: "⚛️", title: "天然的等离子体实验室", text: "宇宙中超过 99% 的可见物质是等离子体。巨行星磁层让我们在地球实验室无法达到的尺度上研究等离子体物理。" }, + { icon: "🌍", title: "了解地球的空间天气", text: "太阳风暴会损坏卫星、干扰 GPS 和无线电,甚至令电网过载。比较不同的磁层可以检验理论,改进地球的空间天气预报。" }, + { icon: "🌊", title: "寻找隐藏的海洋", text: "木星不断变化的磁场会在咸水中感应出电流。伽利略号的磁强计借此发现木卫二冰层下的海洋;哈勃对木卫三极光的观测也显示那里有海洋。这些海洋是寻找生命的最佳地点之一。" }, + { icon: "🛰️", title: "保护探测器", text: "木星的辐射带是太阳系中最恶劣的环境之一。朱诺号把电子设备放在钛金属“保险箱”中。绘制辐射分布有助工程师设计 JUICE 和欧罗巴快船等任务。" }, + { icon: "🔭", title: "窥探行星内部", text: "磁场是了解行星内部的窗口。土星奇特地对齐的磁场,以及天王星和海王星倾斜的磁场,告诉我们探测器无法到达的深处流体如何流动。" }, + { icon: "✨", title: "其他恒星的行星", text: "天文学家正在寻找系外行星磁层发出的无线电波。木星强大的无线电辐射告诉我们要找什么;磁场也可能帮助一颗行星保住它的大气层。" } + ] + }, + ms: { + title: "探索巨行星:探测任务", + sub: "我们所知的一切,来自少数勇敢的探测器和强大的望远镜。", + items: [ + { year: "1973–79", name: "先驱者 10 号和 11 号", text: "首批到达木星和土星的探测器,测量了它们强烈的辐射带。" }, + { year: "1979–89", name: "旅行者 1 号和 2 号", text: "发现木卫一的火山,并巡游四颗巨行星。旅行者 2 号至今仍是唯一到访天王星(1986)和海王星(1989)的探测器。" }, + { year: "1990–", name: "哈勃空间望远镜", text: "三十多年来拍摄木星、土星和天王星的紫外极光。" }, + { year: "1995–2003", name: "伽利略号", text: "首个木星轨道器。发现木卫二、木卫三和木卫四可能有地下海洋,并发现木卫三拥有自己的磁场。" }, + { year: "2004–17", name: "卡西尼–惠更斯号", text: "在土星工作 13 年,发现土卫二的羽流,最后以穿越土星与光环之间的“壮丽谢幕”结束任务。" }, + { year: "2016–", name: "朱诺号", text: "以极轨道飞越木星两极,近距离拍摄极光并测量产生极光的粒子。" }, + { year: "2021–", name: "詹姆斯·韦布空间望远镜", text: "以红外线细致拍摄木星极光,并在 2025 年揭示海王星的极光。" }, + { year: "2023 → 2031", name: "JUICE 木星冰卫星探测器(欧空局)", text: "2023 年发射,将于 2031 年到达木星,并成为首个环绕其他行星卫星(木卫三)运行的探测器。" }, + { year: "2024 → 2030", name: "欧罗巴快船(NASA)", text: "2024 年发射,将于 2030 年到达,数十次飞掠木卫二,研究其海洋和周围的辐射。" }, + { year: "未来", name: "天王星轨道器与探测器", text: "被推荐为 NASA 最优先的新旗舰任务,探索天王星奇特而倾斜的磁层。" } + ] + }, + qz: { + title: "考考你", + sub: "六道小题,点选答案即可核对。", + score: "得分", + reset: "再试一次", + correct: "答对了!", + wrong: "差一点。", + items: [ + { q: "巨行星的磁场是怎样产生的?", options: ["核心里一块巨大的铁条磁铁", "行星内部翻滚的导电流体中的电流(发电机效应)", "太阳风吹向行星", "它的光环"], answer: 1, explain: "移动的导电流体(例如木星内部的金属氢)产生电流,电流产生磁场,这称为发电机效应。" }, + { q: "木星磁层中的等离子体主要来自哪颗卫星?", options: ["木卫二", "木卫三", "木卫一", "土卫六"], answer: 2, explain: "木卫一的火山每秒释放约一吨气体,气体被电离后形成木卫一等离子体环。" }, + { q: "太阳风压力与行星磁场达到平衡的边界叫什么?", options: ["磁层顶", "赤道", "电离层", "事件视界"], answer: 0, explain: "磁层顶是磁层的边缘。在更外面,太阳风会先在弓形激波处减速。" }, + { q: "为什么木星极光的图片通常是假色?", options: ["木星太远,没有颜色", "极光主要发出人眼看不见的紫外线和红外线", "极光只在白天出现", "相机拍不到"], answer: 1, explain: "木星高层大气中的氢主要发出紫外线和红外线,科学家加上颜色来显示它们。" }, + { q: "唯一到访过天王星和海王星的探测器是哪一个?", options: ["卡西尼号", "朱诺号", "旅行者 2 号", "JUICE"], answer: 2, explain: "旅行者 2 号在 1986 年飞掠天王星,1989 年飞掠海王星。科学家希望派出新的轨道器前往天王星。" }, + { q: "哪颗行星的磁轴几乎与自转轴完全重合?", options: ["土星", "天王星", "海王星", "地球"], answer: 0, explain: "土星磁轴的倾角小于 0.1°。发电机理论很难解释这一点,这正是令人兴奋的谜题。" } + ] + }, + mop: { + title: "关于 MOP 会议", + text: "自 1970 年代起,“外行星磁层”(MOP)国际会议聚集了研究木星、土星、天王星、海王星及其卫星空间环境的科学家。MOP 2028 将首次在香港举行,地点为香港大学,日期为 2028 年 1 月 10 日至 14 日。", + date: "2028 年 1 月 10–14 日 · 香港大学图书馆新翼 LE1 演讲厅", + link: "浏览 MOP 2028 网站" + }, + ft: { + note: "为学生和公众制作。3D 场景经过简化,并非真实比例;巨行星的极光颜色为假色。", + sources: "资料来自 NASA、欧空局、MOP 2028 会议及已发表的研究。", + learn: "延伸阅读" + } + }, + + /* ------------------------------------------------------------- 繁體中文 */ + "zh-Hant": { + meta: { title: "外行星磁層 · 3D 探索" }, + brand: "外行星磁層", + nav: { explore: "3D 探索", how: "運作原理", aurora: "極光", compare: "大小比較", why: "為何研究", missions: "探測任務", quiz: "小測驗", mop: "MOP 2028" }, + hero: { + kicker: "靈感來自 2028 年香港 MOP 國際會議", + title: "外行星磁層", + sub: "木星、土星、天王星和海王星周圍,包裹著看不見的磁「泡泡」,有些甚至比太陽還要大。它們困住帶電氣體、發出強烈的無線電波,還在兩極點亮絢麗的極光。一起用 3D 飛進去看看吧!", + cta: "進入 3D 探索", + cta2: "它是怎樣運作的?", + hint: "拖動旋轉 · 滾輪或雙指縮放" + }, + ex: { + layers: "圖層", + notscale: "非真實比例:為了在螢幕上顯示全部內容,距離已被壓縮。", + speed: "時間速度", + views: "視角", + tour: "導覽", + tourStart: "▶ 開始導覽", + prev: "◀ 上一步", + next: "下一步 ▶", + exit: "關閉", + stepFmt: "第 {i} 步,共 {n} 步", + facts: "重要數據", + intro: "顯示簡介" + }, + layer: { field: "磁力線", wind: "太陽風", mp: "磁層頂與弓形激波", aurora: "極光", torus: "等離子體環", moons: "衛星與磁通管", labels: "標籤" }, + view: { overview: "整個磁層", close: "行星近景", aurora: "極光(北極)", south: "極光(南極)" }, + info: { field: "磁場強度", tilt: "磁軸傾角", mp: "磁層頂距離", source: "主要等離子體來源", rot: "一天長度", aurora: "極光", visited: "到訪探測器" }, + lbl: { mp: "磁層頂", bs: "弓形激波", tail: "磁尾 →", wind: "← 來自太陽的太陽風", torusJ: "木衛一等離子體環", torusS: "土衛二中性氣體與等離子體環" }, + moons: { io: "木衛一", europa: "木衛二", ganymede: "木衛三", enceladus: "土衛二", titan: "土衛六", triton: "海衛一" }, + planets: { + earth: { + name: "地球", tag: "我們的家園,用作比較", + desc: "地球的磁場在距離地球約 10 個地球半徑處擋住太陽風。來自太陽風的能量驅動兩極附近綠色和紅色的極光。", + field: "赤道約 0.3 高斯(作為參照)", tilt: "約 11°", mp: "約 10 個地球半徑(約 64,000 公里)", + source: "太陽風與電離層", rot: "24 小時", + aurora: "氧原子發出綠色和紅色可見光;氮分子發出藍色和紫色光", visited: "數以百計的人造衛星" + }, + jupiter: { + name: "木星", tag: "巨無霸", + desc: "木星磁層是太陽日球層內最大的單一結構。木星約 10 小時自轉一周,加上木衛一(艾奧)的火山,令磁層充滿等離子體;它的極光比地球的強數百倍。", + field: "約 4.2 高斯(約地球的 14 倍);磁矩約為地球的 20,000 倍", tilt: "約 10°", mp: "45–100 個木星半徑(300–700 萬公里)", + source: "木衛一的火山:每秒約 1 噸氣體", rot: "9.9 小時", + aurora: "永不熄滅的紫外主極光環,以及木衛一、木衛二和木衛三的發光「足跡」", + visited: "先鋒號、航海家號、尤利西斯號、伽利略號、卡西尼號、新視野號、朱諾號;JUICE 和歐羅巴快船正在途中" + }, + saturn: { + name: "土星", tag: "帶光環的實驗室", + desc: "土星的磁軸幾乎與自轉軸完全重合,這是令科學家困惑的謎題。土衛二(恩塞勒達斯)噴泉噴出的水汽為磁層提供等離子體,而光環中的帶電粒子會像雨一樣落入土星大氣。", + field: "約 0.21 高斯(約地球的 0.7 倍);磁矩約為地球的 580 倍", tilt: "小於 0.1°", mp: "約 20–25 個土星半徑(約 120–150 萬公里)", + source: "土衛二羽流噴出的水汽(每秒數百公斤)", rot: "10.6 小時", + aurora: "紫外和紅外極光環,在太陽風陣風到達時增亮", + visited: "先鋒 11 號、航海家 1 號和 2 號、卡西尼號(2004–2017)" + }, + uranus: { + name: "天王星", tag: "「躺著」自轉的冰巨星", + desc: "天王星側躺著自轉,它的磁軸與自轉軸相差 59°,而且偏離行星中心。行星轉動時,整個磁層像開瓶器一樣擺動和扭轉。留意磁力線如何隨著自轉擺動。", + field: "約 0.23 高斯;磁矩約為地球的 50 倍", tilt: "約 59°,偏離中心約 0.3 個半徑", mp: "約 18 個天王星半徑(約 46 萬公里)", + source: "太陽風與天王星自身的高層大氣", rot: "17.2 小時", + aurora: "遠離自轉極、呈斑塊狀的極光;哈勃在紫外波段、地面望遠鏡在紅外(H₃⁺)波段觀測到", + visited: "只有航海家 2 號(1986 年)" + }, + neptune: { + name: "海王星", tag: "遙遠的冰巨星", + desc: "海王星的磁軸傾斜 47°,並偏離中心超過半個行星半徑。它的大衛星海衛一(特里同)逆向公轉。2025 年,韋伯太空望遠鏡首次拍到海王星的紅外極光。", + field: "約 0.14 高斯;磁矩約為地球的 25 倍", tilt: "約 47°,偏離中心約 0.55 個半徑", mp: "約 23–26 個海王星半徑(約 60 萬公里)", + source: "海衛一與海王星大氣", rot: "16.1 小時", + aurora: "位於中緯度的微弱極光;韋伯望遠鏡看到紅外 H₃⁺ 輝光", + visited: "只有航海家 2 號(1989 年)" + } + }, + how: { + title: "磁層是怎樣運作的?", + sub: "掌握以下六個概念,就能看懂 3D 探索中幾乎所有的現象。按任何卡片上的「在 3D 中查看」即可跳到該步驟。", + see: "在 3D 中查看", + steps: [ + { title: "行星大小的發電機", text: "在每顆巨行星深處,導電流體隨著行星自轉而翻滾:木星和土星內部是液態金屬氫,天王星和海王星內部可能是含鹽的水質「冰」。移動的電荷形成電流,電流產生磁場。磁力線從一個磁極繞到另一個磁極。" }, + { title: "太陽風", text: "太陽不斷吹出由帶電粒子(等離子體)組成的稀薄「風」,速度約每秒 400 公里,並攜帶著太陽的磁場。當太陽風遇到行星的磁場時,不能直接穿過。" }, + { title: "弓形激波與磁層頂", text: "太陽風在弓形激波處突然減速,就像船頭前堆起的水浪。再往裡,在磁層頂,太陽風的壓力與行星的磁壓力達到平衡。磁層頂以內就是磁層;在行星背後,磁層被拉成長長的磁尾。" }, + { title: "衛星為磁層注入等離子體", text: "木衛一有數百座火山,每秒釋放約一噸氣體。這些氣體被電離,形成一個隨木星自轉的甜甜圈狀等離子體環——木衛一環。在土星,土衛二的噴泉以水做同樣的事。高速旋轉的等離子體被甩向外,把磁場拉伸成一個圓盤。" }, + { title: "極光:天空的燈光秀", text: "帶電粒子沿著磁力線衝進磁極附近的高層大氣,撞擊氣體原子和分子,使氣體發光,這就是極光。地球極光主要由太陽風供能;木星極光的能量大多來自木星自身的自轉,所以永不熄滅。木衛一等衛星甚至會留下自己的發光「足跡」。" }, + { title: "傾斜搖擺的冰巨星", text: "天王星和海王星的磁場嚴重傾斜並偏離中心。行星自轉時,磁層隨之擺動,每天都會對太陽風「開門」和「關門」。只有航海家 2 號到訪過它們,因此科學家希望派出新的軌道器深入研究。" } + ] + }, + au: { + title: "太陽系中的極光", + sub: "每個動畫都是從行星北極上空俯視,太陽位於上方。地球極光是可見光;巨行星的極光主要發出紫外線和紅外線,人眼看不見,所以這裡的顏色是「假色」,就像哈勃、朱諾號和韋伯望遠鏡的圖像一樣。", + visible: "可見光", + falsec: "假色", + sun: "太陽", + cards: { + earth: { title: "地球:綠色與紅色的光幕", text: "來自磁尾的電子在離地 100–300 公里處撞擊氧原子。氧在較低處發出綠光、在較高處發出紅光,氮則添上藍色和紫色。磁暴期間,極光環會擴大並向赤道移動。留意夜側突然增亮的「亞暴」。" }, + jupiter: { title: "木星:永恆的紫外光冠", text: "主極光環由木星自轉供能:來自木衛一的等離子體被拖著繞木星轉動。靠赤道一側的光點是木衛一、木衛二和木衛三的「足跡」,由電流與這些衛星相連。極光環內,明亮的閃焰在幾秒內忽明忽暗。" }, + saturn: { title: "土星:回應太陽的極光環", text: "土星極光的行為一部分像地球,一部分像木星。當太陽風陣風擠壓磁層時,極光會增亮並形成螺旋,明亮的斑塊隨行星一起轉動。氫分子發出紫外光,H₃⁺ 離子發出紅外光。" }, + uranus: { title: "天王星:出現在奇怪位置的極光", text: "天王星的磁極遠離自轉極,所以極光以斑塊形式出現在不尋常的緯度,並隨著行星自轉掃過。哈勃望遠鏡拍到過它的紫外極光,2023 年天文學家亦報告了它的紅外輝光。" }, + neptune: { title: "海王星:韋伯望遠鏡發現的微光", text: "海王星傾斜的磁場令極光出現在中緯度,而不是兩極附近。航海家 2 號在 1989 年看到一些跡象;2025 年,韋伯太空望遠鏡終於拍到海王星的紅外極光。" } + }, + colorsTitle: "為甚麼顏色不同?", + colorsText: "極光的顏色取決於是哪種氣體在發光。地球大氣主要是氮和氧,會發出我們看得見的顏色。巨行星的高層大氣主要是氫:氫分子發出紫外光,H₃⁺ 離子發出紅外光,所以我們需要太空望遠鏡和探測器才能看見。", + powerTitle: "有多強?", + powerText: "木星極光的能量比地球極光強數百倍。朱諾號發現撞入木星大氣的電子能量可超過一百萬電子伏特,遠高於地球的情況。" + }, + cmp: { + title: "它們有多大?", + sub: "按相同比例繪出由行星中心到磁「泡泡」前端(日側磁層頂)的距離,並以太陽的直徑作比較。", + sun: "太陽(直徑)", + note: "假如我們的眼睛能看見木星磁層,它在夜空中會比滿月還大。它的磁尾甚至延伸到土星軌道以外。", + tableTitle: "並列比較", + planet: "行星" + }, + why: { + title: "為甚麼要研究外行星磁層?", + sub: "這些看不見的巨物是天然的實驗室,幫助我們認識太空、保護科技,並尋找生命。", + cards: [ + { icon: "⚛️", title: "天然的等離子體實驗室", text: "宇宙中超過 99% 的可見物質是等離子體。巨行星磁層讓我們在地球實驗室無法達到的尺度上研究等離子體物理。" }, + { icon: "🌍", title: "了解地球的太空天氣", text: "太陽風暴會損壞衛星、干擾 GPS 和無線電,甚至令電網過載。比較不同的磁層可以檢驗理論,改進地球的太空天氣預報。" }, + { icon: "🌊", title: "尋找隱藏的海洋", text: "木星不斷變化的磁場會在鹹水中感應出電流。伽利略號的磁強計藉此發現木衛二冰層下的海洋;哈勃對木衛三極光的觀測也顯示那裡有海洋。這些海洋是尋找生命的最佳地點之一。" }, + { icon: "🛰️", title: "保護探測器", text: "木星的輻射帶是太陽系中最惡劣的環境之一。朱諾號把電子設備放在鈦金屬「保險箱」中。繪製輻射分佈有助工程師設計 JUICE 和歐羅巴快船等任務。" }, + { icon: "🔭", title: "窺探行星內部", text: "磁場是了解行星內部的窗口。土星奇特地對齊的磁場,以及天王星和海王星傾斜的磁場,告訴我們探測器無法到達的深處流體如何流動。" }, + { icon: "✨", title: "其他恆星的行星", text: "天文學家正在尋找系外行星磁層發出的無線電波。木星強大的無線電輻射告訴我們要找甚麼;磁場也可能幫助一顆行星保住它的大氣層。" } + ] + }, + ms: { + title: "探索巨行星:探測任務", + sub: "我們所知的一切,來自少數勇敢的探測器和強大的望遠鏡。", + items: [ + { year: "1973–79", name: "先鋒 10 號和 11 號", text: "首批到達木星和土星的探測器,測量了它們強烈的輻射帶。" }, + { year: "1979–89", name: "航海家 1 號和 2 號", text: "發現木衛一的火山,並巡遊四顆巨行星。航海家 2 號至今仍是唯一到訪天王星(1986)和海王星(1989)的探測器。" }, + { year: "1990–", name: "哈勃太空望遠鏡", text: "三十多年來拍攝木星、土星和天王星的紫外極光。" }, + { year: "1995–2003", name: "伽利略號", text: "首個木星軌道器。發現木衛二、木衛三和木衛四可能有地下海洋,並發現木衛三擁有自己的磁場。" }, + { year: "2004–17", name: "卡西尼–惠更斯號", text: "在土星工作 13 年,發現土衛二的羽流,最後以穿越土星與光環之間的「壯麗謝幕」結束任務。" }, + { year: "2016–", name: "朱諾號", text: "以極軌道飛越木星兩極,近距離拍攝極光並測量產生極光的粒子。" }, + { year: "2021–", name: "韋伯太空望遠鏡", text: "以紅外線細緻拍攝木星極光,並在 2025 年揭示海王星的極光。" }, + { year: "2023 → 2031", name: "JUICE 木星冰月探測器(歐洲太空總署)", text: "2023 年發射,將於 2031 年到達木星,並成為首個環繞其他行星衛星(木衛三)運行的探測器。" }, + { year: "2024 → 2030", name: "歐羅巴快船(NASA)", text: "2024 年發射,將於 2030 年到達,數十次飛掠木衛二,研究其海洋和周圍的輻射。" }, + { year: "未來", name: "天王星軌道器與探測器", text: "被推薦為 NASA 最優先的新旗艦任務,探索天王星奇特而傾斜的磁層。" } + ] + }, + qz: { + title: "考考你", + sub: "六道小題,點選答案即可核對。", + score: "得分", + reset: "再試一次", + correct: "答對了!", + wrong: "差一點。", + items: [ + { q: "巨行星的磁場是怎樣產生的?", options: ["核心裡一塊巨大的鐵條磁鐵", "行星內部翻滾的導電流體中的電流(發電機效應)", "太陽風吹向行星", "它的光環"], answer: 1, explain: "移動的導電流體(例如木星內部的金屬氫)產生電流,電流產生磁場,這稱為發電機效應。" }, + { q: "木星磁層中的等離子體主要來自哪顆衛星?", options: ["木衛二", "木衛三", "木衛一", "土衛六"], answer: 2, explain: "木衛一的火山每秒釋放約一噸氣體,氣體被電離後形成木衛一等離子體環。" }, + { q: "太陽風壓力與行星磁場達到平衡的邊界叫甚麼?", options: ["磁層頂", "赤道", "電離層", "事件視界"], answer: 0, explain: "磁層頂是磁層的邊緣。在更外面,太陽風會先在弓形激波處減速。" }, + { q: "為甚麼木星極光的圖片通常是假色?", options: ["木星太遠,沒有顏色", "極光主要發出人眼看不見的紫外線和紅外線", "極光只在白天出現", "相機拍不到"], answer: 1, explain: "木星高層大氣中的氫主要發出紫外線和紅外線,科學家加上顏色來顯示它們。" }, + { q: "唯一到訪過天王星和海王星的探測器是哪一個?", options: ["卡西尼號", "朱諾號", "航海家 2 號", "JUICE"], answer: 2, explain: "航海家 2 號在 1986 年飛掠天王星,1989 年飛掠海王星。科學家希望派出新的軌道器前往天王星。" }, + { q: "哪顆行星的磁軸幾乎與自轉軸完全重合?", options: ["土星", "天王星", "海王星", "地球"], answer: 0, explain: "土星磁軸的傾角小於 0.1°。發電機理論很難解釋這一點,這正是令人興奮的謎題。" } + ] + }, + mop: { + title: "關於 MOP 會議", + text: "自 1970 年代起,「外行星磁層」(MOP)國際會議聚集了研究木星、土星、天王星、海王星及其衛星太空環境的科學家。MOP 2028 將首次在香港舉行,地點為香港大學,日期為 2028 年 1 月 10 日至 14 日。", + date: "2028 年 1 月 10–14 日 · 香港大學圖書館新翼 LE1 演講廳", + link: "瀏覽 MOP 2028 網站" + }, + ft: { + note: "為學生和公眾製作。3D 場景經過簡化,並非真實比例;巨行星的極光顏色為假色。", + sources: "資料來自 NASA、歐洲太空總署、MOP 2028 會議及已發表的研究。", + learn: "延伸閱讀" + } + } +}; diff --git a/js/i18n_craft.js b/js/i18n_craft.js new file mode 100644 index 0000000000000000000000000000000000000000..7a7a2f43dd8d0588e07911060eea9aa49b059985 --- /dev/null +++ b/js/i18n_craft.js @@ -0,0 +1,517 @@ +// Spacecraft, instruments, discoveries and the 8 MOP 2028 themes. Merged into I18N by main.js. +// Instrument ids must match the userData.inst tags in models.js. + +export const CRAFT_THEMES = { + voyager: [3, 4, 6], galileo: [1, 4], cassini: [2, 4, 5, 6], juno: [1, 5, 6], + hubble: [3, 4, 5], jwst: [3, 5, 8], juice: [4, 7, 8], clipper: [4, 7, 8] +}; +export const CRAFT_ORDER = ['voyager', 'galileo', 'cassini', 'juno', 'hubble', 'jwst', 'juice', 'clipper']; +export const CRAFT_INST = { + voyager: ['mag', 'pls', 'radio', 'scan', 'rtg', 'record'], + galileo: ['mag', 'epd', 'scan', 'hga', 'probe'], + cassini: ['mag', 'mimi', 'inms', 'uvis', 'rpws', 'huygens'], + juno: ['mag', 'particles', 'uvs', 'waves', 'mwr', 'vault'], + hubble: ['mirror', 'stis', 'acs', 'arrays'], + jwst: ['mirror', 'nircam', 'miri', 'sunshield'], + juice: ['jmag', 'rpwi', 'pep', 'optical', 'rime'], + clipper: ['ecm', 'pims', 'insitu', 'optical', 'reason', 'vault'] +}; +// backdrop planet texture behind each model +export const CRAFT_BACKDROP = { voyager: 'neptune', galileo: 'jupiter', cassini: 'saturn', juno: 'jupiter', hubble: 'earth', jwst: null, juice: 'jupiter', clipper: 'jupiter' }; + +export const CRAFT_I18N = { + /* ================================================================ EN */ + en: { + nav: { craft: "Spacecraft" }, + sc: { + title: "Spacecraft that explore the magnetospheres", + sub: "Everything we know about the giant planets’ magnetospheres comes from these machines. Pick a MOP 2028 theme to see which spacecraft serve it, then turn the 3D model and tap the numbered instruments to learn what each one does.", + themesLabel: "MOP 2028 conference themes", + all: "All spacecraft", + agency: "Agency", years: "Mission", target: "Destination", status: "Status", + instruments: "Instruments", saw: "What it found", mopThemes: "MOP themes", + tapHint: "Tap a numbered marker or an instrument in the list.", + notScale: "Simplified model. Sizes and shapes are approximate.", + future: { title: "Next: a Uranus orbiter", text: "Theme 3 of MOP 2028 is about the case and the design for the next flagship mission. The Uranus Orbiter and Probe, NASA’s top-priority new flagship, would carry a magnetometer, plasma and particle instruments and an aurora camera to finally study the tilted, wobbling magnetosphere of Uranus over many years." } + }, + themes: [ + { title: "Jupiter & the Juno legacy", text: "Magnetospheric dynamics, plasma transport, the Io torus, radiation belts and what Juno’s extended mission leaves for JUICE." }, + { title: "Saturn after Cassini", text: "Ring rain, Enceladus’ plume plasma, seasonal change and the enduring archive of the Cassini Grand Finale." }, + { title: "Ice giants: Uranus & Neptune", text: "Tilted magnetospheres, Triton, and the case and design for the next flagship orbiter." }, + { title: "Moon–magnetosphere interactions", text: "Io, Europa, Ganymede, Enceladus, Titan: induction, sputtering, plumes, footprints and Alfvén wings." }, + { title: "Aurorae & upper atmospheres", text: "Ionosphere–thermosphere coupling, auroral radio emissions and heating, from Hubble and JWST to in-situ fields and particles." }, + { title: "Plasma physics of giant magnetospheres", text: "Reconnection, waves, instabilities, energetic particles and comparative magnetospheric physics." }, + { title: "The JUICE & Europa Clipper era", text: "Cruise science, arrival planning, joint observations and the future fleet, including Enceladus and Uranus concepts." }, + { title: "Models, data & new instruments", text: "Global simulations, open data, laboratory plasma work, new instrumentation, and magnetospheres beyond the solar system." } + ], + crafts: { + voyager: { + name: "Voyager 2", agency: "NASA", years: "Launched 1977", target: "Jupiter, Saturn, Uranus, Neptune", status: "Still working, now in interstellar space", + desc: "The only spacecraft to visit all four giant planets. Its flybys of Uranus (1986) and Neptune (1989) are still our only close-up measurements of the ice giants’ magnetospheres.", + inst: { + mag: { name: "Magnetometers (MAG)", text: "Two sensors on a 13 m boom, far from the spacecraft’s own magnetism. They discovered that the fields of Uranus and Neptune are tilted by 59° and 47° and shifted off-centre." }, + pls: { name: "Plasma & particle detectors (PLS, LECP, CRS)", text: "Counted the ions and electrons around each planet, from the slow solar wind to fast radiation-belt particles." }, + radio: { name: "Radio & plasma wave antennas (PRA, PWS)", text: "Two 10 m wire antennas listened to radio emissions from the aurora regions. Their repeating pattern gave the first rotation periods of Uranus and Neptune." }, + scan: { name: "Scan platform: cameras & UV spectrometer", text: "The cameras photographed Io’s volcanoes and Triton’s geysers. The ultraviolet spectrometer detected aurora on Uranus and Neptune." }, + rtg: { name: "Radioisotope generators (RTGs)", text: "Sunlight is too weak so far from the Sun, so three plutonium-238 generators make electricity. Their power slowly fades, and instruments are being switched off one by one." }, + record: { name: "Golden Record", text: "A gold-plated copper disc with sounds and images of Earth, a message for anyone who might find the spacecraft." } + }, + saw: [ + "Voyager 1 discovered active volcanoes on Io in 1979, the source of Jupiter’s plasma torus.", + "Uranus’s magnetic field is tilted 59° and its magnetotail twists into a corkscrew as the planet spins.", + "Neptune’s field is tilted 47° and offset by more than half a planet radius.", + "Nitrogen geysers erupting on Neptune’s moon Triton.", + "In 2018 it crossed the heliopause and entered interstellar space." + ] + }, + galileo: { + name: "Galileo", agency: "NASA", years: "1989 – 2003", target: "Jupiter", status: "Ended: steered into Jupiter in 2003 to protect Europa", + desc: "The first spacecraft to orbit Jupiter. It spent almost 8 years inside the magnetosphere and showed that some of Jupiter’s moons hide oceans.", + inst: { + mag: { name: "Magnetometer (MAG) on an 11 m boom", text: "Found that Europa and Callisto create their own magnetic signals as Jupiter’s field sweeps past, which means salty, conducting oceans lie under their ice. It also discovered that Ganymede has its own magnetic field." }, + epd: { name: "Energetic Particles Detector (EPD)", text: "Measured the fast ions and electrons in Jupiter’s radiation belts and how they hit the icy moons." }, + scan: { name: "Cameras & spectrometers (SSI, NIMS, UVS)", text: "Photographed eruptions on Io, the cracked surface of Europa and the ultraviolet glow of the Io torus." }, + hga: { name: "High-gain antenna (stuck)", text: "The 4.8 m umbrella antenna never fully opened. Engineers rescued the mission using the small low-gain antenna and new data-compression software." }, + probe: { name: "Atmospheric probe", text: "Released in 1995, it parachuted into Jupiter and measured the atmosphere for 58 minutes before it was crushed." } + }, + saw: [ + "Ganymede has its own magnetosphere inside Jupiter’s, the only moon known to have one.", + "Induced magnetic fields revealed salty oceans under the ice of Europa and Callisto.", + "Io is far more volcanic than expected, with lava hotter than on Earth today.", + "Plasma waves and electron beams linking Io to Jupiter’s atmosphere." + ] + }, + cassini: { + name: "Cassini–Huygens", agency: "NASA, ESA, ASI", years: "1997 – 2017", target: "Saturn and Titan", status: "Ended: dived into Saturn in 2017", + desc: "Orbited Saturn for 13 years. Its last 22 orbits, the Grand Finale, passed between the planet and its rings, places no spacecraft had been before.", + inst: { + mag: { name: "Magnetometer (MAG) on an 11 m boom", text: "In 2005 it noticed Saturn’s field bending around Enceladus, which led to the discovery of the plumes. In the Grand Finale it showed that Saturn’s field is almost perfectly lined up with its spin axis." }, + mimi: { name: "Magnetospheric Imaging Instrument (MIMI)", text: "Took pictures of the invisible magnetosphere using energetic neutral atoms, showing clouds of hot plasma being injected and rotating around Saturn." }, + inms: { name: "Ion & Neutral Mass Spectrometer (INMS)", text: "‘Tasted’ the gas in Enceladus’ plume (water, salts, organic molecules and hydrogen) and in the Grand Finale measured material from the rings raining into Saturn." }, + uvis: { name: "Ultraviolet Imaging Spectrograph (UVIS)", text: "Imaged Saturn’s ultraviolet aurora and the oxygen and water clouds that surround the planet." }, + rpws: { name: "Radio & Plasma Wave Science (RPWS)", text: "Three 10 m antennas recorded Saturn kilometric radiation from the aurora. It found that its rhythm changes over time and differs between north and south." }, + huygens: { name: "Huygens probe (ESA)", text: "Landed on Titan on 14 January 2005, the most distant landing ever made, and sent back pictures of river channels and pebbles of ice." } + }, + saw: [ + "Enceladus sprays water from an underground ocean: the main source of plasma in Saturn’s magnetosphere.", + "Charged particles and dust from the rings ‘rain’ into Saturn’s atmosphere.", + "Saturn’s radio ‘day’ keeps changing, so the length of its day was hard to measure.", + "Titan’s atmosphere interacts with Saturn’s plasma, making complex organic molecules." + ] + }, + juno: { + name: "Juno", agency: "NASA", years: "Launched 2011 · at Jupiter since 2016", target: "Jupiter", status: "Orbiting Jupiter (extended mission)", + desc: "A solar-powered spacecraft on a polar orbit. It is the first to fly directly over Jupiter’s poles, through the regions where the aurora is born.", + inst: { + mag: { name: "Magnetometer (MAG)", text: "Two sensors at the end of a solar wing mapped Jupiter’s magnetic field in more detail than ever, showing it is lumpy and uneven, with a strong spot near the equator nicknamed the ‘Great Blue Spot’." }, + particles: { name: "Particle detectors (JADE, JEDI)", text: "Measured the electrons and ions that fall into the atmosphere and make the aurora. Some electrons are accelerated to far higher energies than at Earth." }, + uvs: { name: "Aurora cameras (UVS, JIRAM)", text: "The ultraviolet spectrograph and the infrared imager photographed the aurora from above the poles, revealing fine detail in the footprints of Io, Europa and Ganymede." }, + waves: { name: "Waves radio & plasma antenna", text: "Listened to Jupiter’s radio emissions while flying through their source regions above the aurora." }, + mwr: { name: "Microwave Radiometer (MWR)", text: "Six antennas look hundreds of kilometres down into the clouds to measure water and ammonia." }, + vault: { name: "Titanium radiation vault", text: "The main electronics sit in a box with titanium walls about 1 cm thick (about 200 kg) to survive Jupiter’s radiation belts." } + }, + saw: [ + "Jupiter’s aurora is powered by electrons accelerated both down into and up away from the planet, in a different way from Earth’s.", + "A new radiation zone just above Jupiter’s atmosphere near the equator.", + "Jupiter’s magnetic field is far more uneven than expected, and it changes slowly over time.", + "Close-up images of the auroral footprints of Io, Europa and Ganymede.", + "Groups of giant cyclones around both poles." + ] + }, + hubble: { + name: "Hubble Space Telescope", agency: "NASA, ESA", years: "Launched 1990", target: "Earth orbit", status: "Still observing", + desc: "Above Earth’s atmosphere, Hubble can see ultraviolet light, which our air blocks. That makes it the main telescope for watching aurora on the giant planets.", + inst: { + mirror: { name: "2.4 m main mirror", text: "Collects light from the planets. Its position above the atmosphere gives sharp images and access to ultraviolet light." }, + stis: { name: "Space Telescope Imaging Spectrograph (STIS)", text: "Takes ultraviolet images and spectra. It photographed the aurora of Jupiter, Saturn and Uranus and the glowing footprints of Jupiter’s moons." }, + acs: { name: "Advanced Camera for Surveys (ACS)", text: "Used with STIS to take long series of aurora images, for example to see how Jupiter’s aurora reacts when the solar wind changes." }, + arrays: { name: "Solar arrays", text: "Power the telescope. Astronauts replaced them during servicing missions." } + }, + saw: [ + "Jupiter’s aurora and the bright spots made by Io, Europa and Ganymede.", + "Saturn’s aurora brightens when gusts of solar wind arrive.", + "The first images of aurora on Uranus (2011).", + "In 2015 the rocking of Ganymede’s aurora showed a salty ocean under its ice.", + "Possible water plumes rising from Europa." + ] + }, + jwst: { + name: "James Webb Space Telescope", agency: "NASA, ESA, CSA", years: "Launched 2021", target: "Sun–Earth L2 point", status: "Observing", + desc: "The largest space telescope, built to see infrared light. That is how the H₃⁺ ion in giant-planet aurora glows, so Webb can watch aurora in great detail.", + inst: { + mirror: { name: "6.5 m gold mirror (18 segments)", text: "Coated with gold to reflect infrared light. Its large size lets Webb see faint aurora on distant Uranus and Neptune." }, + nircam: { name: "Near-infrared camera & spectrograph (NIRCam, NIRSpec)", text: "NIRCam filmed Jupiter’s aurora flickering within seconds. NIRSpec detected Neptune’s aurora for the first time." }, + miri: { name: "Mid-Infrared Instrument (MIRI)", text: "Measures heat from cold objects such as icy moons and the upper atmospheres of the giant planets." }, + sunshield: { name: "Five-layer sunshield", text: "As big as a tennis court. It keeps the telescope colder than −220 °C so its own heat does not drown out the faint infrared light." } + }, + saw: [ + "The first detection of Neptune’s aurora (published 2025).", + "Jupiter’s infrared aurora changing within seconds.", + "A huge plume of water from Enceladus stretching about 10,000 km into space.", + "Carbon dioxide ice on Uranus’s moon Ariel, possibly linked to its magnetosphere." + ] + }, + juice: { + name: "JUICE", agency: "ESA", years: "Launched 2023 · arrives 2031", target: "Jupiter and Ganymede", status: "On its way to Jupiter", + desc: "JUpiter ICy moons Explorer. It will study Jupiter’s magnetosphere and its icy moons, and in 2034 become the first spacecraft to orbit a moon of another planet: Ganymede.", + inst: { + jmag: { name: "Magnetometer (J-MAG) on a 10.6 m boom", text: "Will measure Ganymede’s own magnetic field and the induced signal from its hidden ocean." }, + rpwi: { name: "Radio & Plasma Wave Investigation (RPWI)", text: "Four Langmuir probes and antennas will measure the plasma, electric fields and radio waves around Jupiter and Ganymede." }, + pep: { name: "Particle Environment Package (PEP)", text: "Six sensors will measure ions, electrons and neutral atoms, including pictures of the magnetosphere taken in energetic neutral atoms." }, + optical: { name: "Camera & spectrometers (JANUS, MAJIS, UVS)", text: "Will image the moons’ surfaces and watch the aurora of Jupiter and Ganymede in ultraviolet light." }, + rime: { name: "Ice-penetrating radar (RIME)", text: "A 16 m antenna will see up to 9 km down into the ice of the moons." } + }, + saw: [ + "In 2024 it made the first ever Moon–Earth double flyby and tested its instruments in Earth’s magnetosphere.", + "Still cruising: its main science starts when it arrives at Jupiter in 2031." + ] + }, + clipper: { + name: "Europa Clipper", agency: "NASA", years: "Launched 2024 · arrives 2030", target: "Jupiter and Europa", status: "On its way to Jupiter", + desc: "NASA’s largest planetary spacecraft, with solar arrays over 30 m across. It will fly past Europa about 49 times to find out if its ocean could support life.", + inst: { + ecm: { name: "Europa Clipper Magnetometer (ECM)", text: "Three sensors on an 8.5 m boom will measure the magnetic field induced in Europa’s ocean, to work out how deep and how salty it is." }, + pims: { name: "Plasma Instrument (PIMS)", text: "Measures the plasma around Europa, so scientists can separate its effects from the ocean’s magnetic signal." }, + insitu: { name: "Gas & dust analysers (MASPEX, SUDA)", text: "Will sample gas and dust thrown off Europa’s surface, perhaps from plumes, to learn what the ocean is made of." }, + optical: { name: "Cameras & spectrometers (EIS, Europa-UVS, MISE, E-THEMIS)", text: "Will map the surface in visible, infrared and ultraviolet light and search for plumes and warm spots." }, + reason: { name: "Ice-penetrating radar (REASON)", text: "Long antennas on the solar arrays will look through the ice shell for water pockets and the ocean below." }, + vault: { name: "Radiation vault", text: "Aluminium-zinc walls protect the electronics during each pass through Jupiter’s radiation belts." } + }, + saw: [ + "In 2025 it flew past Mars for a gravity boost and tested its thermal camera and radar.", + "Still cruising: it reaches Jupiter in 2030." + ] + } + } + }, + + /* =========================================================== 简体中文 */ + "zh-Hans": { + nav: { craft: "探测器" }, + sc: { + title: "探索磁层的探测器", + sub: "我们对巨行星磁层的认识,都来自这些机器。选择一个 MOP 2028 会议主题,看看哪些探测器与它相关;再转动 3D 模型,点击编号查看每台仪器的作用。", + themesLabel: "MOP 2028 会议主题", + all: "全部探测器", + agency: "机构", years: "任务", target: "目的地", status: "现况", + instruments: "科学仪器", saw: "它的发现", mopThemes: "MOP 主题", + tapHint: "点击编号标记,或点选列表中的仪器。", + notScale: "简化模型,大小和形状仅供参考。", + future: { title: "下一站:天王星轨道器", text: "MOP 2028 的第 3 个主题讨论下一个旗舰任务的理由与设计。天王星轨道器与探测器是 NASA 最优先的新旗舰任务,将携带磁强计、等离子体与粒子仪器以及极光相机,长期研究天王星倾斜摇摆的磁层。" } + }, + themes: [ + { title: "木星与朱诺号的遗产", text: "磁层动力学、等离子体输运、木卫一环、辐射带,以及朱诺号延伸任务留给 JUICE 的成果。" }, + { title: "后卡西尼时代的土星", text: "光环雨、土卫二羽流等离子体、季节变化,以及卡西尼号“壮丽谢幕”留下的珍贵数据。" }, + { title: "冰巨星:天王星与海王星", text: "倾斜的磁层、海卫一,以及下一个旗舰轨道器的理由与设计。" }, + { title: "卫星与磁层的相互作用", text: "木卫一、木卫二、木卫三、土卫二、土卫六:感应磁场、溅射、羽流、极光足迹与阿尔芬翼。" }, + { title: "极光与高层大气", text: "电离层与热层的耦合、极光无线电辐射与加热,从哈勃、韦布望远镜到就地的磁场与粒子测量。" }, + { title: "巨行星磁层的等离子体物理", text: "磁重联、波动、不稳定性、高能粒子与比较磁层物理。" }, + { title: "JUICE 与欧罗巴快船时代", text: "巡航期间的科学、抵达规划、联合观测与未来的探测器队伍,包括土卫二和天王星任务构想。" }, + { title: "模型、数据与新仪器", text: "全球模拟、开放数据、实验室等离子体研究、新仪器,以及太阳系以外的磁层。" } + ], + crafts: { + voyager: { + name: "旅行者 2 号", agency: "NASA", years: "1977 年发射", target: "木星、土星、天王星、海王星", status: "仍在工作,已进入星际空间", + desc: "唯一到访过四颗巨行星的探测器。它在 1986 年飞掠天王星、1989 年飞掠海王星,至今仍是我们对冰巨星磁层仅有的近距离测量。", + inst: { + mag: { name: "磁强计(MAG)", text: "两个传感器装在 13 米长的支杆上,远离探测器本身的磁性。它们发现天王星和海王星的磁场分别倾斜 59° 和 47°,并且偏离中心。" }, + pls: { name: "等离子体与粒子探测器(PLS、LECP、CRS)", text: "统计每颗行星周围的离子和电子,从缓慢的太阳风到高速的辐射带粒子。" }, + radio: { name: "无线电与等离子体波天线(PRA、PWS)", text: "两根 10 米长的天线收听来自极光区的无线电辐射。信号的重复规律首次测出天王星和海王星的自转周期。" }, + scan: { name: "扫描平台:相机与紫外光谱仪", text: "相机拍到木卫一的火山和海卫一的喷泉;紫外光谱仪探测到天王星和海王星的极光。" }, + rtg: { name: "放射性同位素发电机(RTG)", text: "离太阳太远,阳光太弱,所以靠三台钚-238 发电机供电。电力逐渐减弱,仪器正一台台关闭。" }, + record: { name: "金唱片", text: "一张镀金铜唱片,载有地球的声音和图像,送给可能发现探测器的“人”。" } + }, + saw: [ + "旅行者 1 号在 1979 年发现木卫一的活火山,它们正是木星等离子体环的来源。", + "天王星磁场倾斜 59°,磁尾随着行星自转扭成螺旋状。", + "海王星磁场倾斜 47°,偏离中心超过半个行星半径。", + "海卫一上喷发的氮气喷泉。", + "2018 年穿越日球层顶,进入星际空间。" + ] + }, + galileo: { + name: "伽利略号", agency: "NASA", years: "1989 – 2003", target: "木星", status: "已结束:2003 年坠入木星,以保护木卫二", + desc: "首个环绕木星运行的探测器。它在木星磁层中工作近 8 年,发现部分卫星藏有海洋。", + inst: { + mag: { name: "磁强计(MAG),装在 11 米支杆上", text: "发现木星磁场扫过时,木卫二和木卫四会产生自己的磁信号,说明冰层下有导电的咸水海洋;还发现木卫三拥有自己的磁场。" }, + epd: { name: "高能粒子探测器(EPD)", text: "测量木星辐射带中的高速离子和电子,以及它们如何轰击冰卫星。" }, + scan: { name: "相机与光谱仪(SSI、NIMS、UVS)", text: "拍下木卫一的喷发、木卫二布满裂纹的表面,以及木卫一环的紫外辉光。" }, + hga: { name: "高增益天线(未能打开)", text: "4.8 米的伞状天线一直没有完全展开。工程师改用小型低增益天线和新的数据压缩软件,拯救了任务。" }, + probe: { name: "大气探测器", text: "1995 年释放,乘降落伞进入木星,测量大气 58 分钟后被压毁。" } + }, + saw: [ + "木卫三在木星磁层内拥有自己的磁层,是已知唯一拥有磁层的卫星。", + "感应磁场揭示木卫二和木卫四冰层下的咸水海洋。", + "木卫一的火山活动远超预期,熔岩比今天地球上的更热。", + "连接木卫一与木星大气的等离子体波和电子束。" + ] + }, + cassini: { + name: "卡西尼–惠更斯号", agency: "NASA、欧空局、意大利航天局", years: "1997 – 2017", target: "土星与土卫六", status: "已结束:2017 年冲入土星", + desc: "环绕土星 13 年。最后 22 圈“壮丽谢幕”穿越土星与光环之间,是从未有探测器去过的地方。", + inst: { + mag: { name: "磁强计(MAG),装在 11 米支杆上", text: "2005 年发现土星磁场在土卫二附近弯曲,从而发现了羽流。在“壮丽谢幕”中,它显示土星磁轴几乎与自转轴完全重合。" }, + mimi: { name: "磁层成像仪(MIMI)", text: "利用高能中性原子为看不见的磁层“拍照”,显示热等离子体云被注入并绕土星旋转。" }, + inms: { name: "离子与中性质谱仪(INMS)", text: "“品尝”土卫二羽流中的气体(水、盐、有机分子和氢),并在“壮丽谢幕”中测量从光环落入土星的物质。" }, + uvis: { name: "紫外成像光谱仪(UVIS)", text: "拍摄土星的紫外极光,以及环绕土星的氧和水气云。" }, + rpws: { name: "无线电与等离子体波科学仪(RPWS)", text: "三根 10 米天线记录来自极光的土星千米波辐射,发现其节奏会随时间变化,而且南北不同。" }, + huygens: { name: "惠更斯号探测器(欧空局)", text: "2005 年 1 月 14 日登陆土卫六,是人类最遥远的着陆,传回河道和冰卵石的照片。" } + }, + saw: [ + "土卫二从地下海洋喷出水,是土星磁层等离子体的主要来源。", + "光环中的带电粒子和尘埃像雨一样落入土星大气。", + "土星的无线电“一天”不断变化,所以很难测出它一天的长度。", + "土卫六的大气与土星等离子体相互作用,产生复杂的有机分子。" + ] + }, + juno: { + name: "朱诺号", agency: "NASA", years: "2011 年发射 · 2016 年起环绕木星", target: "木星", status: "环绕木星(延伸任务)", + desc: "一艘太阳能探测器,沿极轨道运行,是第一个直接飞越木星两极、穿过极光诞生区域的探测器。", + inst: { + mag: { name: "磁强计(MAG)", text: "装在太阳能翼末端的两个传感器以前所未有的精度绘制木星磁场,发现磁场凹凸不平,赤道附近还有一个被称为“大蓝斑”的强磁区。" }, + particles: { name: "粒子探测器(JADE、JEDI)", text: "测量落入大气、产生极光的电子和离子。部分电子被加速到远高于地球情况的能量。" }, + uvs: { name: "极光相机(UVS、JIRAM)", text: "紫外光谱仪和红外成像仪从两极上空拍摄极光,揭示木卫一、木卫二和木卫三极光足迹的精细结构。" }, + waves: { name: "Waves 无线电与等离子体波天线", text: "在飞越极光上空的辐射源区时,收听木星的无线电辐射。" }, + mwr: { name: "微波辐射计(MWR)", text: "六组天线可看穿云层数百公里,测量水和氨。" }, + vault: { name: "钛金属辐射保险箱", text: "主要电子设备放在约 1 厘米厚的钛壁箱子里(约 200 公斤),以抵御木星的辐射带。" } + }, + saw: [ + "木星极光由同时向下和向上加速的电子供能,与地球极光的机制不同。", + "在赤道附近、紧贴木星大气上方发现一个新的辐射区。", + "木星磁场比预期不均匀得多,而且会随时间缓慢变化。", + "木卫一、木卫二和木卫三极光足迹的近距离图像。", + "两极周围成群的巨型气旋。" + ] + }, + hubble: { + name: "哈勃空间望远镜", agency: "NASA、欧空局", years: "1990 年发射", target: "地球轨道", status: "仍在观测", + desc: "哈勃位于地球大气之上,可以看到被空气阻挡的紫外线,因此是观察巨行星极光的主要望远镜。", + inst: { + mirror: { name: "2.4 米主镜", text: "收集来自行星的光。位于大气之上,影像清晰,而且看得到紫外线。" }, + stis: { name: "空间望远镜成像光谱仪(STIS)", text: "拍摄紫外图像和光谱,拍到木星、土星和天王星的极光,以及木星卫星的发光足迹。" }, + acs: { name: "高级巡天相机(ACS)", text: "与 STIS 一起拍摄长时间的极光序列,例如观察太阳风变化时木星极光的反应。" }, + arrays: { name: "太阳能电池板", text: "为望远镜供电,宇航员曾在维修任务中更换。" } + }, + saw: [ + "木星极光,以及木卫一、木卫二和木卫三造成的光点。", + "太阳风阵风到达时,土星极光会增亮。", + "首次拍到天王星的极光(2011 年)。", + "2015 年,木卫三极光的摆动显示冰层下有咸水海洋。", + "木卫二可能喷出的水羽流。" + ] + }, + jwst: { + name: "詹姆斯·韦布空间望远镜", agency: "NASA、欧空局、加拿大航天局", years: "2021 年发射", target: "日地 L2 点", status: "正在观测", + desc: "最大的空间望远镜,专门观测红外线。巨行星极光中的 H₃⁺ 离子正是发出红外光,所以韦布能细致地观察极光。", + inst: { + mirror: { name: "6.5 米镀金主镜(18 块)", text: "镀金以反射红外线。巨大的镜面让韦布看得到遥远的天王星和海王星上微弱的极光。" }, + nircam: { name: "近红外相机与光谱仪(NIRCam、NIRSpec)", text: "NIRCam 拍到木星极光在几秒内闪烁变化;NIRSpec 首次探测到海王星的极光。" }, + miri: { name: "中红外仪器(MIRI)", text: "测量冰卫星和巨行星高层大气等寒冷天体发出的热。" }, + sunshield: { name: "五层遮阳罩", text: "面积与网球场相若,令望远镜保持在 −220 °C 以下,避免自身的热掩盖微弱的红外光。" } + }, + saw: [ + "首次探测到海王星的极光(2025 年发表)。", + "木星的红外极光在几秒内变化。", + "土卫二喷出约 10,000 公里长的巨大水羽流。", + "天卫一表面的二氧化碳冰,可能与天王星磁层有关。" + ] + }, + juice: { + name: "JUICE 木星冰卫星探测器", agency: "欧空局", years: "2023 年发射 · 2031 年到达", target: "木星与木卫三", status: "正前往木星", + desc: "将研究木星磁层和冰卫星,并于 2034 年成为首个环绕其他行星卫星(木卫三)运行的探测器。", + inst: { + jmag: { name: "磁强计(J-MAG),装在 10.6 米支杆上", text: "将测量木卫三自身的磁场,以及隐藏海洋产生的感应磁信号。" }, + rpwi: { name: "无线电与等离子体波探测仪(RPWI)", text: "四个朗缪尔探针和天线将测量木星和木卫三周围的等离子体、电场与无线电波。" }, + pep: { name: "粒子环境套件(PEP)", text: "六个传感器测量离子、电子和中性原子,并以高能中性原子为磁层成像。" }, + optical: { name: "相机与光谱仪(JANUS、MAJIS、UVS)", text: "将拍摄卫星表面,并以紫外线观察木星和木卫三的极光。" }, + rime: { name: "冰层穿透雷达(RIME)", text: "16 米长的天线可看穿卫星冰层下深达 9 公里。" } + }, + saw: [ + "2024 年完成史上首次月球–地球双重飞掠,并在地球磁层中测试仪器。", + "仍在巡航:2031 年到达木星后才开始主要科学任务。" + ] + }, + clipper: { + name: "欧罗巴快船", agency: "NASA", years: "2024 年发射 · 2030 年到达", target: "木星与木卫二", status: "正前往木星", + desc: "NASA 最大的行星探测器,太阳能翼展超过 30 米。它将飞掠木卫二约 49 次,研究其海洋是否适合生命。", + inst: { + ecm: { name: "欧罗巴快船磁强计(ECM)", text: "装在 8.5 米支杆上的三个传感器,将测量木卫二海洋的感应磁场,推算海洋的深度和咸度。" }, + pims: { name: "等离子体仪器(PIMS)", text: "测量木卫二周围的等离子体,让科学家把它的影响与海洋的磁信号区分开。" }, + insitu: { name: "气体与尘埃分析仪(MASPEX、SUDA)", text: "采集木卫二表面(甚至羽流)抛出的气体和尘埃,了解海洋的成分。" }, + optical: { name: "相机与光谱仪(EIS、Europa-UVS、MISE、E-THEMIS)", text: "以可见光、红外和紫外线绘制表面地图,寻找羽流和温暖的地点。" }, + reason: { name: "冰层穿透雷达(REASON)", text: "装在太阳能翼上的长天线将透视冰壳,寻找水囊和下面的海洋。" }, + vault: { name: "辐射保险箱", text: "铝锌合金外壳在每次穿越木星辐射带时保护电子设备。" } + }, + saw: [ + "2025 年飞掠火星借力,并测试了热成像相机和雷达。", + "仍在巡航:2030 年到达木星。" + ] + } + } + }, + + /* =========================================================== 繁體中文 */ + "zh-Hant": { + nav: { craft: "探測器" }, + sc: { + title: "探索磁層的探測器", + sub: "我們對巨行星磁層的認識,都來自這些機器。選擇一個 MOP 2028 會議主題,看看哪些探測器與它相關;再轉動 3D 模型,點擊編號查看每台儀器的作用。", + themesLabel: "MOP 2028 會議主題", + all: "全部探測器", + agency: "機構", years: "任務", target: "目的地", status: "現況", + instruments: "科學儀器", saw: "它的發現", mopThemes: "MOP 主題", + tapHint: "點擊編號標記,或點選列表中的儀器。", + notScale: "簡化模型,大小和形狀僅供參考。", + future: { title: "下一站:天王星軌道器", text: "MOP 2028 的第 3 個主題討論下一個旗艦任務的理由與設計。天王星軌道器與探測器是 NASA 最優先的新旗艦任務,將攜帶磁強計、等離子體與粒子儀器以及極光相機,長期研究天王星傾斜搖擺的磁層。" } + }, + themes: [ + { title: "木星與朱諾號的遺產", text: "磁層動力學、等離子體輸運、木衛一環、輻射帶,以及朱諾號延伸任務留給 JUICE 的成果。" }, + { title: "後卡西尼時代的土星", text: "光環雨、土衛二羽流等離子體、季節變化,以及卡西尼號「壯麗謝幕」留下的珍貴數據。" }, + { title: "冰巨星:天王星與海王星", text: "傾斜的磁層、海衛一,以及下一個旗艦軌道器的理由與設計。" }, + { title: "衛星與磁層的相互作用", text: "木衛一、木衛二、木衛三、土衛二、土衛六:感應磁場、濺射、羽流、極光足跡與阿爾芬翼。" }, + { title: "極光與高層大氣", text: "電離層與熱層的耦合、極光無線電輻射與加熱,從哈勃、韋伯望遠鏡到就地的磁場與粒子測量。" }, + { title: "巨行星磁層的等離子體物理", text: "磁重聯、波動、不穩定性、高能粒子與比較磁層物理。" }, + { title: "JUICE 與歐羅巴快船時代", text: "巡航期間的科學、抵達規劃、聯合觀測與未來的探測器隊伍,包括土衛二和天王星任務構想。" }, + { title: "模型、數據與新儀器", text: "全球模擬、開放數據、實驗室等離子體研究、新儀器,以及太陽系以外的磁層。" } + ], + crafts: { + voyager: { + name: "航海家 2 號", agency: "NASA", years: "1977 年發射", target: "木星、土星、天王星、海王星", status: "仍在工作,已進入星際空間", + desc: "唯一到訪過四顆巨行星的探測器。它在 1986 年飛掠天王星、1989 年飛掠海王星,至今仍是我們對冰巨星磁層僅有的近距離測量。", + inst: { + mag: { name: "磁強計(MAG)", text: "兩個感測器裝在 13 米長的支桿上,遠離探測器本身的磁性。它們發現天王星和海王星的磁場分別傾斜 59° 和 47°,並且偏離中心。" }, + pls: { name: "等離子體與粒子探測器(PLS、LECP、CRS)", text: "統計每顆行星周圍的離子和電子,從緩慢的太陽風到高速的輻射帶粒子。" }, + radio: { name: "無線電與等離子體波天線(PRA、PWS)", text: "兩根 10 米長的天線收聽來自極光區的無線電輻射。訊號的重複規律首次測出天王星和海王星的自轉周期。" }, + scan: { name: "掃描平台:相機與紫外光譜儀", text: "相機拍到木衛一的火山和海衛一的噴泉;紫外光譜儀探測到天王星和海王星的極光。" }, + rtg: { name: "放射性同位素發電機(RTG)", text: "離太陽太遠,陽光太弱,所以靠三台鈽-238 發電機供電。電力逐漸減弱,儀器正一台台關閉。" }, + record: { name: "金唱片", text: "一張鍍金銅唱片,載有地球的聲音和圖像,送給可能發現探測器的「人」。" } + }, + saw: [ + "航海家 1 號在 1979 年發現木衛一的活火山,它們正是木星等離子體環的來源。", + "天王星磁場傾斜 59°,磁尾隨著行星自轉扭成螺旋狀。", + "海王星磁場傾斜 47°,偏離中心超過半個行星半徑。", + "海衛一上噴發的氮氣噴泉。", + "2018 年穿越日球層頂,進入星際空間。" + ] + }, + galileo: { + name: "伽利略號", agency: "NASA", years: "1989 – 2003", target: "木星", status: "已結束:2003 年墜入木星,以保護木衛二", + desc: "首個環繞木星運行的探測器。它在木星磁層中工作近 8 年,發現部分衛星藏有海洋。", + inst: { + mag: { name: "磁強計(MAG),裝在 11 米支桿上", text: "發現木星磁場掃過時,木衛二和木衛四會產生自己的磁訊號,說明冰層下有導電的鹹水海洋;還發現木衛三擁有自己的磁場。" }, + epd: { name: "高能粒子探測器(EPD)", text: "測量木星輻射帶中的高速離子和電子,以及它們如何轟擊冰衛星。" }, + scan: { name: "相機與光譜儀(SSI、NIMS、UVS)", text: "拍下木衛一的噴發、木衛二佈滿裂紋的表面,以及木衛一環的紫外輝光。" }, + hga: { name: "高增益天線(未能打開)", text: "4.8 米的傘狀天線一直沒有完全展開。工程師改用小型低增益天線和新的數據壓縮軟件,拯救了任務。" }, + probe: { name: "大氣探測器", text: "1995 年釋放,乘降落傘進入木星,測量大氣 58 分鐘後被壓毀。" } + }, + saw: [ + "木衛三在木星磁層內擁有自己的磁層,是已知唯一擁有磁層的衛星。", + "感應磁場揭示木衛二和木衛四冰層下的鹹水海洋。", + "木衛一的火山活動遠超預期,熔岩比今天地球上的更熱。", + "連接木衛一與木星大氣的等離子體波和電子束。" + ] + }, + cassini: { + name: "卡西尼–惠更斯號", agency: "NASA、歐洲太空總署、意大利太空總署", years: "1997 – 2017", target: "土星與土衛六", status: "已結束:2017 年衝入土星", + desc: "環繞土星 13 年。最後 22 圈「壯麗謝幕」穿越土星與光環之間,是從未有探測器去過的地方。", + inst: { + mag: { name: "磁強計(MAG),裝在 11 米支桿上", text: "2005 年發現土星磁場在土衛二附近彎曲,從而發現了羽流。在「壯麗謝幕」中,它顯示土星磁軸幾乎與自轉軸完全重合。" }, + mimi: { name: "磁層成像儀(MIMI)", text: "利用高能中性原子為看不見的磁層「拍照」,顯示熱等離子體雲被注入並繞土星旋轉。" }, + inms: { name: "離子與中性質譜儀(INMS)", text: "「品嚐」土衛二羽流中的氣體(水、鹽、有機分子和氫),並在「壯麗謝幕」中測量從光環落入土星的物質。" }, + uvis: { name: "紫外成像光譜儀(UVIS)", text: "拍攝土星的紫外極光,以及環繞土星的氧和水氣雲。" }, + rpws: { name: "無線電與等離子體波科學儀(RPWS)", text: "三根 10 米天線記錄來自極光的土星千米波輻射,發現其節奏會隨時間變化,而且南北不同。" }, + huygens: { name: "惠更斯號探測器(歐洲太空總署)", text: "2005 年 1 月 14 日登陸土衛六,是人類最遙遠的著陸,傳回河道和冰卵石的照片。" } + }, + saw: [ + "土衛二從地下海洋噴出水,是土星磁層等離子體的主要來源。", + "光環中的帶電粒子和塵埃像雨一樣落入土星大氣。", + "土星的無線電「一天」不斷變化,所以很難測出它一天的長度。", + "土衛六的大氣與土星等離子體相互作用,產生複雜的有機分子。" + ] + }, + juno: { + name: "朱諾號", agency: "NASA", years: "2011 年發射 · 2016 年起環繞木星", target: "木星", status: "環繞木星(延伸任務)", + desc: "一艘太陽能探測器,沿極軌道運行,是第一個直接飛越木星兩極、穿過極光誕生區域的探測器。", + inst: { + mag: { name: "磁強計(MAG)", text: "裝在太陽能翼末端的兩個感測器以前所未有的精度繪製木星磁場,發現磁場凹凸不平,赤道附近還有一個被稱為「大藍斑」的強磁區。" }, + particles: { name: "粒子探測器(JADE、JEDI)", text: "測量落入大氣、產生極光的電子和離子。部分電子被加速到遠高於地球情況的能量。" }, + uvs: { name: "極光相機(UVS、JIRAM)", text: "紫外光譜儀和紅外成像儀從兩極上空拍攝極光,揭示木衛一、木衛二和木衛三極光足跡的精細結構。" }, + waves: { name: "Waves 無線電與等離子體波天線", text: "在飛越極光上空的輻射源區時,收聽木星的無線電輻射。" }, + mwr: { name: "微波輻射計(MWR)", text: "六組天線可看穿雲層數百公里,測量水和氨。" }, + vault: { name: "鈦金屬輻射保險箱", text: "主要電子設備放在約 1 厘米厚的鈦壁箱子裡(約 200 公斤),以抵禦木星的輻射帶。" } + }, + saw: [ + "木星極光由同時向下和向上加速的電子供能,與地球極光的機制不同。", + "在赤道附近、緊貼木星大氣上方發現一個新的輻射區。", + "木星磁場比預期不均勻得多,而且會隨時間緩慢變化。", + "木衛一、木衛二和木衛三極光足跡的近距離圖像。", + "兩極周圍成群的巨型氣旋。" + ] + }, + hubble: { + name: "哈勃太空望遠鏡", agency: "NASA、歐洲太空總署", years: "1990 年發射", target: "地球軌道", status: "仍在觀測", + desc: "哈勃位於地球大氣之上,可以看到被空氣阻擋的紫外線,因此是觀察巨行星極光的主要望遠鏡。", + inst: { + mirror: { name: "2.4 米主鏡", text: "收集來自行星的光。位於大氣之上,影像清晰,而且看得到紫外線。" }, + stis: { name: "太空望遠鏡成像光譜儀(STIS)", text: "拍攝紫外圖像和光譜,拍到木星、土星和天王星的極光,以及木星衛星的發光足跡。" }, + acs: { name: "高級巡天相機(ACS)", text: "與 STIS 一起拍攝長時間的極光序列,例如觀察太陽風變化時木星極光的反應。" }, + arrays: { name: "太陽能電池板", text: "為望遠鏡供電,太空人曾在維修任務中更換。" } + }, + saw: [ + "木星極光,以及木衛一、木衛二和木衛三造成的光點。", + "太陽風陣風到達時,土星極光會增亮。", + "首次拍到天王星的極光(2011 年)。", + "2015 年,木衛三極光的擺動顯示冰層下有鹹水海洋。", + "木衛二可能噴出的水羽流。" + ] + }, + jwst: { + name: "韋伯太空望遠鏡", agency: "NASA、歐洲太空總署、加拿大太空總署", years: "2021 年發射", target: "日地 L2 點", status: "正在觀測", + desc: "最大的太空望遠鏡,專門觀測紅外線。巨行星極光中的 H₃⁺ 離子正是發出紅外光,所以韋伯能細緻地觀察極光。", + inst: { + mirror: { name: "6.5 米鍍金主鏡(18 塊)", text: "鍍金以反射紅外線。巨大的鏡面讓韋伯看得到遙遠的天王星和海王星上微弱的極光。" }, + nircam: { name: "近紅外相機與光譜儀(NIRCam、NIRSpec)", text: "NIRCam 拍到木星極光在幾秒內閃爍變化;NIRSpec 首次探測到海王星的極光。" }, + miri: { name: "中紅外儀器(MIRI)", text: "測量冰衛星和巨行星高層大氣等寒冷天體發出的熱。" }, + sunshield: { name: "五層遮陽罩", text: "面積與網球場相若,令望遠鏡保持在 −220 °C 以下,避免自身的熱掩蓋微弱的紅外光。" } + }, + saw: [ + "首次探測到海王星的極光(2025 年發表)。", + "木星的紅外極光在幾秒內變化。", + "土衛二噴出約 10,000 公里長的巨大水羽流。", + "天衛一表面的二氧化碳冰,可能與天王星磁層有關。" + ] + }, + juice: { + name: "JUICE 木星冰月探測器", agency: "歐洲太空總署", years: "2023 年發射 · 2031 年到達", target: "木星與木衛三", status: "正前往木星", + desc: "將研究木星磁層和冰衛星,並於 2034 年成為首個環繞其他行星衛星(木衛三)運行的探測器。", + inst: { + jmag: { name: "磁強計(J-MAG),裝在 10.6 米支桿上", text: "將測量木衛三自身的磁場,以及隱藏海洋產生的感應磁訊號。" }, + rpwi: { name: "無線電與等離子體波探測儀(RPWI)", text: "四個朗繆爾探針和天線將測量木星和木衛三周圍的等離子體、電場與無線電波。" }, + pep: { name: "粒子環境套件(PEP)", text: "六個感測器測量離子、電子和中性原子,並以高能中性原子為磁層成像。" }, + optical: { name: "相機與光譜儀(JANUS、MAJIS、UVS)", text: "將拍攝衛星表面,並以紫外線觀察木星和木衛三的極光。" }, + rime: { name: "冰層穿透雷達(RIME)", text: "16 米長的天線可看穿衛星冰層下深達 9 公里。" } + }, + saw: [ + "2024 年完成史上首次月球–地球雙重飛掠,並在地球磁層中測試儀器。", + "仍在巡航:2031 年到達木星後才開始主要科學任務。" + ] + }, + clipper: { + name: "歐羅巴快船", agency: "NASA", years: "2024 年發射 · 2030 年到達", target: "木星與木衛二", status: "正前往木星", + desc: "NASA 最大的行星探測器,太陽能翼展超過 30 米。它將飛掠木衛二約 49 次,研究其海洋是否適合生命。", + inst: { + ecm: { name: "歐羅巴快船磁強計(ECM)", text: "裝在 8.5 米支桿上的三個感測器,將測量木衛二海洋的感應磁場,推算海洋的深度和鹹度。" }, + pims: { name: "等離子體儀器(PIMS)", text: "測量木衛二周圍的等離子體,讓科學家把它的影響與海洋的磁訊號區分開。" }, + insitu: { name: "氣體與塵埃分析儀(MASPEX、SUDA)", text: "採集木衛二表面(甚至羽流)拋出的氣體和塵埃,了解海洋的成分。" }, + optical: { name: "相機與光譜儀(EIS、Europa-UVS、MISE、E-THEMIS)", text: "以可見光、紅外和紫外線繪製表面地圖,尋找羽流和溫暖的地點。" }, + reason: { name: "冰層穿透雷達(REASON)", text: "裝在太陽能翼上的長天線將透視冰殼,尋找水囊和下面的海洋。" }, + vault: { name: "輻射保險箱", text: "鋁鋅合金外殼在每次穿越木星輻射帶時保護電子設備。" } + }, + saw: [ + "2025 年飛掠火星借力,並測試了熱成像相機和雷達。", + "仍在巡航:2030 年到達木星。" + ] + } + } + } +}; diff --git a/js/i18n_moons.js b/js/i18n_moons.js new file mode 100644 index 0000000000000000000000000000000000000000..fd6ba5cfa734d064adaf2ca48238a6d9daca3874 --- /dev/null +++ b/js/i18n_moons.js @@ -0,0 +1,123 @@ +// Moon names, descriptions and the moon section text, merged into I18N by main.js. + +export const MOON_I18N = { + en: { + nav: { moons: "Moons" }, + moons: { + moon: "Moon", io: "Io", europa: "Europa", ganymede: "Ganymede", callisto: "Callisto", + mimas: "Mimas", enceladus: "Enceladus", tethys: "Tethys", dione: "Dione", rhea: "Rhea", titan: "Titan", iapetus: "Iapetus", + miranda: "Miranda", ariel: "Ariel", umbriel: "Umbriel", titania: "Titania", oberon: "Oberon", triton: "Triton" + }, + mn: { + title: "Moons inside the magnetospheres", + sub: "The giant planets’ moons sit inside their magnetic bubbles. Some feed them with gas, some glow in their own aurora, and some hide oceans that the magnetic field helps us find. Spin a globe, then fly to the moon in 3D. You can also click any moon in the 3D explorer.", + fly: "Fly to it in 3D", + back: "← Back to planet", + dia: "Diameter", dist: "Distance from planet", period: "Orbit period", host: "Orbits", + days: "days", retro: "backwards (retrograde)", km: "km", + clickHint: "Tip: click a moon in 3D to learn about it.", + roleTitle: "In the magnetosphere" + }, + mo: { + moon: { tag: "Earth’s only natural satellite", text: "The Moon has no global magnetic field and almost no atmosphere, so the solar wind hits its surface directly. For a few days each month it passes through Earth’s magnetotail, where it is bathed in plasma from Earth instead." }, + io: { tag: "Volcano world · plasma source", text: "The most volcanic world in the solar system. Its volcanoes release about one tonne of gas every second, which is ionised to form the Io plasma torus. As Jupiter’s field sweeps past, Io drives an electric current of millions of amperes along its flux tube, leaving a bright auroral footprint in Jupiter’s atmosphere." }, + europa: { tag: "Ocean world", text: "A salty ocean lies beneath its icy shell. Galileo found the ocean through the magnetic field it induces as Jupiter’s field sweeps past. Radiation splits the surface ice and makes a thin oxygen atmosphere. Europa Clipper will study it from 2030." }, + ganymede: { tag: "The moon with its own magnetosphere", text: "The largest moon in the solar system, and the only one with its own magnetic field: a mini-magnetosphere inside Jupiter’s, with its own aurora. In 2015 Hubble watched those aurora rock back and forth less than expected, revealing a salty ocean beneath the ice. JUICE will orbit Ganymede from 2034." }, + callisto: { tag: "Ancient cratered world", text: "One of the most heavily cratered surfaces in the solar system. Galileo detected a magnetic signal induced inside Callisto, a hint that a deep salty ocean may exist. It lies outside Jupiter’s main radiation belts, so it would be a safer place for future explorers." }, + mimas: { tag: "The ‘Death Star’ moon", text: "The giant Herschel crater makes Mimas look like the Death Star. Its gravity helps shape the Cassini Division in Saturn’s rings, and in 2024 scientists reported that it may hide a young ocean." }, + enceladus: { tag: "Geysers · main plasma source", text: "Geysers near its south pole spray water vapour and ice into space from an ocean below. This water is the main source of plasma in Saturn’s magnetosphere and feeds the E ring. Cassini flew through the plumes and tasted salts and organic molecules." }, + tethys: { tag: "Icy moon in the plasma", text: "An icy moon with a huge canyon, Ithaca Chasma. Electrons from Saturn’s magnetosphere bombard its surface and change its colour and brightness in patterns that follow the plasma flow." }, + dione: { tag: "Thin oxygen atmosphere", text: "Cassini found a very thin layer of oxygen around Dione, made when charged particles and sunlight split water ice. Dione may also have an ocean deep below its crust." }, + rhea: { tag: "Saturn’s second-largest moon", text: "In 2010 Cassini detected a thin atmosphere of oxygen and carbon dioxide around Rhea, kept topped up as Saturn’s magnetospheric particles hit its icy surface." }, + titan: { tag: "Thick atmosphere, methane lakes", text: "Larger than Mercury, with a thick nitrogen atmosphere and lakes of liquid methane. It has no magnetic field of its own, so Saturn’s field and plasma drape around its atmosphere. Huygens landed in 2005, and NASA’s Dragonfly drone is planned to arrive in the 2030s." }, + iapetus: { tag: "The two-tone moon", text: "Half bright and half dark, with a tall ridge around its equator. It orbits so far from Saturn that it spends its time outside the magnetosphere, in the solar wind." }, + miranda: { tag: "Patchwork world", text: "A jumble of giant cliffs and grooves. Verona Rupes may be the tallest cliff in the solar system, about 20 km high. Voyager 2 photographed it in 1986." }, + ariel: { tag: "CO₂ ice from the magnetosphere?", text: "The brightest of Uranus’s large moons, crossed by young canyons. JWST found carbon dioxide ice concentrated on one side, possibly made by charged particles from Uranus’s magnetosphere hitting the surface." }, + umbriel: { tag: "The darkest moon of Uranus", text: "The darkest of Uranus’s large moons, with a mysterious bright ring called Wunda near its equator." }, + titania: { tag: "Uranus’s largest moon", text: "Titania may hold a thin ocean between its rocky core and icy crust, which makes it a key target for a future Uranus orbiter and its magnetometer." }, + oberon: { tag: "In and out of the magnetosphere", text: "The outermost large moon of Uranus. Part of its orbit lies beyond the magnetopause, so its surface is exposed to both the solar wind and Uranus’s magnetospheric plasma." }, + triton: { tag: "Captured world with geysers", text: "Probably a captured Kuiper Belt object, because it orbits backwards. Voyager 2 saw nitrogen geysers in 1989. Neptune’s tilted field sweeps over Triton as the planet spins, and its atmosphere may supply nitrogen to Neptune’s magnetosphere. It may also hide an ocean." } + }, + ft: { tex: "Planet and Moon textures: Solar System Scope (CC BY 4.0), based on NASA imagery. Moon mosaics: NASA/JPL/USGS (Galileo, Cassini, Voyager), via NOAA Science On a Sphere." } + }, + + "zh-Hans": { + nav: { moons: "卫星" }, + moons: { + moon: "月球", io: "木卫一", europa: "木卫二", ganymede: "木卫三", callisto: "木卫四", + mimas: "土卫一", enceladus: "土卫二", tethys: "土卫三", dione: "土卫四", rhea: "土卫五", titan: "土卫六", iapetus: "土卫八", + miranda: "天卫五", ariel: "天卫一", umbriel: "天卫二", titania: "天卫三", oberon: "天卫四", triton: "海卫一" + }, + mn: { + title: "磁层中的卫星", + sub: "巨行星的卫星都处在磁“泡泡”之中:有的为磁层提供气体,有的拥有自己的极光,有的藏着海洋,而磁场正是帮助我们找到海洋的线索。转动下面的星球,再在 3D 中飞过去看看。你也可以在 3D 探索中直接点击任何卫星。", + fly: "在 3D 中飞过去", + back: "← 返回行星", + dia: "直径", dist: "与行星距离", period: "公转周期", host: "环绕", + days: "天", retro: "逆向公转", km: "公里", + clickHint: "提示:在 3D 中点击卫星即可查看介绍。", + roleTitle: "在磁层中的角色" + }, + mo: { + moon: { full: "月球", tag: "地球唯一的天然卫星", text: "月球没有全球磁场,也几乎没有大气,太阳风直接打在它的表面。每个月有几天,月球会穿过地球的磁尾,改为沐浴在来自地球的等离子体中。" }, + io: { full: "木卫一(艾奥)", tag: "火山世界 · 等离子体来源", text: "太阳系中火山活动最剧烈的天体。火山每秒释放约一吨气体,气体被电离后形成木卫一等离子体环。当木星磁场扫过时,木卫一沿着磁通管驱动高达数百万安培的电流,在木星大气中留下明亮的极光“足迹”。" }, + europa: { full: "木卫二(欧罗巴)", tag: "海洋世界", text: "冰壳之下有一片咸水海洋。伽利略号通过木星磁场扫过时海洋感应出的磁场发现了它。辐射分解表面的冰,形成稀薄的氧气大气。欧罗巴快船将于 2030 年起研究它。" }, + ganymede: { full: "木卫三(盖尼米得)", tag: "拥有自己磁层的卫星", text: "太阳系最大的卫星,也是唯一拥有自身磁场的卫星:在木星磁层之内还有一个迷你磁层,并有自己的极光。2015 年,哈勃发现这些极光的摆动比预期小,揭示冰层下有咸水海洋。JUICE 将于 2034 年起环绕木卫三运行。" }, + callisto: { full: "木卫四(卡利斯托)", tag: "古老的陨石坑世界", text: "太阳系中陨石坑最密集的表面之一。伽利略号在木卫四内部探测到感应磁场信号,暗示可能存在深层咸水海洋。它位于木星主要辐射带之外,对未来的探索者来说较为安全。" }, + mimas: { full: "土卫一(弥玛斯)", tag: "“死星”卫星", text: "巨大的赫歇尔陨石坑令它看起来像电影中的“死星”。它的引力帮助塑造了土星光环中的卡西尼缝;2024 年科学家报告它可能藏有一个年轻的海洋。" }, + enceladus: { full: "土卫二(恩克拉多斯)", tag: "喷泉 · 主要等离子体来源", text: "南极附近的喷泉把下方海洋的水汽和冰粒喷向太空。这些水是土星磁层等离子体的主要来源,也补充了 E 环。卡西尼号曾穿过羽流,“尝”到盐分和有机分子。" }, + tethys: { full: "土卫三(特提斯)", tag: "等离子体中的冰卫星", text: "拥有巨大峡谷“伊萨卡深谷”的冰卫星。土星磁层的电子轰击它的表面,按照等离子体流动的方向改变表面的颜色和亮度。" }, + dione: { full: "土卫四(狄俄涅)", tag: "稀薄的氧气大气", text: "卡西尼号在土卫四周围发现极稀薄的氧气层,是带电粒子和阳光分解水冰而成。土卫四的地壳深处也可能有海洋。" }, + rhea: { full: "土卫五(瑞亚)", tag: "土星第二大卫星", text: "2010 年,卡西尼号在土卫五周围探测到由氧和二氧化碳组成的稀薄大气,土星磁层粒子撞击冰面不断为它补充气体。" }, + titan: { full: "土卫六(泰坦)", tag: "浓厚大气与甲烷湖", text: "比水星还大,拥有浓厚的氮气大气和液态甲烷湖。它没有自己的磁场,所以土星的磁场和等离子体会包裹着它的大气。惠更斯号于 2005 年着陆,NASA 的“蜻蜓号”无人机计划在 2030 年代抵达。" }, + iapetus: { full: "土卫八(伊阿珀托斯)", tag: "黑白双色卫星", text: "一半明亮、一半黝黑,赤道上还有一道高耸的山脊。它离土星很远,大部分时间位于磁层之外的太阳风中。" }, + miranda: { full: "天卫五(米兰达)", tag: "拼凑而成的世界", text: "布满巨大悬崖和沟槽。维罗纳断崖高约 20 公里,可能是太阳系最高的悬崖。旅行者 2 号在 1986 年拍下了它。" }, + ariel: { full: "天卫一(艾瑞尔)", tag: "来自磁层的二氧化碳冰?", text: "天王星大卫星中最明亮的一颗,表面有年轻的峡谷。韦布望远镜发现二氧化碳冰集中在它的一侧,可能是天王星磁层的带电粒子撞击表面造成的。" }, + umbriel: { full: "天卫二(乌姆柏里厄尔)", tag: "天王星最暗的卫星", text: "天王星大卫星中最暗的一颗,赤道附近有一个神秘的明亮圆环,名为“温达”。" }, + titania: { full: "天卫三(泰坦尼亚)", tag: "天王星最大的卫星", text: "天卫三的岩石核心与冰壳之间可能有一层薄薄的海洋,是未来天王星轨道器及其磁强计的重要目标。" }, + oberon: { full: "天卫四(奥伯龙)", tag: "进出磁层的卫星", text: "天王星最外侧的大卫星。它的部分轨道位于磁层顶以外,所以表面同时受到太阳风和天王星磁层等离子体的冲击。" }, + triton: { full: "海卫一(特里同)", tag: "被俘获、有喷泉的世界", text: "它逆向公转,很可能是被海王星俘获的柯伊伯带天体。旅行者 2 号在 1989 年看到氮气喷泉。海王星倾斜的磁场随自转扫过海卫一,它的大气可能为海王星磁层提供氮。它也可能藏有海洋。" } + }, + ft: { tex: "行星与月球纹理:Solar System Scope(CC BY 4.0),基于 NASA 图像。卫星拼接图:NASA/JPL/USGS(伽利略号、卡西尼号、旅行者号),经 NOAA Science On a Sphere 提供。" } + }, + + "zh-Hant": { + nav: { moons: "衛星" }, + moons: { + moon: "月球", io: "木衛一", europa: "木衛二", ganymede: "木衛三", callisto: "木衛四", + mimas: "土衛一", enceladus: "土衛二", tethys: "土衛三", dione: "土衛四", rhea: "土衛五", titan: "土衛六", iapetus: "土衛八", + miranda: "天衛五", ariel: "天衛一", umbriel: "天衛二", titania: "天衛三", oberon: "天衛四", triton: "海衛一" + }, + mn: { + title: "磁層中的衛星", + sub: "巨行星的衛星都處在磁「泡泡」之中:有的為磁層提供氣體,有的擁有自己的極光,有的藏著海洋,而磁場正是幫助我們找到海洋的線索。轉動下面的星球,再在 3D 中飛過去看看。你也可以在 3D 探索中直接點擊任何衛星。", + fly: "在 3D 中飛過去", + back: "← 返回行星", + dia: "直徑", dist: "與行星距離", period: "公轉周期", host: "環繞", + days: "天", retro: "逆向公轉", km: "公里", + clickHint: "提示:在 3D 中點擊衛星即可查看介紹。", + roleTitle: "在磁層中的角色" + }, + mo: { + moon: { full: "月球", tag: "地球唯一的天然衛星", text: "月球沒有全球磁場,也幾乎沒有大氣,太陽風直接打在它的表面。每個月有幾天,月球會穿過地球的磁尾,改為沐浴在來自地球的等離子體中。" }, + io: { full: "木衛一(艾奧)", tag: "火山世界 · 等離子體來源", text: "太陽系中火山活動最劇烈的天體。火山每秒釋放約一噸氣體,氣體被電離後形成木衛一等離子體環。當木星磁場掃過時,木衛一沿著磁通管驅動高達數百萬安培的電流,在木星大氣中留下明亮的極光「足跡」。" }, + europa: { full: "木衛二(歐羅巴)", tag: "海洋世界", text: "冰殼之下有一片鹹水海洋。伽利略號透過木星磁場掃過時海洋感應出的磁場發現了它。輻射分解表面的冰,形成稀薄的氧氣大氣。歐羅巴快船將於 2030 年起研究它。" }, + ganymede: { full: "木衛三(甘尼米德)", tag: "擁有自己磁層的衛星", text: "太陽系最大的衛星,也是唯一擁有自身磁場的衛星:在木星磁層之內還有一個迷你磁層,並有自己的極光。2015 年,哈勃發現這些極光的擺動比預期小,揭示冰層下有鹹水海洋。JUICE 將於 2034 年起環繞木衛三運行。" }, + callisto: { full: "木衛四(卡利斯多)", tag: "古老的隕石坑世界", text: "太陽系中隕石坑最密集的表面之一。伽利略號在木衛四內部探測到感應磁場訊號,暗示可能存在深層鹹水海洋。它位於木星主要輻射帶之外,對未來的探索者來說較為安全。" }, + mimas: { full: "土衛一(彌瑪斯)", tag: "「死星」衛星", text: "巨大的赫歇爾隕石坑令它看起來像電影中的「死星」。它的引力幫助塑造了土星光環中的卡西尼縫;2024 年科學家報告它可能藏有一個年輕的海洋。" }, + enceladus: { full: "土衛二(恩塞勒達斯)", tag: "噴泉 · 主要等離子體來源", text: "南極附近的噴泉把下方海洋的水汽和冰粒噴向太空。這些水是土星磁層等離子體的主要來源,也補充了 E 環。卡西尼號曾穿過羽流,「嚐」到鹽分和有機分子。" }, + tethys: { full: "土衛三(特提斯)", tag: "等離子體中的冰衛星", text: "擁有巨大峽谷「伊薩卡深谷」的冰衛星。土星磁層的電子轟擊它的表面,按照等離子體流動的方向改變表面的顏色和亮度。" }, + dione: { full: "土衛四(狄俄涅)", tag: "稀薄的氧氣大氣", text: "卡西尼號在土衛四周圍發現極稀薄的氧氣層,是帶電粒子和陽光分解水冰而成。土衛四的地殼深處也可能有海洋。" }, + rhea: { full: "土衛五(瑞亞)", tag: "土星第二大衛星", text: "2010 年,卡西尼號在土衛五周圍探測到由氧和二氧化碳組成的稀薄大氣,土星磁層粒子撞擊冰面不斷為它補充氣體。" }, + titan: { full: "土衛六(泰坦)", tag: "濃厚大氣與甲烷湖", text: "比水星還大,擁有濃厚的氮氣大氣和液態甲烷湖。它沒有自己的磁場,所以土星的磁場和等離子體會包裹著它的大氣。惠更斯號於 2005 年著陸,NASA 的「蜻蜓號」無人機計劃在 2030 年代抵達。" }, + iapetus: { full: "土衛八(伊阿珀托斯)", tag: "黑白雙色衛星", text: "一半明亮、一半黝黑,赤道上還有一道高聳的山脊。它離土星很遠,大部分時間位於磁層之外的太陽風中。" }, + miranda: { full: "天衛五(米蘭達)", tag: "拼湊而成的世界", text: "佈滿巨大懸崖和溝槽。維羅納斷崖高約 20 公里,可能是太陽系最高的懸崖。航海家 2 號在 1986 年拍下了它。" }, + ariel: { full: "天衛一(艾瑞爾)", tag: "來自磁層的二氧化碳冰?", text: "天王星大衛星中最明亮的一顆,表面有年輕的峽谷。韋伯望遠鏡發現二氧化碳冰集中在它的一側,可能是天王星磁層的帶電粒子撞擊表面造成的。" }, + umbriel: { full: "天衛二(烏姆柏里厄爾)", tag: "天王星最暗的衛星", text: "天王星大衛星中最暗的一顆,赤道附近有一個神秘的明亮圓環,名為「溫達」。" }, + titania: { full: "天衛三(泰坦妮亞)", tag: "天王星最大的衛星", text: "天衛三的岩石核心與冰殼之間可能有一層薄薄的海洋,是未來天王星軌道器及其磁強計的重要目標。" }, + oberon: { full: "天衛四(奧伯龍)", tag: "進出磁層的衛星", text: "天王星最外側的大衛星。它的部分軌道位於磁層頂以外,所以表面同時受到太陽風和天王星磁層等離子體的衝擊。" }, + triton: { full: "海衛一(特里同)", tag: "被俘獲、有噴泉的世界", text: "它逆向公轉,很可能是被海王星俘獲的柯伊伯帶天體。航海家 2 號在 1989 年看到氮氣噴泉。海王星傾斜的磁場隨自轉掃過海衛一,它的大氣可能為海王星磁層提供氮。它也可能藏有海洋。" } + }, + ft: { tex: "行星與月球紋理:Solar System Scope(CC BY 4.0),基於 NASA 圖像。衛星拼接圖:NASA/JPL/USGS(伽利略號、卡西尼號、航海家號),經 NOAA Science On a Sphere 提供。" } + } +}; diff --git a/js/main.js b/js/main.js new file mode 100644 index 0000000000000000000000000000000000000000..8177ca380819a236744171ed002c9b0298ac1b86 --- /dev/null +++ b/js/main.js @@ -0,0 +1,342 @@ +import { I18N, LANGS } from './i18n.js'; +import { MOON_I18N } from './i18n_moons.js'; +import { CRAFT_I18N, CRAFT_ORDER, CRAFT_THEMES, CRAFT_INST, CRAFT_BACKDROP } from './i18n_craft.js'; +import { createCraftViewer } from './craft.js'; +import { createScene, PLANET_CFG, FEATURED_MOONS, moonData } from './scene.js'; + +// merge moon text into the main dictionary +const deepMerge = (a, b) => { for (const k in b) { if (b[k] && typeof b[k] === 'object' && !Array.isArray(b[k]) && a[k] && typeof a[k] === 'object') deepMerge(a[k], b[k]); else a[k] = b[k]; } return a; }; +for (const extra of [MOON_I18N, CRAFT_I18N]) for (const l of Object.keys(extra)) deepMerge(I18N[l], extra[l]); +import { initAuroraGallery } from './aurora2d.js'; + +/* ------------------------------------------------------------ language */ +const params = new URLSearchParams(location.search); +function detectLang() { + if (LANGS.includes(params.get('lang'))) return params.get('lang'); + const saved = localStorage.getItem('mop-lang'); + if (LANGS.includes(saved)) return saved; + const nav = (navigator.language || 'en').toLowerCase(); + if (nav.startsWith('zh')) return /tw|hk|mo|hant/.test(nav) ? 'zh-Hant' : 'zh-Hans'; + return 'en'; +} +let lang = detectLang(); + +function t(key) { + const get = (obj) => key.split('.').reduce((o, k) => (o == null ? undefined : o[k]), obj); + const v = get(I18N[lang]); + return v === undefined ? (get(I18N.en) ?? key) : v; +} +const $ = (s, r = document) => r.querySelector(s); +const $$ = (s, r = document) => [...r.querySelectorAll(s)]; +const esc = s => String(s).replace(/[&<>"]/g, c => ({ '&': '&', '<': '<', '>': '>', '"': '"' }[c])); + +/* -------------------------------------------------------------- 3D scene */ +const PLANETS = ['earth', 'jupiter', 'saturn', 'uranus', 'neptune']; +let scene = null; +let selection = null; // key of the moon shown in the info panel, or null for the planet +try { + scene = createScene($('#stage'), { + t, + onPlanetChange: name => { selection = null; updateInfo(name); syncTabs(name); }, + onSelect: pick => { if (pick.type === 'moon') showMoon(pick.key); else { selection = null; updateInfo(); } } + }); + scene.setPlanet(PLANETS.includes(params.get('planet')) ? params.get('planet') : 'jupiter', { instant: true }); +} catch (err) { + console.error(err); + $('#stage').innerHTML = '

    WebGL is not available in this browser, so the 3D explorer cannot run. The rest of the page still works.

    '; +} + +function syncTabs(name) { $$('#planetTabs button').forEach(b => b.classList.toggle('active', b.dataset.planet === name)); } + +function updateInfo(name = scene?.planet || 'jupiter') { + const p = `planets.${name}.`; + $('#infoName').textContent = t(p + 'name'); + $('#infoTag').textContent = t(p + 'tag'); + $('#infoDesc').textContent = t(p + 'desc'); + $('#infoFacts').innerHTML = ['field', 'tilt', 'mp', 'source', 'rot', 'aurora', 'visited'] + .map(k => `
    ${esc(t('info.' + k))}
    ${esc(t(p + k))}
    `).join(''); + const moons = PLANET_CFG[name].moons; + $('#infoMoons').innerHTML = moons.length ? `

    ${esc(t('nav.moons'))}

    ${moons.map(m => + ``).join('')}

    ${esc(t('mn.clickHint'))}

    ` : ''; + $$('#infoMoons [data-moon]').forEach(b => b.addEventListener('click', () => flyToMoon(b.dataset.moon, false))); +} + +function moonName(key) { return I18N[lang].mo?.[key]?.full || t('moons.' + key); } +function moonFacts(key) { + const m = moonData(key), host = PLANET_CFG[m.host]; + const retro = m.period < 0 ? (lang === 'en' ? ` (${t('mn.retro')})` : `(${t('mn.retro')})`) : ''; + const days = Math.abs(m.period).toLocaleString('en', { maximumFractionDigits: 2 }) + ' ' + t('mn.days') + retro; + return [ + ['mn.host', t(`planets.${m.host}.name`)], + ['mn.dia', m.dia.toLocaleString('en') + ' ' + t('mn.km')], + ['mn.dist', fmtKm(Math.round(m.realDist * host.radiusKm / 100) * 100)], + ['mn.period', days] + ]; +} +function showMoon(key) { + selection = key; + $('#infoTag').textContent = t(`mo.${key}.tag`); + $('#infoName').textContent = moonName(key); + $('#infoDesc').textContent = t(`mo.${key}.text`); + $('#infoFacts').innerHTML = moonFacts(key).map(([k, v]) => `
    ${esc(t(k))}
    ${esc(v)}
    `).join(''); + $('#infoMoons').innerHTML = `
    `; + $('#moonFly').addEventListener('click', () => scene?.focusMoon(key)); + $('#moonBack').addEventListener('click', () => { selection = null; updateInfo(); scene?.view('overview'); }); + document.body.classList.remove('touring'); +} +function flyToMoon(key, scroll = true, instant = false) { + if (!scene) return; + const host = moonData(key).host; + endTour(); + startExploring(); + if (scroll) $('#explore').scrollIntoView({ behavior: 'smooth' }); + if (scene.planet !== host) scene.setPlanet(host, { keepView: true }); + scene.setLayer('moons', true); syncLayerBoxes(); + scene.focusMoon(key, instant); + showMoon(key); +} + +function syncLayerBoxes() { + if (!scene) return; + const L = scene.getLayers(); + $$('[data-layer]').forEach(cb => { cb.checked = !!L[cb.dataset.layer]; }); +} + +$$('#planetTabs button').forEach(b => b.addEventListener('click', () => { endTour(); scene?.setPlanet(b.dataset.planet); })); +$$('[data-layer]').forEach(cb => cb.addEventListener('change', () => scene?.setLayer(cb.dataset.layer, cb.checked))); +$$('[data-view]').forEach(b => b.addEventListener('click', () => scene?.view(b.dataset.view))); +$('#speed').addEventListener('input', e => scene?.setSpeed(parseFloat(e.target.value))); + +function startExploring() { document.body.classList.add('exploring'); } +$('#startBtn').addEventListener('click', startExploring); + +/* ----------------------------------------------------------------- tour */ +const ALL_ON = { field: true, wind: true, mp: true, aurora: true, torus: true, moons: true, labels: true }; +const TOUR = [ + { planet: 'jupiter', view: 'close', layers: { field: true, wind: false, mp: false, aurora: false, torus: false, moons: false, labels: true } }, + { planet: 'jupiter', view: 'overview', layers: { field: true, wind: true, mp: false, aurora: false, torus: false, moons: false, labels: true } }, + { planet: 'jupiter', view: 'overview', layers: { field: true, wind: true, mp: true, aurora: false, torus: false, moons: false, labels: true } }, + { planet: 'jupiter', view: 'mid', layers: { field: true, wind: false, mp: false, aurora: false, torus: true, moons: true, labels: true } }, + { planet: 'jupiter', view: 'aurora', layers: { ...ALL_ON, wind: false, mp: false } }, + { planet: 'uranus', view: 'overview', layers: { ...ALL_ON } } +]; +let tourIdx = -1; + +function showStep(i) { + if (!scene) return; + tourIdx = Math.max(0, Math.min(TOUR.length - 1, i)); + const s = TOUR[tourIdx]; + startExploring(); + document.body.classList.add('touring'); + if (scene.planet !== s.planet) scene.setPlanet(s.planet, { keepView: true }); + scene.setLayers(s.layers); + scene.view(s.view); + syncLayerBoxes(); + $('#tour').hidden = false; + renderTourText(); +} +function renderTourText() { + if (tourIdx < 0) return; + const step = t('how.steps')[tourIdx]; + $('#tourStep').textContent = t('ex.stepFmt').replace('{i}', tourIdx + 1).replace('{n}', TOUR.length); + $('#tourTitle').textContent = step.title; + $('#tourText').textContent = step.text; + $('#tourPrev').disabled = tourIdx === 0; + $('#tourNext').disabled = tourIdx === TOUR.length - 1; +} +function endTour() { + if (tourIdx < 0) return; + tourIdx = -1; + $('#tour').hidden = true; + document.body.classList.remove('touring'); + scene?.setLayers(ALL_ON); + syncLayerBoxes(); +} +$('#tourBtn').addEventListener('click', () => showStep(0)); +$('#tourPrev').addEventListener('click', () => showStep(tourIdx - 1)); +$('#tourNext').addEventListener('click', () => showStep(tourIdx + 1)); +$('#tourExit').addEventListener('click', endTour); + +/* ------------------------------------------------------ dynamic sections */ +const STEP_ICONS = ['🧲', '☀️', '🌊', '🌋', '🌌', '🌀']; +function renderSteps() { + $('#stepsGrid').innerHTML = t('how.steps').map((s, i) => ` +
    +
    ${STEP_ICONS[i]}${i + 1}
    +

    ${esc(s.title)}

    +

    ${esc(s.text)}

    + +
    `).join(''); + $$('#stepsGrid [data-step]').forEach(b => b.addEventListener('click', () => { + $('#explore').scrollIntoView({ behavior: 'smooth' }); + showStep(parseInt(b.dataset.step, 10)); + })); +} + +const SIZES = [ + { key: 'earth', km: 64000, color: '#4fa3ff' }, + { key: 'jupiter', km: 4500000, color: '#e0b27a' }, + { key: 'saturn', km: 1300000, color: '#e8d08f' }, + { key: 'uranus', km: 460000, color: '#8fe3ea' }, + { key: 'neptune', km: 600000, color: '#5d7fff' }, + { key: 'sun', km: 1392000, color: '#ffcc55' } +]; +function fmtKm(km) { + if (lang === 'en') return km >= 1e6 ? `${(km / 1e6).toLocaleString('en', { maximumFractionDigits: 2 })} million km` : `${km.toLocaleString('en')} km`; + const wan = lang === 'zh-Hans' ? '万' : '萬'; + return km >= 1e4 ? `${(km / 1e4).toLocaleString('en', { maximumFractionDigits: 1 })} ${wan}公里` : `${km.toLocaleString('en')} 公里`; +} +function renderBars() { + const max = Math.max(...SIZES.map(s => s.km)); + $('#bars').innerHTML = SIZES.map(s => { + const name = s.key === 'sun' ? t('cmp.sun') : t(`planets.${s.key}.name`); + const w = Math.max(0.6, (s.km / max) * 100); + return `
    + ${esc(name)} +
    + ${esc(fmtKm(s.km))} +
    `; + }).join(''); + const io = new IntersectionObserver(es => es.forEach(e => e.isIntersecting && e.target.classList.add('grow')), { threshold: 0.3 }); + io.observe($('#bars')); +} +function renderTable() { + const cols = ['field', 'tilt', 'mp', 'rot', 'source']; + $('#cmpTable').innerHTML = `${esc(t('cmp.planet'))}${cols.map(c => `${esc(t('info.' + c))}`).join('')} + ${PLANETS.map(p => `${esc(t(`planets.${p}.name`))}${cols.map(c => `${esc(t(`planets.${p}.${c}`))}`).join('')}`).join('')}`; +} +function renderMoons() { + $('#moonGrid').innerHTML = FEATURED_MOONS.map(k => ` +
    +
    +
    +

    ${esc(t(`planets.${moonData(k).host}.name`))} · ${esc(t(`mo.${k}.tag`))}

    +

    ${esc(moonName(k))}

    +

    ${esc(t(`mo.${k}.text`))}

    +
    ${moonFacts(k).slice(1).map(([a, v]) => `
    ${esc(t(a))}
    ${esc(v)}
    `).join('')}
    + +
    +
    `).join(''); + $$('#moonGrid [data-fly]').forEach(b => b.addEventListener('click', () => flyToMoon(b.dataset.fly))); +} +/* ------------------------------------------------------------ spacecraft */ +const craft = { key: 'juno', theme: 0, inst: null, viewer: null }; +const pad2 = n => String(n).padStart(2, '0'); +function craftMatches(key) { return !craft.theme || CRAFT_THEMES[key].includes(craft.theme); } +function renderThemes() { + const themes = t('themes'); + $('#themeChips').innerHTML = `` + + themes.map((th, i) => ``).join(''); + $('#themeDesc').textContent = craft.theme ? themes[craft.theme - 1].text : ''; + $$('#themeChips [data-theme]').forEach(b => b.addEventListener('click', () => setTheme(+b.dataset.theme))); +} +function setTheme(n) { + craft.theme = n; + renderThemes(); + if (!craftMatches(craft.key)) showCraft(CRAFT_ORDER.find(craftMatches)); + else renderPicker(); +} +function renderPicker() { + $('#craftPicker').innerHTML = CRAFT_ORDER.map(k => ` + `).join(''); + $$('#craftPicker [data-craft]').forEach(b => b.addEventListener('click', () => showCraft(b.dataset.craft))); +} +function renderCraftInfo() { + const k = craft.key, c = `crafts.${k}.`; + const insts = CRAFT_INST[k]; + $('#craftInfo').innerHTML = ` +

    ${esc(t(c + 'agency'))}

    +

    ${esc(t(c + 'name'))}

    +

    ${esc(t(c + 'desc'))}

    +
    +
    ${esc(t('sc.years'))}
    ${esc(t(c + 'years'))}
    +
    ${esc(t('sc.target'))}
    ${esc(t(c + 'target'))}
    +
    ${esc(t('sc.status'))}
    ${esc(t(c + 'status'))}
    +
    +

    ${esc(t('sc.mopThemes'))}

    +
    ${CRAFT_THEMES[k].map(n => ``).join('')}
    +

    ${esc(t('sc.instruments'))}

    +
      ${insts.map((id, i) => { + const on = craft.inst === id; + return `
    1. ${on ? `

      ${esc(t(c + 'inst.' + id + '.text'))}

      ` : ''}
    2. `; + }).join('')}
    +

    ${esc(t('sc.saw'))}

    + `; + $$('#craftInfo [data-inst]').forEach(b => b.addEventListener('click', () => pickInst(b.dataset.inst === craft.inst ? null : b.dataset.inst))); + $$('#craftInfo [data-theme]').forEach(b => b.addEventListener('click', () => setTheme(+b.dataset.theme))); +} +function pickInst(id) { + craft.inst = id; + craft.viewer?.select(id); + renderCraftInfo(); +} +function showCraft(key) { + craft.key = key; craft.inst = null; + renderPicker(); renderCraftInfo(); + craft.viewer?.show(key, CRAFT_INST[key]); +} +try { + craft.viewer = createCraftViewer($('#craftStage'), { onPick: id => pickInst(id), backdrop: k => CRAFT_BACKDROP[k] }); + craft.viewer.show(craft.key, CRAFT_INST[craft.key]); +} catch (err) { console.error(err); } + +function renderWhy() { + $('#whyGrid').innerHTML = t('why.cards').map(c => ` +
    ${c.icon}

    ${esc(c.title)}

    ${esc(c.text)}

    `).join(''); +} +function renderTimeline() { + $('#timeline').innerHTML = t('ms.items').map(m => ` +
  1. ${esc(m.year)}

    ${esc(m.name)}

    ${esc(m.text)}

  2. `).join(''); +} + +/* ----------------------------------------------------------------- quiz */ +let answers = {}; +function renderQuiz() { + const items = t('qz.items'); + $('#quizBox').innerHTML = items.map((q, qi) => { + const done = answers[qi] !== undefined; + return `
    +

    ${qi + 1}. ${esc(q.q)}

    +
    ${q.options.map((o, oi) => { + let cls = ''; + if (done) { if (oi === q.answer) cls = 'right'; else if (oi === answers[qi]) cls = 'wrong'; } + return ``; + }).join('')}
    + ${done ? `

    ${esc(answers[qi] === q.answer ? t('qz.correct') : t('qz.wrong'))} ${esc(q.explain)}

    ` : ''} +
    `; + }).join(''); + const score = Object.entries(answers).filter(([qi, o]) => items[qi].answer === o).length; + $('#quizScore').textContent = `${t('qz.score')}: ${score} / ${items.length}`; + $$('#quizBox button[data-q]').forEach(b => b.addEventListener('click', () => { + answers[+b.dataset.q] = +b.dataset.o; + renderQuiz(); + })); +} +$('#quizReset').addEventListener('click', () => { answers = {}; renderQuiz(); }); + +/* ------------------------------------------------------------ apply lang */ +function applyLang(l) { + lang = l; + localStorage.setItem('mop-lang', l); + document.documentElement.lang = l; + document.title = t('meta.title'); + $$('[data-i18n]').forEach(el => { el.textContent = t(el.dataset.i18n); }); + $$('.lang button').forEach(b => b.classList.toggle('active', b.dataset.lang === l)); + renderSteps(); renderMoons(); renderThemes(); renderPicker(); renderCraftInfo(); renderBars(); renderTable(); renderWhy(); renderTimeline(); renderQuiz(); + if (scene) { selection ? showMoon(selection) : updateInfo(); scene.refreshLabels(); } + renderTourText(); +} +$$('.lang button').forEach(b => b.addEventListener('click', () => applyLang(b.dataset.lang))); + +$('#menuBtn').addEventListener('click', () => document.body.classList.toggle('menu-open')); +$$('#nav a').forEach(a => a.addEventListener('click', () => document.body.classList.remove('menu-open'))); + +applyLang(lang); +initAuroraGallery(); +if (params.has('explore')) startExploring(); +if (params.get('view')) scene?.view(params.get('view'), true); +if (params.has('tour')) showStep(parseInt(params.get('tour'), 10) || 0); +if (CRAFT_ORDER.includes(params.get('craft'))) showCraft(params.get('craft')); +if (params.get('moon') && moonData(params.get('moon'))) flyToMoon(params.get('moon'), false, true); diff --git a/js/models.js b/js/models.js new file mode 100644 index 0000000000000000000000000000000000000000..e322febb0bf5c1747ea78c7025e4f2391afb63d6 --- /dev/null +++ b/js/models.js @@ -0,0 +1,379 @@ +// Simplified 3D spacecraft models built from primitives (units: metres). +// Every builder returns { group, fit } where `fit` is the radius used to frame the main body. +// Meshes tagged with userData.inst = '' belong to an instrument; their materials are +// cloned so the viewer can highlight them, and their centres become the hotspot markers. + +import * as THREE from 'three'; + +/* ------------------------------------------------------------ textures */ +function canvasTex(w, h, draw, repeat = [1, 1]) { + const c = document.createElement('canvas'); c.width = w; c.height = h; + draw(c.getContext('2d'), w, h); + const t = new THREE.CanvasTexture(c); + t.wrapS = t.wrapT = THREE.RepeatWrapping; t.repeat.set(...repeat); + t.anisotropy = 4; t.colorSpace = THREE.SRGBColorSpace; + return t; +} +let TEX = null; +function textures() { + if (TEX) return TEX; + const foil = (base, light, dark) => canvasTex(256, 256, (g, w, h) => { + g.fillStyle = base; g.fillRect(0, 0, w, h); + for (let i = 0; i < 420; i++) { + g.fillStyle = Math.random() < 0.5 ? light : dark; + g.globalAlpha = 0.08 + Math.random() * 0.22; + g.beginPath(); + const x = Math.random() * w, y = Math.random() * h, s = 6 + Math.random() * 40; + g.moveTo(x, y); g.lineTo(x + s, y + (Math.random() - .5) * s); g.lineTo(x + (Math.random() - .5) * s, y + s); g.fill(); + } + g.globalAlpha = 1; + }); + TEX = { + gold: foil('#c8962e', '#ffe08a', '#6d4a10'), + silver: foil('#b9bec4', '#ffffff', '#6b7076'), + black: foil('#1b1c20', '#4a4c52', '#000000'), + solar: canvasTex(256, 256, (g, w, h) => { + g.fillStyle = '#9aa3ad'; g.fillRect(0, 0, w, h); + const n = 8, s = w / n; + for (let i = 0; i < n; i++) for (let j = 0; j < n; j++) { + const l = 14 + Math.random() * 10; + g.fillStyle = `hsl(222, 70%, ${l}%)`; + g.fillRect(i * s + 2, j * s + 2, s - 4, s - 4); + g.strokeStyle = 'rgba(200,210,230,0.25)'; g.lineWidth = 1; + g.beginPath(); g.moveTo(i * s + s / 2, j * s + 2); g.lineTo(i * s + s / 2, j * s + s - 2); g.stroke(); + } + }) + }; + return TEX; +} + +let MAT = null; +function mats() { + if (MAT) return MAT; + const T = textures(); + MAT = { + gold: new THREE.MeshStandardMaterial({ map: T.gold, color: 0xffe2a0, metalness: 0.7, roughness: 0.35 }), + silver: new THREE.MeshStandardMaterial({ map: T.silver, metalness: 0.9, roughness: 0.32 }), + alu: new THREE.MeshStandardMaterial({ color: 0xc9cdd2, metalness: 0.85, roughness: 0.3 }), + white: new THREE.MeshStandardMaterial({ color: 0xe8e8e4, metalness: 0.05, roughness: 0.65, side: THREE.DoubleSide }), + dark: new THREE.MeshStandardMaterial({ color: 0x2b2d32, metalness: 0.5, roughness: 0.55 }), + black: new THREE.MeshStandardMaterial({ map: T.black, metalness: 0.6, roughness: 0.5 }), + solar: new THREE.MeshStandardMaterial({ map: T.solar, metalness: 0.45, roughness: 0.3 }), + titanium: new THREE.MeshStandardMaterial({ color: 0x8d9298, metalness: 0.9, roughness: 0.42 }), + boom: new THREE.MeshStandardMaterial({ color: 0xd8d2c0, metalness: 0.3, roughness: 0.6 }), + rtg: new THREE.MeshStandardMaterial({ color: 0x3b3b3e, metalness: 0.6, roughness: 0.45 }), + copper: new THREE.MeshStandardMaterial({ color: 0xd9a441, metalness: 1, roughness: 0.18 }), + mirror: new THREE.MeshStandardMaterial({ color: 0xd99a1c, emissive: 0x2a1600, metalness: 0.55, roughness: 0.2 }), + shield: new THREE.MeshStandardMaterial({ color: 0xcfc2e8, metalness: 0.45, roughness: 0.35, side: THREE.DoubleSide }), + mesh: new THREE.MeshStandardMaterial({ color: 0xe3c46a, metalness: 0.9, roughness: 0.3, transparent: true, opacity: 0.55, side: THREE.DoubleSide }), + lens: new THREE.MeshStandardMaterial({ color: 0x101830, metalness: 1, roughness: 0.05 }) + }; + return MAT; +} + +/* ------------------------------------------------------------- helpers */ +const V = (x, y, z) => new THREE.Vector3(x, y, z); +function tag(mesh, inst) { if (inst) { mesh.material = mesh.material.clone(); mesh.userData.inst = inst; } return mesh; } +function add(parent, mesh, pos, inst) { if (pos) mesh.position.copy(pos); parent.add(tag(mesh, inst)); return mesh; } +function cyl(r, h, mat, seg = 24, rTop = r) { return new THREE.Mesh(new THREE.CylinderGeometry(rTop, r, h, seg), mat); } +function box(w, h, d, mat) { return new THREE.Mesh(new THREE.BoxGeometry(w, h, d), mat); } +function sphere(r, mat) { return new THREE.Mesh(new THREE.SphereGeometry(r, 20, 14), mat); } +function dish(R, depth, mat, open = 'up') { + const pts = []; + for (let i = 0; i <= 24; i++) { const r = R * i / 24; pts.push(new THREE.Vector2(Math.max(r, 0.001), depth * (r / R) ** 2)); } + const m = new THREE.Mesh(new THREE.LatheGeometry(pts, 48), mat); + if (open === 'down') m.rotation.x = Math.PI; + return m; +} +function rod(a, b, r, mat) { + const d = b.clone().sub(a), len = d.length(); + const m = new THREE.Mesh(new THREE.CylinderGeometry(r, r, len, 8), mat); + m.position.copy(a).addScaledVector(d, 0.5); + m.quaternion.setFromUnitVectors(V(0, 1, 0), d.normalize()); + return m; +} +function lattice(a, b, w, mat) { + // triangular truss boom + const g = new THREE.Group(); + const d = b.clone().sub(a).normalize(); + const u = Math.abs(d.y) < 0.9 ? V(0, 1, 0) : V(1, 0, 0); + const p1 = u.clone().cross(d).normalize(), p2 = d.clone().cross(p1); + const offs = [0, 1, 2].map(k => p1.clone().multiplyScalar(Math.cos(k * 2.094) * w).addScaledVector(p2, Math.sin(k * 2.094) * w)); + offs.forEach(o => g.add(rod(a.clone().add(o), b.clone().add(o), w * 0.12, mat))); + const len = b.distanceTo(a), n = Math.max(2, Math.round(len / (w * 4))); + for (let i = 0; i <= n; i++) { + const c = a.clone().lerp(b, i / n); + for (let k = 0; k < 3; k++) g.add(rod(c.clone().add(offs[k]), c.clone().add(offs[(k + 1) % 3]), w * 0.08, mat)); + } + return g; +} +function rtg(len, r) { + const g = new THREE.Group(), M = mats(); + g.add(cyl(r, len, M.rtg, 16)); + for (let i = 0; i < 6; i++) { + const f = box(r * 1.1, len * 0.9, r * 0.08, M.rtg); + const a = i * Math.PI / 3; f.position.set(Math.cos(a) * r * 1.3, 0, Math.sin(a) * r * 1.3); f.rotation.y = -a; + g.add(f); + } + return g; +} +function wing(n, w, h, gap, start, M) { + // row of n solar panels along +x, lying in the xz plane + const g = new THREE.Group(); + for (let i = 0; i < n; i++) { + const p = box(w, 0.05, h, M.solar); + p.position.x = start + gap + i * (w + gap) + w / 2; + g.add(p); + } + g.add(rod(V(0, 0, 0), V(start + gap, 0, 0), 0.06, M.alu)); + return g; +} +function sensor(size, mat) { return box(size, size * 0.7, size, mat); } + +/* ------------------------------------------------------------- builders */ +const BUILDERS = { + juno() { + const M = mats(), g = new THREE.Group(); + add(g, cyl(1.8, 2.3, M.gold, 6)); + add(g, cyl(1.82, 0.08, M.dark, 6), V(0, 1.18, 0)); + add(g, box(0.9, 0.55, 0.9, M.titanium), V(0, 1.5, 0), 'vault'); + add(g, cyl(0.25, 0.8, M.alu, 12), V(0, 1.6, 0)); + add(g, dish(1.25, 0.32, M.white), V(0, 2.0, 0)); + add(g, cyl(0.06, 0.25, M.dark, 8, 0.12), V(0, 2.75, 0)); + [0, 1, 2].forEach(k => add(g, rod(V(Math.cos(k * 2.09) * 1.0, 2.25, Math.sin(k * 2.09) * 1.0), V(0, 2.7, 0), 0.02, M.alu))); + add(g, cyl(0.45, 0.6, M.dark, 16, 0.2), V(0, -1.45, 0)); + // three solar wings at 120°, the third shorter and carrying the magnetometer boom + [0, 1, 2].forEach(k => { + const n = k === 2 ? 3 : 4; + const wg = wing(n, 2.2, 2.65, 0.08, 1.5, M); + wg.rotation.y = k * 2 * Math.PI / 3; + g.add(wg); + if (k === 2) { + const end = 1.58 + n * 2.28; + const b = new THREE.Group(); b.rotation.y = wg.rotation.y; g.add(b); + b.add(lattice(V(end, 0, 0), V(end + 3.8, 0, 0), 0.18, M.boom)); + add(b, sensor(0.32, M.white), V(end + 2.2, 0, 0), 'mag'); + add(b, sensor(0.32, M.white), V(end + 3.8, 0, 0), 'mag'); + } + }); + // particle detectors, aurora cameras, MWR patch antennas, Waves dipole + add(g, box(0.5, 0.45, 0.4, M.silver), V(1.55, 0.4, 0.9), 'particles'); + add(g, box(0.4, 0.35, 0.4, M.silver), V(-1.6, -0.3, -0.6), 'particles'); + add(g, box(0.45, 0.5, 0.35, M.dark), V(-0.2, 0.5, 1.75), 'uvs'); + add(g, cyl(0.12, 0.3, M.lens, 12), V(-0.2, 0.5, 2.0), 'uvs').rotation.x = Math.PI / 2; + for (let i = 0; i < 6; i++) { + const a = i * Math.PI / 3 + Math.PI / 6; + const p = box(1.3, 1.3, 0.05, M.dark); + p.position.set(Math.cos(a) * 1.58, -0.3, Math.sin(a) * 1.58); p.rotation.y = -a + Math.PI / 2; + if (i % 2 === 0) add(g, p, null, 'mwr'); + } + add(g, rod(V(0.5, -1.0, -1.2), V(2.4, -2.6, -2.6), 0.03, M.alu), null, 'waves'); + add(g, rod(V(0.5, -1.0, -1.2), V(-0.9, -2.6, -3.2), 0.03, M.alu), null, 'waves'); + return { group: g, fit: 7 }; + }, + + cassini() { + const M = mats(), g = new THREE.Group(); + add(g, cyl(1.9, 4.2, M.gold, 24)); + add(g, cyl(1.95, 1.2, M.silver, 12), V(0, 2.7, 0)); + add(g, dish(2.0, 0.55, M.white), V(0, 3.32, 0)); + add(g, cyl(0.1, 0.5, M.dark, 8), V(0, 4.1, 0)); + [0, 1, 2].forEach(k => add(g, rod(V(Math.cos(k * 2.09) * 1.4, 3.6, Math.sin(k * 2.09) * 1.4), V(0, 4.3, 0), 0.03, M.alu))); + add(g, cyl(0.55, 0.9, M.dark, 16, 0.25), V(0.6, -2.55, 0)); + add(g, cyl(0.55, 0.9, M.dark, 16, 0.25), V(-0.6, -2.55, 0)); + [0, 2.2, 4.1].forEach(a => { + const r = rtg(1.6, 0.22); r.position.set(Math.cos(a) * 2.3, -1.7, Math.sin(a) * 2.3); + r.rotation.z = Math.PI / 2; r.rotation.y = -a; g.add(r); + }); + add(g, rtg(1.6, 0.22), null); + add(g, cyl(1.35, 0.65, M.gold, 32, 0.25), V(2.45, 0.6, 0), 'huygens').rotation.z = -Math.PI / 2; + g.add(lattice(V(-1.9, 2.7, 0), V(-12.9, 2.9, 0), 0.16, M.boom)); + add(g, sensor(0.35, M.white), V(-7.5, 2.8, 0), 'mag'); + add(g, sensor(0.35, M.white), V(-12.9, 2.9, 0), 'mag'); + add(g, box(1.3, 1.0, 0.8, M.silver), V(0.4, 2.0, 2.15), 'mimi'); + add(g, cyl(0.25, 0.5, M.alu, 12), V(1.2, 2.2, 2.3), 'inms').rotation.z = Math.PI / 2; + add(g, box(1.7, 1.2, 1.0, M.black), V(0, 1.5, -2.2), 'uvis'); + [-0.5, 0, 0.5].forEach(x => add(g, cyl(0.16, 0.5, M.lens, 12), V(x, 1.5, -2.8), 'uvis').rotation.x = Math.PI / 2); + [[1, 0.25, 0.6], [-0.4, 0.25, 1], [-0.6, 0.25, -0.8]].forEach(d => + add(g, rod(V(0, 3.0, 0), V(0, 3.0, 0).addScaledVector(V(...d).normalize(), 10), 0.025, M.alu), null, 'rpws')); + return { group: g, fit: 7.5 }; + }, + + voyager() { + const M = mats(), g = new THREE.Group(); + add(g, cyl(0.95, 0.47, M.black, 10)); + add(g, dish(1.83, 0.42, M.white), V(0, 0.3, 0)); + add(g, cyl(0.25, 0.08, M.white, 16), V(0, 1.6, 0)); + [0, 1, 2, 3].forEach(k => add(g, rod(V(Math.cos(k * 1.57) * 1.2, 0.55, Math.sin(k * 1.57) * 1.2), V(0, 1.58, 0), 0.02, M.alu))); + const rec = add(g, cyl(0.16, 0.02, M.copper, 32), V(0.85, -0.05, 0.3), 'record'); + rec.rotation.z = Math.PI / 2; rec.rotation.y = -0.34; + g.add(rod(V(-0.9, 0, 0), V(-3.4, -0.25, 0), 0.05, M.boom)); + [-1.9, -2.55, -3.2].forEach(x => { const r = rtg(0.55, 0.2); r.position.set(x, -0.15, 0); r.rotation.z = Math.PI / 2; r.traverse(o => { if (o.isMesh) tag(o, 'rtg'); }); g.add(r); }); + g.add(lattice(V(0.9, 0, 0), V(3.0, 0.05, 0), 0.12, M.boom)); + add(g, box(0.4, 0.4, 0.4, M.silver), V(1.7, 0.25, 0.1), 'pls'); + add(g, cyl(0.16, 0.45, M.alu, 12), V(2.3, 0.3, -0.1), 'pls'); + add(g, box(0.65, 0.55, 0.6, M.black), V(3.25, 0.05, 0), 'scan'); + [-0.15, 0.15].forEach(z => add(g, cyl(0.1, 0.5, M.lens, 12), V(3.6, 0.15, z), 'scan').rotation.z = Math.PI / 2); + g.add(lattice(V(0, -0.1, -0.9), V(0, -1.2, -13.8), 0.09, M.boom)); + add(g, sensor(0.25, M.white), V(0, -0.65, -7.4), 'mag'); + add(g, sensor(0.25, M.white), V(0, -1.2, -13.8), 'mag'); + add(g, rod(V(0.3, -0.2, 0.7), V(4.5, -3.5, 8.6), 0.02, M.alu), null, 'radio'); + add(g, rod(V(-0.3, -0.2, 0.7), V(-4.5, -3.5, 8.6), 0.02, M.alu), null, 'radio'); + return { group: g, fit: 5.5 }; + }, + + galileo() { + const M = mats(), g = new THREE.Group(); + add(g, cyl(1.2, 1.4, M.black, 10)); + add(g, cyl(0.3, 0.8, M.alu, 12), V(0, 1.1, 0)); + // umbrella antenna: 18 ribs, three stuck half-open (as really happened) + const hub = V(0, 1.5, 0); + for (let i = 0; i < 18; i++) { + const a = i * Math.PI / 9, stuck = i === 3 || i === 9 || i === 14; + const r = stuck ? 1.0 : 2.4, h = stuck ? 1.4 : 0.75; + add(g, rod(hub, V(Math.cos(a) * r, 1.5 + h, Math.sin(a) * r), 0.025, M.alu), null, 'hga'); + } + add(g, dish(2.35, 0.75, M.mesh), V(0, 1.5, 0), 'hga'); + [1, -1].forEach(s => { + g.add(rod(V(s * 1.1, 0.2, 0), V(s * 3.3, 0.5, 0.6 * s), 0.05, M.boom)); + const r = rtg(1.1, 0.22); r.position.set(s * 3.6, 0.55, 0.7 * s); r.rotation.z = Math.PI / 2; g.add(r); + }); + g.add(lattice(V(0, 0.4, 1.2), V(0, 0.9, 11.8), 0.12, M.boom)); + add(g, sensor(0.3, M.white), V(0, 0.65, 7), 'mag'); + add(g, sensor(0.3, M.white), V(0, 0.9, 11.8), 'mag'); + add(g, box(0.45, 0.4, 0.45, M.silver), V(1.15, 0.2, -0.5), 'epd'); + add(g, box(0.4, 0.4, 0.4, M.silver), V(-1.1, 0.1, -0.6), 'epd'); + add(g, cyl(0.85, 1.1, M.gold, 16), V(0, -1.25, 0)); + g.add(rod(V(0.7, -1.4, 0), V(1.9, -1.9, 0), 0.06, M.alu)); + add(g, box(0.7, 0.55, 0.55, M.black), V(2.15, -1.95, 0), 'scan'); + add(g, cyl(0.12, 0.5, M.lens, 12), V(2.15, -2.3, 0), 'scan'); + add(g, cyl(0.62, 0.55, M.gold, 32, 0.2), V(0, -2.1, 0), 'probe').rotation.x = Math.PI; + return { group: g, fit: 5.5 }; + }, + + hubble() { + const M = mats(), g = new THREE.Group(); + const along = m => { m.rotation.z = Math.PI / 2; return m; }; + add(g, along(cyl(2.15, 6.5, M.silver, 32)), V(-2.6, 0, 0)); + add(g, along(cyl(2.0, 6.2, M.silver, 32)), V(3.6, 0, 0)); + add(g, along(cyl(1.6, 0.2, M.lens, 32)), V(0.9, 0, 0), 'mirror'); + // aperture door, hinged at the top edge and swung open + const door = new THREE.Group(); door.position.set(6.75, 2.0, 0); door.rotation.z = 100 * Math.PI / 180; g.add(door); + add(door, along(cyl(2.0, 0.12, M.silver, 32)), V(0, -2.0, 0)); + [1, -1].forEach(s => { + g.add(rod(V(-0.4, 0, s * 2.1), V(-0.4, 0, s * 3.0), 0.08, M.alu)); + const p = box(2.45, 0.04, 7.1, M.solar); p.position.set(-0.4, 0, s * 6.55); p.rotation.x = 0.35; add(g, p, null, 'arrays'); + g.add(rod(V(1.5, s * 2.1, 0), V(1.5, s * 3.6, 0), 0.05, M.alu)); + const a = dish(0.6, 0.15, M.white); a.position.set(1.5, s * 3.7, 0); a.rotation.z = s > 0 ? -Math.PI / 2 : Math.PI / 2; g.add(a); + }); + add(g, box(2.2, 0.9, 1.0, M.dark), V(-4.0, 1.75, 0), 'stis'); + add(g, box(2.2, 1.0, 0.9, M.dark), V(-4.0, 0, 1.75), 'acs'); + return { group: g, fit: 8 }; + }, + + jwst() { + const M = mats(), g = new THREE.Group(); + const shape = new THREE.Shape(); + [[10.5, 0], [6.5, 6], [-6.5, 6], [-10.5, 0], [-6.5, -6], [6.5, -6]].forEach(([x, y], i) => i ? shape.lineTo(x, y) : shape.moveTo(x, y)); + for (let i = 0; i < 5; i++) { + const s = new THREE.Mesh(new THREE.ShapeGeometry(shape), M.shield); + s.rotation.x = -Math.PI / 2; s.position.y = i * 0.18; const k = 1 - i * 0.025; s.scale.set(k, k, 1); + add(g, s, null, 'sunshield'); + } + add(g, box(2.2, 1.0, 2.2, M.black), V(0, -0.8, 0)); + const sp = box(2.4, 0.04, 6, M.solar); sp.position.set(0, -1.3, 3.8); sp.rotation.x = 0.3; g.add(sp); + add(g, cyl(0.25, 1.6, M.alu, 12), V(0, 1.6, 0)); + // primary mirror: 18 hexagonal gold segments facing +z, standing above the sunshield + const mirror = new THREE.Group(); mirror.position.set(0, 5.0, 0.6); g.add(mirror); + const s = 1.32, r = s / Math.sqrt(3); + const axial = []; + for (let q = -2; q <= 2; q++) for (let p = -2; p <= 2; p++) { const rr = Math.max(Math.abs(q), Math.abs(p), Math.abs(-q - p)); if (rr >= 1 && rr <= 2) axial.push([q, p]); } + axial.forEach(([q, p]) => { + const x = s * (q + p / 2), y = s * (p * Math.sqrt(3) / 2); + const seg = new THREE.Mesh(new THREE.CylinderGeometry(r * 0.97, r * 0.97, 0.08, 6), M.mirror); + seg.rotation.x = Math.PI / 2; seg.rotation.y = Math.PI / 6; + seg.position.set(x, y, (x * x + y * y) / 40); + add(mirror, seg, null, 'mirror'); + }); + add(mirror, box(3.4, 3.4, 0.5, M.black), V(0, 0, -0.4)); + add(mirror, box(2.2, 2.0, 1.6, M.black), V(0, -0.6, -1.4), 'nircam'); + add(mirror, box(1.2, 1.0, 1.0, M.dark), V(1.3, -1.2, -1.2), 'miri'); + add(mirror, cyl(0.38, 0.1, M.mirror, 6), V(0, 0, 7.2)).rotation.x = Math.PI / 2; + [[0, 3.1], [-2.7, -1.6], [2.7, -1.6]].forEach(([x, y]) => mirror.add(rod(V(x, y, 0.3), V(0, 0, 7.15), 0.04, M.alu))); + return { group: g, fit: 9 }; + }, + + juice() { + const M = mats(), g = new THREE.Group(); + add(g, box(2.5, 4.0, 2.6, M.gold)); + add(g, dish(1.25, 0.32, M.white), V(0, 2.05, 0)); + add(g, cyl(0.06, 0.3, M.dark, 8), V(0, 2.75, 0)); + [1, -1].forEach(side => { + // each wing: 3 panels in a row plus two side panels on the middle one (a cross) + const wgrp = new THREE.Group(); wgrp.rotation.y = side > 0 ? -Math.PI / 2 : Math.PI / 2; g.add(wgrp); + const wg = wing(3, 2.6, 3.4, 0.08, 1.3, M); wgrp.add(wg); + [1, -1].forEach(z => { const p = box(2.6, 0.05, 3.4, M.solar); p.position.set(1.38 + 2.68 + 1.3, 0, z * 3.5); wgrp.add(p); }); + }); + g.add(lattice(V(-1.25, 1.0, 0), V(-11.8, 1.4, 0), 0.14, M.boom)); + add(g, sensor(0.3, M.white), V(-6.5, 1.2, 0), 'jmag'); + add(g, sensor(0.3, M.white), V(-11.8, 1.4, 0), 'jmag'); + add(g, box(16, 0.05, 0.35, M.alu), V(9.3, 1.7, 0.9), 'rime'); + [[1, 1], [1, -1], [-1, 1], [-1, -1]].forEach(([x, z]) => { + const a = V(x * 1.25, -1.8, z * 1.3), b = a.clone().add(V(x * 2, -1.0, z * 2)); + add(g, rod(a, b, 0.025, M.alu), null, 'rpwi'); add(g, sphere(0.1, M.alu), b, 'rpwi'); + }); + add(g, box(0.5, 0.5, 0.4, M.silver), V(1.0, -0.6, 1.5), 'pep'); + add(g, box(0.45, 0.4, 0.4, M.silver), V(-0.9, 0.6, -1.5), 'pep'); + [-0.6, 0, 0.6].forEach(y => add(g, cyl(0.17, 0.45, M.lens, 12), V(1.45, y - 1.0, -0.6), 'optical').rotation.z = Math.PI / 2); + add(g, box(0.4, 1.8, 1.0, M.black), V(1.35, -1.0, -0.6), 'optical'); + return { group: g, fit: 8 }; + }, + + clipper() { + const M = mats(), g = new THREE.Group(); + add(g, cyl(0.8, 5.0, M.white, 24)); + add(g, box(1.8, 1.1, 1.8, M.alu), V(0, 0.9, 0), 'vault'); + add(g, dish(1.5, 0.42, M.white), V(0, 2.55, 0)); + add(g, cyl(0.07, 0.35, M.dark, 8), V(0, 3.4, 0)); + add(g, cyl(0.5, 0.6, M.dark, 16, 0.25), V(0, -2.8, 0)); + [1, -1].forEach(side => { + const wg = wing(5, 2.7, 4.1, 0.1, 0.9, M); wg.position.y = -0.8; if (side < 0) wg.rotation.y = Math.PI; g.add(wg); + [2.15, -2.15].forEach(z => add(g, box(17.6, 0.06, 0.12, M.alu), V(side * 9.6, -0.7, z), 'reason')); + }); + g.add(lattice(V(0, -2.4, 0.6), V(0, -5.6, 8.4), 0.16, M.boom)); + [0.45, 0.75, 1].forEach(f => add(g, sensor(0.28, M.white), V(0, -2.4, 0.6).lerp(V(0, -5.6, 8.4), f), 'ecm')); + add(g, cyl(0.18, 0.2, M.alu, 16), V(0.85, 1.6, 0.3), 'pims').rotation.z = -Math.PI / 2; + add(g, cyl(0.18, 0.2, M.alu, 16), V(-0.85, 1.6, -0.3), 'pims').rotation.z = Math.PI / 2; + add(g, box(1.4, 0.9, 0.7, M.black), V(0, -1.6, 1.05), 'optical'); + [-0.4, 0, 0.4].forEach(x => add(g, cyl(0.13, 0.3, M.lens, 12), V(x, -1.6, 1.5), 'optical').rotation.x = Math.PI / 2); + add(g, box(0.6, 0.6, 0.5, M.silver), V(-0.9, -0.3, 0.6), 'insitu'); + add(g, cyl(0.25, 0.3, M.alu, 16), V(0.95, -0.3, 0.5), 'insitu'); + return { group: g, fit: 9 }; + } +}; + +export const CRAFT_KEYS = Object.keys(BUILDERS); + +export function buildCraft(key) { + const out = BUILDERS[key](); + out.group.userData.craft = key; + return out; +} + +// Centre of every tagged instrument in the group's local space. +export function hotspots(group) { + const boxes = new Map(); + group.updateWorldMatrix(true, true); + const inv = group.matrixWorld.clone().invert(); + group.traverse(o => { + if (!o.isMesh || !o.userData.inst) return; + o.geometry.computeBoundingBox(); + const b = o.geometry.boundingBox.clone().applyMatrix4(o.matrixWorld).applyMatrix4(inv); + const id = o.userData.inst; + if (!boxes.has(id)) boxes.set(id, { box: b, meshes: [o] }); + else { boxes.get(id).box.union(b); boxes.get(id).meshes.push(o); } + }); + const res = new Map(); + boxes.forEach((v, id) => res.set(id, { pos: v.box.getCenter(new THREE.Vector3()), meshes: v.meshes })); + return res; +} diff --git a/js/scene.js b/js/scene.js new file mode 100644 index 0000000000000000000000000000000000000000..acf06fb5a66e2aa083b3b9e8368e3452f686e424 --- /dev/null +++ b/js/scene.js @@ -0,0 +1,955 @@ +// 3D magnetosphere scene: planet, dipole field lines, magnetopause, bow shock, +// solar wind, plasma torus, moons with flux tubes, and layered aurora shells. +// The Sun is always in the +X direction. Distances are compressed (not to scale). + +import * as THREE from 'three'; +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { CSS2DRenderer, CSS2DObject } from 'three/addons/renderers/CSS2DRenderer.js'; +import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js'; +import { RenderPass } from 'three/addons/postprocessing/RenderPass.js'; +import { UnrealBloomPass } from 'three/addons/postprocessing/UnrealBloomPass.js'; +import { OutputPass } from 'three/addons/postprocessing/OutputPass.js'; + +THREE.ColorManagement.enabled = false; + +const DEG = Math.PI / 180; +const SUN_DIR = new THREE.Vector3(1, 0, 0); +const MP_ALPHA = 0.6; // magnetopause flaring +const BS_SCALE = 1.35; // bow-shock stand-off relative to magnetopause +const BS_ALPHA = 0.8; + +// mp = visual magnetopause stand-off distance in planet radii (compressed). +// Moon fields: dist = visual orbit radius (compressed), realDist = real orbit radius in planet radii, +// period = orbital period in days (negative = retrograde), dia = diameter in km, +// foot = draw the flux tube and auroral footprint. +export const PLANET_CFG = { + earth: { + style: 0, tex: 'earth', radiusKm: 6371, obliquity: 23.4, dipoleTilt: 11, offset: [0, 0, 0], period: 24, mp: 4.5, + atmo: [0.35, 0.6, 1.0], field: [0.45, 0.8, 1.0], disc: 0, + aurora: { colat: 20, width: 2.6, c1: [0.15, 1.0, 0.45], c2: [1.0, 0.2, 0.35], patchy: 0.15, intensity: 1.5, height: 0.07 }, + rings: null, torus: null, + moons: [ + { key: 'moon', dist: 6.8, realDist: 60.3, period: 27.32, dia: 3474, incl: 5.1 } + ] + }, + jupiter: { + style: 1, tex: 'jupiter', radiusKm: 69911, obliquity: 3.1, dipoleTilt: 9.6, offset: [0, 0, 0], period: 9.93, mp: 10, + atmo: [0.9, 0.8, 0.65], field: [0.55, 0.75, 1.0], disc: 0.55, + aurora: { colat: 16, width: 2.0, c1: [0.75, 0.45, 1.0], c2: [1.0, 0.35, 0.85], patchy: 0.05, intensity: 1.9, height: 0.09 }, + rings: null, + torus: { r: 3.2, tube: 0.32, color: [1.0, 0.45, 0.25], label: 'lbl.torusJ' }, + moons: [ + { key: 'io', dist: 3.2, realDist: 5.9, period: 1.769, dia: 3643, foot: true }, + { key: 'europa', dist: 4.1, realDist: 9.4, period: 3.551, dia: 3122, foot: true }, + { key: 'ganymede', dist: 5.2, realDist: 15.0, period: 7.155, dia: 5268, foot: true }, + { key: 'callisto', dist: 6.6, realDist: 26.3, period: 16.69, dia: 4821 } + ] + }, + saturn: { + style: 2, tex: 'saturn', radiusKm: 58232, obliquity: 26.7, dipoleTilt: 0.0, offset: [0, 0.04, 0], period: 10.6, mp: 7.5, + atmo: [0.95, 0.85, 0.6], field: [0.5, 0.8, 1.0], disc: 0.25, + aurora: { colat: 15, width: 2.0, c1: [0.45, 0.6, 1.0], c2: [0.85, 0.4, 1.0], patchy: 0.35, intensity: 1.6, height: 0.08 }, + rings: { inner: 1.24, outer: 2.27, style: 0 }, + torus: { r: 2.9, tube: 0.42, color: [0.35, 0.6, 1.0], label: 'lbl.torusS' }, + moons: [ + { key: 'mimas', dist: 2.5, realDist: 3.08, period: 0.942, dia: 396 }, + { key: 'enceladus', dist: 2.9, realDist: 3.95, period: 1.370, dia: 504, foot: true }, + { key: 'tethys', dist: 3.35, realDist: 4.89, period: 1.888, dia: 1062 }, + { key: 'dione', dist: 3.85, realDist: 6.26, period: 2.737, dia: 1123 }, + { key: 'rhea', dist: 4.55, realDist: 8.74, period: 4.518, dia: 1527 }, + { key: 'titan', dist: 6.0, realDist: 20.3, period: 15.945, dia: 5149 }, + { key: 'iapetus', dist: 8.8, realDist: 59.1, period: 79.32, dia: 1469, incl: 15 } + ] + }, + uranus: { + style: 3, tex: 'uranus', radiusKm: 25362, obliquity: 97.8, dipoleTilt: 59, offset: [0.05, -0.3, 0.0], period: 17.24, mp: 6.5, + atmo: [0.6, 0.9, 1.0], field: [0.45, 0.95, 0.9], disc: 0, + aurora: { colat: 18, width: 3.0, c1: [0.4, 1.0, 0.9], c2: [1.0, 0.45, 0.8], patchy: 0.8, intensity: 1.6, height: 0.07 }, + rings: { inner: 1.6, outer: 2.0, style: 1 }, + torus: null, + moons: [ + { key: 'miranda', dist: 2.4, realDist: 5.08, period: 1.413, dia: 472, incl: 4.3 }, + { key: 'ariel', dist: 2.9, realDist: 7.47, period: 2.520, dia: 1158 }, + { key: 'umbriel', dist: 3.5, realDist: 10.4, period: 4.144, dia: 1169 }, + { key: 'titania', dist: 4.4, realDist: 17.1, period: 8.706, dia: 1577 }, + { key: 'oberon', dist: 5.4, realDist: 22.8, period: 13.46, dia: 1523 } + ] + }, + neptune: { + style: 4, tex: 'neptune', radiusKm: 24622, obliquity: 28.3, dipoleTilt: 46.9, offset: [0.17, -0.5, 0.1], period: 16.1, mp: 6.5, + atmo: [0.35, 0.55, 1.0], field: [0.45, 0.75, 1.0], disc: 0, + aurora: { colat: 18, width: 3.0, c1: [0.4, 0.85, 1.0], c2: [0.7, 0.5, 1.0], patchy: 0.85, intensity: 1.5, height: 0.07 }, + rings: { inner: 1.7, outer: 2.55, style: 2 }, + torus: null, + moons: [ + { key: 'triton', dist: 4.2, realDist: 14.4, period: -5.877, dia: 2707, incl: 23 } + ] + } +}; + +// Visual moon radius in planet radii: square-root scaling keeps small moons visible. +export function moonSize(planetCfg, m) { + return Math.max(0.035, 0.5 * Math.sqrt((m.dia / 2) / planetCfg.radiusKm)); +} + +// Featured moons for the page section (order matters). +export const FEATURED_MOONS = ['io', 'europa', 'ganymede', 'callisto', 'enceladus', 'titan', 'ariel', 'triton']; + +export function moonHost(key) { + return Object.keys(PLANET_CFG).find(p => PLANET_CFG[p].moons.some(m => m.key === key)); +} +export function moonData(key) { + const host = moonHost(key); + return host ? { host, ...PLANET_CFG[host].moons.find(m => m.key === key) } : null; +} + +const TEX_BASE = 'textures/'; +const texLoader = new THREE.TextureLoader(); +const texCache = new Map(); +function tex(name) { + if (!texCache.has(name)) { + const t = texLoader.load(TEX_BASE + name); + t.anisotropy = 8; + texCache.set(name, t); + } + return texCache.get(name); +} + +/* ------------------------------------------------------------------ GLSL */ + +const NOISE_GLSL = /* glsl */` +float hash3(vec3 p){ p = fract(p*0.3183099 + 0.1); p *= 17.0; return fract(p.x*p.y*p.z*(p.x+p.y+p.z)); } +float noise3(vec3 x){ + vec3 i = floor(x); vec3 f = fract(x); f = f*f*(3.0-2.0*f); + return mix(mix(mix(hash3(i+vec3(0,0,0)), hash3(i+vec3(1,0,0)), f.x), + mix(hash3(i+vec3(0,1,0)), hash3(i+vec3(1,1,0)), f.x), f.y), + mix(mix(hash3(i+vec3(0,0,1)), hash3(i+vec3(1,0,1)), f.x), + mix(hash3(i+vec3(0,1,1)), hash3(i+vec3(1,1,1)), f.x), f.y), f.z); +} +float fbm(vec3 p){ float a = 0.5, s = 0.0; for (int i = 0; i < 5; i++){ s += a*noise3(p); p *= 2.03; a *= 0.5; } return s; } +`; + +// Shared deformation: compress the dayside field to the magnetopause and stretch the nightside into a tail. +const DEFORM_GLSL = /* glsl */` +float shueR(float cosT, float r0, float a){ return r0 * pow(2.0 / max(1.0 + cosT, 0.04), a); } +float softTanh(float x){ float e = exp(2.0*clamp(x,-10.0,10.0)); return (e-1.0)/(e+1.0); } +vec3 deformMag(vec3 p, float mp){ + float r = length(p); + if (r < 1e-4) return p; + vec3 d = p / r; + float night = 1.0 - smoothstep(-0.6, 0.0, d.x); + float k = smoothstep(mp*0.45, mp*1.3, r); + p.x -= night * k * r * 1.3; + p.yz *= 1.0 - night * k * 0.35; + r = length(p); d = p / r; + float R = shueR(d.x, mp*0.97, ${MP_ALPHA.toFixed(2)}); + float x = r / R; + float xs = x < 0.6 ? x : 0.6 + 0.4 * softTanh((x - 0.6) / 0.4); + return d * xs * R; +} +`; + +function fieldLineMaterial(color, opacity, pulseSpeed = 0.35) { + return new THREE.ShaderMaterial({ + uniforms: { + uTime: { value: 0 }, uMp: { value: 5 }, uColor: { value: new THREE.Color(...color) }, + uOpacity: { value: opacity }, uSpeed: { value: pulseSpeed } + }, + vertexShader: /* glsl */` + uniform float uMp; + attribute float aT; attribute float aSeed; + varying float vT; varying float vSeed; varying float vFade; + ${DEFORM_GLSL} + void main(){ + vec3 p = (modelMatrix * vec4(position, 1.0)).xyz; + p = deformMag(p, uMp); + vT = aT; vSeed = aSeed; + vFade = 1.0 - smoothstep(uMp*2.6, uMp*4.0, length(p)); + gl_Position = projectionMatrix * viewMatrix * vec4(p, 1.0); + }`, + fragmentShader: /* glsl */` + uniform float uTime; uniform vec3 uColor; uniform float uOpacity; uniform float uSpeed; + varying float vT; varying float vSeed; varying float vFade; + void main(){ + float s = abs(vT - 0.5) * 2.0; // 0 at magnetic equator, 1 at the footpoints + float pulse = pow(fract(s*3.0 - uTime*uSpeed + vSeed), 12.0); + float base = 0.22 + 0.25*(1.0 - s); + vec3 col = uColor * (base + pulse * 2.2); + gl_FragColor = vec4(col * uOpacity * vFade, 1.0); + }`, + transparent: true, depthWrite: false, blending: THREE.AdditiveBlending + }); +} + +function planetMaterial(cfg) { + return new THREE.ShaderMaterial({ + uniforms: { + uStyle: { value: cfg.style }, uSun: { value: SUN_DIR.clone() }, + uAtmo: { value: new THREE.Vector3(...cfg.atmo) }, uMap: { value: tex(cfg.tex + '.jpg') } + }, + vertexShader: /* glsl */` + varying vec3 vObj; varying vec3 vWN; varying vec3 vWP; varying vec2 vUv; + void main(){ + vObj = position; vUv = uv; + vWN = normalize(mat3(modelMatrix) * normal); + vec4 wp = modelMatrix * vec4(position, 1.0); vWP = wp.xyz; + gl_Position = projectionMatrix * viewMatrix * wp; + }`, + fragmentShader: /* glsl */` + uniform int uStyle; uniform vec3 uSun; uniform vec3 uAtmo; uniform sampler2D uMap; + varying vec3 vObj; varying vec3 vWN; varying vec3 vWP; varying vec2 vUv; + ${NOISE_GLSL} + void main(){ + vec3 col = texture2D(uMap, vUv).rgb; + vec3 N = normalize(vWN); + float ndl = dot(N, uSun); + // soft terminator: gas giants scatter light a little past the day-night line + float diff = uStyle == 0 ? max(ndl, 0.0) : smoothstep(-0.08, 1.0, ndl); + vec3 lit = col * (0.02 + 0.92 * diff); + vec3 V = normalize(cameraPosition - vWP); + float rim = pow(1.0 - max(dot(N, V), 0.0), 3.0); + lit += uAtmo * rim * (0.05 + 0.6 * smoothstep(-0.2, 0.6, ndl)) * 0.5; + if (uStyle == 0){ + // city lights on the night side, only over land + float land = smoothstep(0.02, 0.1, max(col.r, col.g) - col.b); + vec3 n = normalize(vObj); + float night = 1.0 - smoothstep(-0.15, 0.08, ndl); + float city = land * smoothstep(0.6, 0.8, noise3(n * 70.0)) * (1.0 - smoothstep(0.65, 0.8, abs(n.y))); + lit += vec3(1.0, 0.72, 0.35) * city * night * 0.7; + } + gl_FragColor = vec4(lit, 1.0); + }` + }); +} + +function auroraMaterial(cfg, layer) { + const a = cfg.aurora; + return new THREE.ShaderMaterial({ + uniforms: { + uTime: { value: 0 }, uLayer: { value: layer }, + uNorth: { value: new THREE.Vector3(0, 1, 0) }, uSouth: { value: new THREE.Vector3(0, -1, 0) }, + uColat: { value: a.colat }, uWidth: { value: a.width }, uPatchy: { value: a.patchy }, + uIntensity: { value: a.intensity }, + uC1: { value: new THREE.Vector3(...a.c1) }, uC2: { value: new THREE.Vector3(...a.c2) }, + uFoot: { value: Array.from({ length: 6 }, () => new THREE.Vector3(0, 0, 0)) }, + uFootW: { value: new Array(6).fill(0) }, + uBoost: { value: 1 } + }, + vertexShader: /* glsl */` + varying vec3 vObj; varying vec3 vWN; varying vec3 vV; + void main(){ + vObj = position; + vWN = normalize(mat3(modelMatrix) * normal); + vec4 wp = modelMatrix * vec4(position, 1.0); + vV = cameraPosition - wp.xyz; + gl_Position = projectionMatrix * viewMatrix * wp; + }`, + fragmentShader: /* glsl */` + uniform float uTime, uLayer, uColat, uWidth, uPatchy, uIntensity, uBoost; + uniform vec3 uNorth, uSouth, uC1, uC2; + uniform vec3 uFoot[6]; uniform float uFootW[6]; + varying vec3 vObj; varying vec3 vWN; varying vec3 vV; + ${NOISE_GLSL} + float oval(vec3 n, vec3 pole, float seed){ + float c = degrees(acos(clamp(dot(n, pole), -1.0, 1.0))); + if (c > uColat * 2.2 + 8.0) return 0.0; + vec3 ref = abs(pole.y) < 0.9 ? vec3(0.0,1.0,0.0) : vec3(1.0,0.0,0.0); + vec3 t1 = normalize(cross(pole, ref)); vec3 t2 = cross(pole, t1); + float az = atan(dot(n, t2), dot(n, t1)); + vec2 cs = vec2(cos(az), sin(az)); + float w = (noise3(vec3(cs*1.7, uTime*0.07 + seed)) - 0.5) * uColat * 0.4; + float d = (c - uColat - w) / uWidth; + float ring = exp(-d*d); + float rays = 0.45 + 0.55 * noise3(vec3(cs*26.0, uTime*0.5 + seed)); + float patches = smoothstep(0.42, 0.75, noise3(vec3(cs*3.2, uTime*0.12 + seed))) * 2.2; + float patchMix = mix(1.0, patches, uPatchy); + float polar = (1.0 - smoothstep(0.0, uColat*0.85, c)) * pow(noise3(n*8.0 + vec3(0.0, uTime*0.35, seed)), 3.0) * 1.4; + return ring * rays * patchMix + polar * (1.0 - uPatchy); + } + void main(){ + vec3 n = normalize(vObj); + float a = oval(n, uNorth, 0.0) + oval(n, uSouth, 7.3); + for (int i = 0; i < 6; i++){ + float dd = length(n - uFoot[i]); + a += uFootW[i] * exp(-dd*dd / 0.0009) * 2.5; + } + float layerFade = pow(1.0 - uLayer, 1.5); + vec3 N = normalize(vWN); + float mu = abs(dot(N, normalize(vV))); + float limb = 0.45 + 0.9 * (1.0 - mu); + vec3 col = mix(uC1, uC2, smoothstep(0.0, 1.0, uLayer)); + gl_FragColor = vec4(col * a * layerFade * limb * uIntensity * uBoost * 0.32, 1.0); + }`, + transparent: true, depthWrite: false, blending: THREE.AdditiveBlending + }); +} + +function boundaryMaterial(color, strength, tail) { + return new THREE.ShaderMaterial({ + uniforms: { uTime: { value: 0 }, uColor: { value: new THREE.Color(...color) }, uStrength: { value: strength }, uTail: { value: tail } }, + vertexShader: /* glsl */` + varying vec3 vN; varying vec3 vV; varying vec3 vP; + void main(){ + vec4 wp = modelMatrix * vec4(position, 1.0); + vP = wp.xyz; vN = normalize(mat3(modelMatrix) * normal); vV = cameraPosition - wp.xyz; + gl_Position = projectionMatrix * viewMatrix * wp; + }`, + fragmentShader: /* glsl */` + uniform float uTime, uStrength, uTail; uniform vec3 uColor; + varying vec3 vN; varying vec3 vV; varying vec3 vP; + void main(){ + float f = pow(1.0 - abs(dot(normalize(vN), normalize(vV))), 2.2); + float waves = 0.75 + 0.25 * sin(vP.x * 1.2 + uTime * 2.0 + sin(vP.y * 0.8) * 2.0); + float fade = smoothstep(-uTail, -uTail * 0.55, vP.x); + float a = (f * 0.85 + 0.03) * waves * fade * uStrength; + gl_FragColor = vec4(uColor * a, 1.0); + }`, + transparent: true, depthWrite: false, blending: THREE.AdditiveBlending, side: THREE.DoubleSide + }); +} + +function torusMaterial(color) { + return new THREE.ShaderMaterial({ + uniforms: { uTime: { value: 0 }, uColor: { value: new THREE.Vector3(...color) } }, + vertexShader: /* glsl */` + varying vec3 vN; varying vec3 vV; varying vec3 vObj; + void main(){ + vObj = position; + vec4 mv = modelViewMatrix * vec4(position, 1.0); + vN = normalize(normalMatrix * normal); vV = normalize(-mv.xyz); + gl_Position = projectionMatrix * mv; + }`, + fragmentShader: /* glsl */` + uniform float uTime; uniform vec3 uColor; + varying vec3 vN; varying vec3 vV; varying vec3 vObj; + ${NOISE_GLSL} + void main(){ + float f = abs(dot(normalize(vN), normalize(vV))); + float n = noise3(vObj * 3.0 + vec3(0.0, 0.0, uTime * 0.2)); + float g = pow(f, 1.6) * (0.5 + 0.9 * n); + gl_FragColor = vec4(uColor * g * 0.32, 1.0); + }`, + transparent: true, depthWrite: false, blending: THREE.AdditiveBlending + }); +} + +function ringMaterial(cfg) { + return new THREE.ShaderMaterial({ + uniforms: { + uInner: { value: cfg.rings.inner }, uOuter: { value: cfg.rings.outer }, + uStyle: { value: cfg.rings.style }, uSun: { value: SUN_DIR.clone() }, + uRing: { value: cfg.rings.style === 0 ? tex('saturn_ring.png') : null } + }, + vertexShader: /* glsl */` + varying vec3 vObj; varying vec3 vWP; + void main(){ + vObj = position; + vec4 wp = modelMatrix * vec4(position, 1.0); vWP = wp.xyz; + gl_Position = projectionMatrix * viewMatrix * wp; + }`, + fragmentShader: /* glsl */` + uniform float uInner, uOuter; uniform int uStyle; uniform vec3 uSun; uniform sampler2D uRing; + varying vec3 vObj; varying vec3 vWP; + void main(){ + float r = length(vObj.xy); + float t = (r - uInner) / (uOuter - uInner); + float dens; vec3 col; + if (uStyle == 0){ + vec4 tx = texture2D(uRing, vec2(clamp(t, 0.0, 1.0), 0.5)); + dens = tx.a; col = tx.rgb; + } else { + float ringlets = 0.0; + for (int i = 0; i < 6; i++){ + float c = 0.08 + float(i) * 0.17; + ringlets += exp(-pow((t - c) / 0.012, 2.0)); + } + dens = ringlets * (uStyle == 1 ? 0.45 : 0.25); + col = vec3(0.55, 0.6, 0.65); + } + float along = dot(vWP, uSun); + float perp = length(vWP - along * uSun); + float shadow = (along < 0.0 && perp < 1.0) ? 0.08 : 1.0; + gl_FragColor = vec4(col * shadow, dens); + }`, + transparent: true, depthWrite: false, side: THREE.DoubleSide + }); +} + +/* ------------------------------------------------------------- helpers */ + +function shue(cosT, r0, a) { return r0 * Math.pow(2 / Math.max(1 + cosT, 0.04), a); } + +function deformMagJS(p, mp) { + // CPU copy of the GLSL deformation, used to place labels and moons' flux tubes consistently. + let r = p.length(); + if (r < 1e-4) return p; + let d = p.clone().divideScalar(r); + const sm = (e0, e1, x) => { const t = Math.min(1, Math.max(0, (x - e0) / (e1 - e0))); return t * t * (3 - 2 * t); }; + const night = 1 - sm(-0.6, 0, d.x); + const k = sm(mp * 0.45, mp * 1.3, r); + p.x -= night * k * r * 1.3; + p.y *= 1 - night * k * 0.35; p.z *= 1 - night * k * 0.35; + r = p.length(); d = p.clone().divideScalar(r); + const R = shue(d.x, mp * 0.97, MP_ALPHA); + const x = r / R; + const xs = x < 0.6 ? x : 0.6 + 0.4 * Math.tanh((x - 0.6) / 0.4); + return d.multiplyScalar(xs * R); +} + +function boundaryGeometry(r0, alpha, tailLen) { + // Surface of revolution around the X axis (Shue et al. magnetopause shape), open at the tail. + let thMax = 0; + for (let th = 0; th < 175 * DEG; th += 0.25 * DEG) { + thMax = th; + if (shue(Math.cos(th), r0, alpha) * Math.cos(th) < -tailLen) break; + } + const nT = 90, nP = 96; + const pos = [], idx = []; + for (let i = 0; i <= nT; i++) { + const th = thMax * i / nT; + const r = shue(Math.cos(th), r0, alpha); + for (let j = 0; j <= nP; j++) { + const ph = 2 * Math.PI * j / nP; + pos.push(r * Math.cos(th), r * Math.sin(th) * Math.cos(ph), r * Math.sin(th) * Math.sin(ph)); + } + } + for (let i = 0; i < nT; i++) for (let j = 0; j < nP; j++) { + const a = i * (nP + 1) + j, b = a + nP + 1; + idx.push(a, b, a + 1, b, b + 1, a + 1); + } + const g = new THREE.BufferGeometry(); + g.setAttribute('position', new THREE.Float32BufferAttribute(pos, 3)); + g.setIndex(idx); + g.computeVertexNormals(); + return g; +} + +function fieldLineGeometry(cfg) { + const pos = [], aT = [], aSeed = []; + const Ls = [0.26, 0.38, 0.52, 0.7, 0.9, 1.25, 1.9, 3.0].map(f => Math.max(1.25, f * cfg.mp)); + const nLon = 10, N = 110; + Ls.forEach((L, li) => { + const th0 = Math.asin(Math.min(1, Math.sqrt(1 / L))); + for (let j = 0; j < nLon; j++) { + const phi = (j / nLon) * 2 * Math.PI + li * 0.26; + const seed = Math.random(); + let prev = null; + for (let i = 0; i <= N; i++) { + const u = i / N; + const th = th0 + (Math.PI - 2 * th0) * u; + const s = Math.sin(th); + let r = L * s * s; + if (cfg.disc) r *= 1 + cfg.disc * Math.pow(s, 10) * Math.min(1, L / cfg.mp); + const x = r * s * Math.cos(phi), y = r * Math.cos(th), z = r * s * Math.sin(phi); + if (prev) { pos.push(prev[0], prev[1], prev[2], x, y, z); aT.push(prev[3], u); aSeed.push(seed, seed); } + prev = [x, y, z, u]; + } + } + }); + const g = new THREE.BufferGeometry(); + g.setAttribute('position', new THREE.Float32BufferAttribute(pos, 3)); + g.setAttribute('aT', new THREE.Float32BufferAttribute(aT, 1)); + g.setAttribute('aSeed', new THREE.Float32BufferAttribute(aSeed, 1)); + return g; +} + +function glowTexture(inner = 'rgba(255,255,255,1)', outer = 'rgba(255,255,255,0)') { + const c = document.createElement('canvas'); c.width = c.height = 128; + const g = c.getContext('2d'); + const grd = g.createRadialGradient(64, 64, 0, 64, 64, 64); + grd.addColorStop(0, inner); grd.addColorStop(0.25, inner.replace(/[\d.]+\)$/, '0.6)')); grd.addColorStop(1, outer); + g.fillStyle = grd; g.fillRect(0, 0, 128, 128); + const t = new THREE.CanvasTexture(c); + return t; +} + +function makeLabel(key, cls = '') { + const el = document.createElement('div'); + el.className = 'scene-label ' + cls; + el.dataset.key = key; + const obj = new CSS2DObject(el); + obj.userData.labelKey = key; + return obj; +} + +/* --------------------------------------------------------------- scene */ + +export function createScene(container, { t = k => k, onPlanetChange = () => {}, onSelect = () => {} } = {}) { + const renderer = new THREE.WebGLRenderer({ antialias: true, powerPreference: 'high-performance' }); + renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2)); + renderer.outputColorSpace = THREE.LinearSRGBColorSpace; + renderer.setClearColor(0x02030a, 1); + container.appendChild(renderer.domElement); + + const labelRenderer = new CSS2DRenderer(); + labelRenderer.domElement.className = 'label-layer'; + container.appendChild(labelRenderer.domElement); + + const scene = new THREE.Scene(); + const camera = new THREE.PerspectiveCamera(45, 1, 0.05, 3000); + camera.position.set(6, 3, 18); + + const controls = new OrbitControls(camera, renderer.domElement); + controls.enableDamping = true; + controls.dampingFactor = 0.06; + controls.minDistance = 1.5; + controls.maxDistance = 120; + controls.autoRotate = false; + + const composer = new EffectComposer(renderer); + composer.addPass(new RenderPass(scene, camera)); + const bloom = new UnrealBloomPass(new THREE.Vector2(256, 256), 0.65, 0.5, 0.9); + composer.addPass(bloom); + composer.addPass(new OutputPass()); + + scene.add(new THREE.AmbientLight(0xffffff, 0.06)); + const sunLight = new THREE.DirectionalLight(0xffffff, 1.6); + sunLight.position.copy(SUN_DIR).multiplyScalar(100); + scene.add(sunLight); + + // Milky Way backdrop + stars + { + const sky = new THREE.Mesh(new THREE.SphereGeometry(1500, 64, 32), new THREE.MeshBasicMaterial({ map: tex('milkyway.jpg'), side: THREE.BackSide, depthWrite: false, color: 0xb0b0c0 })); + sky.rotation.set(0.5, 0, 0.9); + scene.add(sky); + } + { + const n = 2500, p = new Float32Array(n * 3), c = new Float32Array(n * 3); + for (let i = 0; i < n; i++) { + const v = new THREE.Vector3().randomDirection().multiplyScalar(900 + Math.random() * 300); + p.set([v.x, v.y, v.z], i * 3); + const b = 0.4 + Math.random() * 0.6, tint = Math.random(); + c.set([b * (0.85 + 0.15 * tint), b * 0.9, b * (1.0 - 0.15 * tint)], i * 3); + } + const g = new THREE.BufferGeometry(); + g.setAttribute('position', new THREE.BufferAttribute(p, 3)); + g.setAttribute('color', new THREE.BufferAttribute(c, 3)); + scene.add(new THREE.Points(g, new THREE.PointsMaterial({ size: 1.6, sizeAttenuation: false, vertexColors: true, depthWrite: false }))); + } + + // Sun glow (far away in +X) + const sun = new THREE.Sprite(new THREE.SpriteMaterial({ map: glowTexture('rgba(255,236,190,1)', 'rgba(255,170,60,0)'), blending: THREE.AdditiveBlending, depthWrite: false })); + sun.position.set(400, 0, 0); sun.scale.set(90, 90, 1); + scene.add(sun); + + const dotTex = glowTexture(); + const state = { + name: null, cfg: null, root: null, time: 0, speed: 1, + layers: { field: true, wind: true, mp: true, aurora: true, torus: true, moons: true, labels: true }, + objs: {}, tween: null, auroraBoost: 1, follow: null + }; + + /* ---------------------------------------------------- build a planet */ + function disposeRoot() { + if (!state.root) return; + state.root.traverse(o => { + if (o.geometry) o.geometry.dispose(); + if (o.material) (Array.isArray(o.material) ? o.material : [o.material]).forEach(m => m.dispose()); + if (o.isCSS2DObject && o.element.parentNode) o.element.parentNode.removeChild(o.element); + }); + scene.remove(state.root); + state.root = null; + } + + function build(name) { + disposeRoot(); + const cfg = PLANET_CFG[name]; + state.name = name; state.cfg = cfg; + const root = new THREE.Group(); + const tilt = new THREE.Group(); + tilt.rotation.z = -cfg.obliquity * DEG; // lean the spin axis towards/away from the Sun + const spin = new THREE.Group(); + tilt.add(spin); root.add(tilt); + + const planet = new THREE.Mesh(new THREE.SphereGeometry(1, 128, 64), planetMaterial(cfg)); + spin.add(planet); + planet.userData.pick = { type: 'planet' }; + let clouds = null; + if (cfg.style === 0) { + clouds = new THREE.Mesh(new THREE.SphereGeometry(1.012, 96, 48), new THREE.MeshLambertMaterial({ color: 0xffffff, alphaMap: tex('earth_clouds.jpg'), transparent: true, depthWrite: false, opacity: 0.9 })); + spin.add(clouds); + } + + // Magnetic frame (rotates with the planet, tilted and offset dipole) + const mag = new THREE.Group(); + mag.position.set(...cfg.offset); + mag.rotation.z = cfg.dipoleTilt * DEG; + spin.add(mag); + const fieldMat = fieldLineMaterial(cfg.field, 0.42); + fieldMat.uniforms.uMp.value = cfg.mp; + const field = new THREE.LineSegments(fieldLineGeometry(cfg), fieldMat); + field.frustumCulled = false; + mag.add(field); + + // Aurora poles in spin-frame coordinates + const axis = new THREE.Vector3(0, 1, 0).applyEuler(mag.rotation); + const off = new THREE.Vector3(...cfg.offset); + const north = axis.clone().add(off.clone().multiplyScalar(0.8)).normalize(); + const south = axis.clone().negate().add(off.clone().multiplyScalar(0.8)).normalize(); + const auroraGroup = new THREE.Group(); + const auroraMats = []; + const nShell = 9; + for (let i = 0; i < nShell; i++) { + const layer = i / (nShell - 1); + const m = auroraMaterial(cfg, layer); + m.uniforms.uNorth.value.copy(north); m.uniforms.uSouth.value.copy(south); + const shell = new THREE.Mesh(new THREE.SphereGeometry(1.004 + layer * cfg.aurora.height, 128, 64), m); + shell.renderOrder = 2; + auroraGroup.add(shell); auroraMats.push(m); + } + spin.add(auroraGroup); + + // Rings + let rings = null; + if (cfg.rings) { + rings = new THREE.Mesh(new THREE.RingGeometry(cfg.rings.inner, cfg.rings.outer, 256, 1), ringMaterial(cfg)); + rings.rotation.x = -Math.PI / 2; + rings.renderOrder = 1; + tilt.add(rings); + } + + // Plasma torus (follows the tilted magnetic/centrifugal equator, so it wobbles) + let torus = null; + if (cfg.torus) { + const pivot = new THREE.Group(); + pivot.rotation.z = cfg.dipoleTilt * DEG * 0.66; + torus = new THREE.Mesh(new THREE.TorusGeometry(cfg.torus.r, cfg.torus.tube, 48, 160), torusMaterial(cfg.torus.color)); + torus.rotation.x = Math.PI / 2; + torus.scale.set(1, 1, 0.65); + pivot.add(torus); + const lab = makeLabel(cfg.torus.label, 'torus'); + lab.position.set(0, 0, 0); + const labHolder = new THREE.Object3D(); labHolder.position.set(-cfg.torus.r * 0.75, cfg.torus.r * 0.75, cfg.torus.tube); + pivot.add(labHolder); labHolder.add(lab); + spin.add(pivot); + torus.userData.pivot = pivot; torus.userData.label = lab; + } + + // Moons and flux tubes + const moons = []; + cfg.moons.forEach((m, mi) => { + m = { ...m, size: moonSize(cfg, m), phase: m.phase ?? (0.7 + mi * 2.4) }; + const holder = new THREE.Group(); + if (m.incl) holder.rotation.x = m.incl * DEG; + const mesh = new THREE.Mesh(new THREE.SphereGeometry(m.size, 48, 24), new THREE.MeshStandardMaterial({ map: tex(m.key + '.jpg'), roughness: 1, metalness: 0 })); + mesh.userData.pick = { type: 'moon', key: m.key }; + // invisible, larger hit sphere so small moons are easy to click + const hit = new THREE.Mesh(new THREE.SphereGeometry(Math.max(m.size * 1.8, 0.14), 12, 8), new THREE.MeshBasicMaterial({ visible: false })); + hit.userData.pick = mesh.userData.pick; + mesh.add(hit); + holder.add(mesh); + tilt.add(holder); + const label = makeLabel('moons.' + m.key, 'moon'); + label.position.set(0, m.size + 0.1, 0); + mesh.add(label); + let tube = null; + if (m.foot) { + const n = 81; + const g = new THREE.BufferGeometry(); + g.setAttribute('position', new THREE.BufferAttribute(new Float32Array(n * 3), 3)); + const at = new Float32Array(n); for (let i = 0; i < n; i++) at[i] = i / (n - 1); + g.setAttribute('aT', new THREE.BufferAttribute(at, 1)); + g.setAttribute('aSeed', new THREE.BufferAttribute(new Float32Array(n), 1)); + const tm = fieldLineMaterial([1.0, 0.85, 0.45], 1.6, 0.9); + tm.uniforms.uMp.value = cfg.mp; + tube = new THREE.Line(g, tm); + tube.frustumCulled = false; + root.add(tube); + } + moons.push({ cfg: m, holder, mesh, tube, label }); + }); + + // Boundaries (fixed in the Sun-planet frame) + const tailLen = cfg.mp * 3.6; + const mpMesh = new THREE.Mesh(boundaryGeometry(cfg.mp, MP_ALPHA, tailLen), boundaryMaterial([0.3, 0.7, 1.0], 0.3, tailLen)); + const bsMesh = new THREE.Mesh(boundaryGeometry(cfg.mp * BS_SCALE, BS_ALPHA, tailLen * 0.7), boundaryMaterial([1.0, 0.55, 0.25], 0.18, tailLen * 0.7)); + mpMesh.renderOrder = 3; bsMesh.renderOrder = 3; + const boundaries = new THREE.Group(); + boundaries.add(mpMesh, bsMesh); + { + const th = 38 * DEG, r = shue(Math.cos(th), cfg.mp, MP_ALPHA); + const l1 = makeLabel('lbl.mp', 'mp'); l1.position.set(r * Math.cos(th), r * Math.sin(th), 0); boundaries.add(l1); + const th2 = 30 * DEG, r2 = shue(Math.cos(th2), cfg.mp * BS_SCALE, BS_ALPHA); + const l2 = makeLabel('lbl.bs', 'bs'); l2.position.set(r2 * Math.cos(th2), -r2 * Math.sin(th2), 0); boundaries.add(l2); + const l3 = makeLabel('lbl.tail', 'tail'); l3.position.set(-cfg.mp * 2.4, cfg.mp * 0.25, 0); boundaries.add(l3); + } + root.add(boundaries); + + // Solar wind particles + const N = 2600; + const wpos = new Float32Array(N * 3), wcol = new Float32Array(N * 3), wvel = new Float32Array(N); + const spawnX = cfg.mp * 3.2, spawnR = cfg.mp * 2.6, endX = -tailLen * 0.9; + const respawn = (i, anywhere) => { + const a = Math.random() * Math.PI * 2, rr = Math.sqrt(Math.random()) * spawnR; + wpos[i * 3] = anywhere ? endX + Math.random() * (spawnX - endX) : spawnX + Math.random() * 2; + wpos[i * 3 + 1] = Math.cos(a) * rr; wpos[i * 3 + 2] = Math.sin(a) * rr; + wvel[i] = 0.8 + Math.random() * 0.4; + }; + for (let i = 0; i < N; i++) respawn(i, true); + const wg = new THREE.BufferGeometry(); + wg.setAttribute('position', new THREE.BufferAttribute(wpos, 3)); + wg.setAttribute('color', new THREE.BufferAttribute(wcol, 3)); + const wind = new THREE.Points(wg, new THREE.PointsMaterial({ size: cfg.mp * 0.045, map: dotTex, vertexColors: true, transparent: true, depthWrite: false, blending: THREE.AdditiveBlending })); + wind.frustumCulled = false; + const windLabel = makeLabel('lbl.wind', 'wind'); + windLabel.position.set(spawnX * 0.8, cfg.mp * 1.15, 0); + wind.add(windLabel); + root.add(wind); + + scene.add(root); + state.root = root; + state.objs = { tilt, spin, mag, planet, clouds, field, auroraGroup, auroraMats, rings, torus, moons, boundaries, mpMesh, bsMesh, wind, wpos, wcol, wvel, respawn, spawnX, endX, north, south }; + state.time = 0; + applyLayers(); + refreshLabels(); + onPlanetChange(name); + } + + /* ------------------------------------------------------------ update */ + const tmpV = new THREE.Vector3(), tmpW = new THREE.Vector3(), magInv = new THREE.Matrix4(); + + function updateMoons() { + const { moons, mag, spin, auroraMats } = state.objs; + const feet = [], weights = []; + mag.updateWorldMatrix(true, false); + magInv.copy(mag.matrixWorld).invert(); + moons.forEach(mo => { + const m = mo.cfg; + const ang = m.phase + (2 * Math.PI / (m.period * 24)) * state.time; + mo.mesh.position.set(m.dist * Math.cos(ang), 0, -m.dist * Math.sin(ang)); + mo.mesh.rotation.y = ang + Math.PI; // tidally locked: the same face always looks at the planet + if (!mo.tube) return; + mo.mesh.getWorldPosition(tmpW); + const local = tmpV.copy(tmpW).applyMatrix4(magInv); + const r = local.length(); + const th = Math.acos(THREE.MathUtils.clamp(local.y / r, -1, 1)); + const s = Math.sin(th); + const L = r / Math.max(s * s, 1e-3); + const phi = Math.atan2(local.z, local.x); + const th0 = Math.asin(Math.min(1, Math.sqrt(1 / L))); + const arr = mo.tube.geometry.attributes.position.array; + const n = arr.length / 3; + for (let i = 0; i < n; i++) { + const tt = th0 + (Math.PI - 2 * th0) * (i / (n - 1)); + const ss = Math.sin(tt), rr = L * ss * ss; + const p = new THREE.Vector3(rr * ss * Math.cos(phi), rr * Math.cos(tt), rr * ss * Math.sin(phi)).applyMatrix4(mag.matrixWorld); + arr[i * 3] = p.x; arr[i * 3 + 1] = p.y; arr[i * 3 + 2] = p.z; + } + mo.tube.geometry.attributes.position.needsUpdate = true; + // Footprints on the surface, expressed in the spin frame (aurora shells live there) + [th0, Math.PI - th0].forEach(tf => { + const p = new THREE.Vector3(Math.sin(tf) * Math.cos(phi), Math.cos(tf), Math.sin(tf) * Math.sin(phi)).applyMatrix4(mag.matrixWorld); + spin.worldToLocal(p); p.normalize(); + feet.push(p); weights.push(m.key === 'io' || m.key === 'enceladus' ? 1.0 : 0.6); + }); + }); + auroraMats.forEach(mat => { + for (let i = 0; i < 6; i++) { + if (feet[i]) { mat.uniforms.uFoot.value[i].copy(feet[i]); mat.uniforms.uFootW.value[i] = state.layers.moons ? weights[i] : 0; } + else mat.uniforms.uFootW.value[i] = 0; + } + }); + } + + function updateWind(dt) { + if (!state.layers.wind) return; + const { wpos, wcol, wvel, respawn, endX } = state.objs; + const mp = state.cfg.mp; + const speed = mp * 0.55 * dt * Math.max(0.25, Math.min(state.speed, 3)); + const n = wvel.length; + for (let i = 0; i < n; i++) { + const ix = i * 3; + let x = wpos[ix], y = wpos[ix + 1], z = wpos[ix + 2]; + let r = Math.hypot(x, y, z); + let c = x / r; + const rbs = shue(c, mp * BS_SCALE, BS_ALPHA); + const inSheath = r < rbs; + x -= speed * wvel[i] * (inSheath ? 0.5 : 1); + r = Math.hypot(x, y, z); c = x / r; + const rmp = shue(c, mp * 1.03, MP_ALPHA); + if (r < rmp) { + const k = rmp * 1.01 / r; + x *= k; y *= k; z *= k; + if (Math.abs(y) + Math.abs(z) < 0.05 * mp) { y += (Math.random() - 0.5) * 0.2; z += (Math.random() - 0.5) * 0.2; } + } + wpos[ix] = x; wpos[ix + 1] = y; wpos[ix + 2] = z; + if (x < endX) respawn(i, false); + if (inSheath) { wcol[ix] = 1.0; wcol[ix + 1] = 0.55; wcol[ix + 2] = 0.25; } + else { wcol[ix] = 1.0; wcol[ix + 1] = 0.9; wcol[ix + 2] = 0.6; } + } + state.objs.wind.geometry.attributes.position.needsUpdate = true; + state.objs.wind.geometry.attributes.color.needsUpdate = true; + } + + function applyLayers() { + const o = state.objs, L = state.layers; + if (!o.field) return; + o.field.visible = L.field; + o.wind.visible = L.wind; + o.boundaries.visible = L.mp; + o.auroraGroup.visible = L.aurora; + if (o.torus) o.torus.userData.pivot.visible = L.torus; + o.moons.forEach(m => { m.holder.visible = L.moons; if (m.tube) m.tube.visible = L.moons && L.field; }); + labelRenderer.domElement.style.display = L.labels ? '' : 'none'; + // CSS2D labels only honour their own visibility flag, so mirror the parent's layer state. + const showIf = (obj, v) => obj.traverse(x => { if (x.isCSS2DObject) x.visible = v; }); + showIf(o.boundaries, L.mp); + showIf(o.wind, L.wind); + if (o.torus) showIf(o.torus.userData.pivot, L.torus); + o.moons.forEach(m => showIf(m.holder, L.moons)); + } + + function refreshLabels() { + if (!state.root) return; + state.root.traverse(o => { if (o.isCSS2DObject) o.element.textContent = t(o.userData.labelKey); }); + } + + /* ----------------------------------------------------------- camera */ + function presetFor(view) { + const mp = state.cfg.mp; + if (view === 'overview') return { pos: new THREE.Vector3(mp * 0.7, mp * 1.1, mp * 2.9), target: new THREE.Vector3(-mp * 0.3, 0, 0) }; + if (view === 'mid') return { pos: new THREE.Vector3(3.5, 4.2, 9.5), target: new THREE.Vector3(0, 0, 0) }; + if (view === 'close') return { pos: new THREE.Vector3(2.6, 1.3, 4.6), target: new THREE.Vector3(0, 0, 0) }; + const { spin } = state.objs; + const pole = (view === 'south' ? state.objs.south : state.objs.north).clone(); + spin.updateWorldMatrix(true, false); + pole.applyMatrix3(new THREE.Matrix3().setFromMatrix4(spin.matrixWorld)).normalize(); + // look at the pole from above, slightly from the night side so the oval stands out + const side = new THREE.Vector3(-1, 0, 0.35).normalize(); + const pos = pole.clone().multiplyScalar(3.6).add(side.multiplyScalar(1.1)); + return { pos, target: pole.clone().multiplyScalar(0.25) }; + } + + function view(name, instant = false) { + state.follow = null; + controls.minDistance = 1.5; + const p = presetFor(name); + state.auroraBoost = (name === 'aurora' || name === 'south') ? 1.25 : 1; + if (instant) { camera.position.copy(p.pos); controls.target.copy(p.target); controls.update(); return; } + state.tween = { from: camera.position.clone(), fromT: controls.target.clone(), to: p.pos, toT: p.target, t: 0, dur: 1.8 }; + } + + /* --------------------------------------------------- moons: focus/pick */ + const followPos = new THREE.Vector3(); + function moonEntry(key) { return state.objs.moons?.find(m => m.cfg.key === key); } + function moonOffset(mo) { + // look at the moon from its sunlit side, a little above the orbit plane, with the planet in view + mo.mesh.getWorldPosition(followPos); + const out = followPos.clone().normalize(); + const d = Math.max(mo.cfg.size * 9, 0.7); + return out.multiplyScalar(0.55).add(new THREE.Vector3(0.45, 0.4, 0.5)).normalize().multiplyScalar(d); + } + function focusMoon(key, instant = false) { + const mo = moonEntry(key); + if (!mo) return false; + if (!state.layers.moons) { state.layers.moons = true; applyLayers(); } + state.follow = mo; + controls.minDistance = 0.15; + state.auroraBoost = 1; + if (instant) { + mo.mesh.getWorldPosition(followPos); const tgt = followPos.clone(); + camera.position.copy(tgt).add(moonOffset(mo)); controls.target.copy(tgt); mo.last = tgt.clone(); controls.update(); return true; + } + state.tween = { from: camera.position.clone(), fromT: controls.target.clone(), t: 0, dur: 2.0, + dyn: () => { mo.mesh.getWorldPosition(followPos); const tgt = followPos.clone(); return { toT: tgt, to: tgt.clone().add(moonOffset(mo)) }; } }; + return true; + } + + const raycaster = new THREE.Raycaster(); + const pointer = new THREE.Vector2(); + let downAt = null; + renderer.domElement.addEventListener('pointerdown', e => { downAt = [e.clientX, e.clientY]; }); + renderer.domElement.addEventListener('pointerup', e => { + if (!downAt || Math.hypot(e.clientX - downAt[0], e.clientY - downAt[1]) > 6 || !state.root) return; + const r = renderer.domElement.getBoundingClientRect(); + pointer.set(((e.clientX - r.left) / r.width) * 2 - 1, -((e.clientY - r.top) / r.height) * 2 + 1); + raycaster.setFromCamera(pointer, camera); + const targets = [state.objs.planet]; + if (state.layers.moons) state.objs.moons.forEach(m => targets.push(m.mesh)); + const hit = raycaster.intersectObjects(targets, true).find(h => h.object.userData.pick); + if (hit) onSelect(hit.object.userData.pick); + }); + renderer.domElement.addEventListener('pointermove', e => { + if (e.buttons || !state.root) return; + const r = renderer.domElement.getBoundingClientRect(); + pointer.set(((e.clientX - r.left) / r.width) * 2 - 1, -((e.clientY - r.top) / r.height) * 2 + 1); + raycaster.setFromCamera(pointer, camera); + const targets = state.layers.moons ? state.objs.moons.map(m => m.mesh) : []; + renderer.domElement.style.cursor = raycaster.intersectObjects(targets, true).length ? 'pointer' : ''; + }); + + /* ------------------------------------------------------------- loop */ + function resize() { + const w = container.clientWidth, h = container.clientHeight; + if (!w || !h) return; + renderer.setSize(w, h, false); + labelRenderer.setSize(w, h); + composer.setSize(w, h); + bloom.setSize(w / 2, h / 2); + camera.aspect = w / h; + camera.updateProjectionMatrix(); + } + new ResizeObserver(resize).observe(container); + + let visible = true; + new IntersectionObserver(es => { visible = es[0].isIntersecting; }).observe(container); + + const clock = new THREE.Clock(); + function frame() { + requestAnimationFrame(frame); + const dt = Math.min(clock.getDelta(), 0.05); + if (!visible || !state.root) return; + const cfg = state.cfg, o = state.objs; + // simulated hours advance: one Jupiter day ≈ 24 s at speed 1 + const dtHours = dt * 0.42 * state.speed; + state.time += dtHours; + o.spin.rotation.y = (2 * Math.PI / cfg.period) * state.time; + const tsec = clock.elapsedTime; + o.field.material.uniforms.uTime.value = tsec; + o.auroraMats.forEach(m => { m.uniforms.uTime.value = tsec; m.uniforms.uBoost.value += (state.auroraBoost - m.uniforms.uBoost.value) * 0.05; }); + if (o.clouds) o.clouds.rotation.y += dt * 0.004 * state.speed; + o.mpMesh.material.uniforms.uTime.value = tsec; + o.bsMesh.material.uniforms.uTime.value = tsec; + if (o.torus) o.torus.material.uniforms.uTime.value = tsec; + o.moons.forEach(m => { if (m.tube) m.tube.material.uniforms.uTime.value = tsec; }); + updateMoons(); + updateWind(dt); + + if (state.follow && !state.tween) { + // keep the camera locked to a moving moon + const prev = state.follow.last || followPos.clone(); + state.follow.mesh.getWorldPosition(followPos); + const delta = followPos.clone().sub(prev); + camera.position.add(delta); controls.target.add(delta); + state.follow.last = followPos.clone(); + } + if (state.tween) { + const tw = state.tween; + if (tw.dyn) { const d = tw.dyn(); tw.to = d.to; tw.toT = d.toT; } + tw.t = Math.min(1, tw.t + dt / tw.dur); + const e = tw.t < 0.5 ? 4 * tw.t ** 3 : 1 - Math.pow(-2 * tw.t + 2, 3) / 2; + camera.position.lerpVectors(tw.from, tw.to, e); + controls.target.lerpVectors(tw.fromT, tw.toT, e); + if (tw.t >= 1) { state.tween = null; if (state.follow) { state.follow.mesh.getWorldPosition(followPos); state.follow.last = followPos.clone(); } } + } + controls.update(); + composer.render(); + labelRenderer.render(scene, camera); + } + + resize(); + frame(); + + return { + setPlanet(name, { keepView = false, instant = false } = {}) { state.follow = null; controls.minDistance = 1.5; build(name); if (!keepView) view('overview', instant); }, + focusMoon, + setLayer(k, v) { state.layers[k] = v; applyLayers(); }, + setLayers(obj) { Object.assign(state.layers, obj); applyLayers(); }, + getLayers() { return { ...state.layers }; }, + setSpeed(s) { state.speed = s; }, + view, + refreshLabels, + get planet() { return state.name; }, + deformMagJS + }; +} diff --git a/models/cassini.glb b/models/cassini.glb new file mode 100644 index 0000000000000000000000000000000000000000..7032b252916405276bdd888c449ac3f4c96144f7 --- /dev/null +++ b/models/cassini.glb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cc98fdc90ea6091a11bb8ee4253170d86c14820b0eaf187d649c128495528b18 +size 401764 diff --git a/models/clipper.glb b/models/clipper.glb new file mode 100644 index 0000000000000000000000000000000000000000..3ac66f6e7ebbc7fa90b8c3bb35b135bb277f83ab --- /dev/null +++ b/models/clipper.glb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ddb96dc1f2da041c8b2d6228bc926a78fb899281fbbc373473053bf340fdd8b9 +size 4461104 diff --git a/models/galileo.glb b/models/galileo.glb new file mode 100644 index 0000000000000000000000000000000000000000..8a3f077351432e05271ef4736ccb638d4c2b3514 --- /dev/null +++ b/models/galileo.glb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0ef3198011cd0f450bdef521b07e27b181f7dd9cd23536df713535ea63dd142b +size 118048 diff --git a/models/hubble.glb b/models/hubble.glb new file mode 100644 index 0000000000000000000000000000000000000000..b7d9fd930ed342a17049b6dabb2383e0790ff294 --- /dev/null +++ b/models/hubble.glb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:99cd9f31e3af48ea4e8b48cc8f326573da5a11adf90028312ec2b57c6e4a4552 +size 226980 diff --git a/models/hubbleB.glb b/models/hubbleB.glb new file mode 100644 index 0000000000000000000000000000000000000000..efc2ef231b85caf9b4b435d63b71743805afe89f --- /dev/null +++ b/models/hubbleB.glb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6e21fff80e5c2e6d202d6d94626c9a67550a2047d906e59161dd0651540e005d +size 2575988 diff --git a/models/juice.glb b/models/juice.glb new file mode 100644 index 0000000000000000000000000000000000000000..766b8081d800d29b89430bff737e4d19f618a48b --- /dev/null +++ b/models/juice.glb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3434be2d8c203c6809e695c06d9bac5c33a455237d602dd0c0add59bc6705589 +size 879252 diff --git a/models/juno.glb b/models/juno.glb new file mode 100644 index 0000000000000000000000000000000000000000..d245705322400e46c88e39be25bd69e8877870f2 --- /dev/null +++ b/models/juno.glb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ef088f6ea4d3c3f6fede9a9484890c0cfc8efea66233e50033a0f185e06c327c +size 934492 diff --git a/models/jwst.glb b/models/jwst.glb new file mode 100644 index 0000000000000000000000000000000000000000..579452d6eb659ddc49f33b0a81718be51ff0d324 --- /dev/null +++ b/models/jwst.glb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7fd014dd72063630be1e9941ce5b14cec95055223a60173a6005d5cca3e99398 +size 2166836 diff --git a/models/jwstB.glb b/models/jwstB.glb new file mode 100644 index 0000000000000000000000000000000000000000..e1666292c9da03b16f7a0b3ca6947f328afb6b9e --- /dev/null +++ b/models/jwstB.glb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8a3c854a1695c37dd8e638fdf74242dbd273af3b554c8f26452344bf24c722fb +size 1373708 diff --git a/models/voyager.glb b/models/voyager.glb new file mode 100644 index 0000000000000000000000000000000000000000..c17841842342e70fd20ea49e0fa6b87bd89a215f --- /dev/null +++ b/models/voyager.glb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b08a214b95854e206be280c288f981183649207748bdc983b89d7386f01f96a5 +size 383084 diff --git a/models/voyagerA.glb b/models/voyagerA.glb new file mode 100644 index 0000000000000000000000000000000000000000..7d1d1459c829a22a62b5a2fca76b4ec0e20bc995 --- /dev/null +++ b/models/voyagerA.glb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ce1a514e3c1a45aa914f072d7da6c3180996025f13161517eb6526363a06f547 +size 408540 diff --git a/textures/ariel.jpg b/textures/ariel.jpg new file mode 100644 index 0000000000000000000000000000000000000000..997d15e298da7e0b75a33745ea8915a1c4311c3a Binary files /dev/null and b/textures/ariel.jpg differ diff --git a/textures/callisto.jpg b/textures/callisto.jpg new file mode 100644 index 0000000000000000000000000000000000000000..f9ff3151adeadcb3c0ba1a64dcf10654ebd6a247 Binary files /dev/null and b/textures/callisto.jpg differ diff --git a/textures/dione.jpg b/textures/dione.jpg new file mode 100644 index 0000000000000000000000000000000000000000..f9350cb0cc7357e80f6b22cbab7e5aeab3dd7a4d --- /dev/null +++ b/textures/dione.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8a017df50a054f9bee131211f7a258c6124d791b0489ccf33d6fa101416e8756 +size 103320 diff --git a/textures/earth.jpg b/textures/earth.jpg new file mode 100644 index 0000000000000000000000000000000000000000..377cb101f55e87688420d39f45deb819791e4b5c --- /dev/null +++ b/textures/earth.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a3bb84205f25d0e17e1d39635a1b34923018c87ee2d46a980d27b8d9ba72d708 +size 151456 diff --git a/textures/earth_clouds.jpg b/textures/earth_clouds.jpg new file mode 100644 index 0000000000000000000000000000000000000000..1d5e32f90f2a9695cd3df705fd76710ea8ef5756 --- /dev/null +++ b/textures/earth_clouds.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1b14a533d4dd0b0e7d656008b918bc8d0b198f96b0d55345af574a6e3bd8b14c +size 385857 diff --git a/textures/enceladus.jpg b/textures/enceladus.jpg new file mode 100644 index 0000000000000000000000000000000000000000..4843bce7f6324bbd2799ee8e1ce1762e5b711b0d Binary files /dev/null and b/textures/enceladus.jpg differ diff --git a/textures/europa.jpg b/textures/europa.jpg new file mode 100644 index 0000000000000000000000000000000000000000..d74651d64461e08f86619eb251889dbcb40f0147 Binary files /dev/null and b/textures/europa.jpg differ diff --git a/textures/ganymede.jpg b/textures/ganymede.jpg new file mode 100644 index 0000000000000000000000000000000000000000..d801a020699e431ab1cfe3d0f29195d48950df36 --- /dev/null +++ b/textures/ganymede.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ecc4d652ea62c661312297cd173c02141693fe12cca573965947d277a1d7260e +size 367632 diff --git a/textures/iapetus.jpg b/textures/iapetus.jpg new file mode 100644 index 0000000000000000000000000000000000000000..07e8bb59dbaad73cd315ff6aff1545ecd383d54d Binary files /dev/null and b/textures/iapetus.jpg differ diff --git a/textures/io.jpg b/textures/io.jpg new file mode 100644 index 0000000000000000000000000000000000000000..fdfc856829bb0034b4f1a0d5a3da7210a86e1ace Binary files /dev/null and b/textures/io.jpg differ diff --git a/textures/jupiter.jpg b/textures/jupiter.jpg new file mode 100644 index 0000000000000000000000000000000000000000..afdba5cf146a413bcf5d5fc2a69a3b0f40832f8e --- /dev/null +++ b/textures/jupiter.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:72f2d41f62a6522d1548387a7e534edc814be3bde07d7581a2070eb73b60fd1c +size 158196 diff --git a/textures/milkyway.jpg b/textures/milkyway.jpg new file mode 100644 index 0000000000000000000000000000000000000000..e579251f7db870a3fc34c627ed6aea98c534cdcb Binary files /dev/null and b/textures/milkyway.jpg differ diff --git a/textures/mimas.jpg b/textures/mimas.jpg new file mode 100644 index 0000000000000000000000000000000000000000..0462b9c5a39deadb4842e3574f2fb053af4ceb3f --- /dev/null +++ b/textures/mimas.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5abd16141cd09ced9bf019e08ffe63aa4604498fd2a0beec6cd4ae459a4c9d33 +size 117582 diff --git a/textures/miranda.jpg b/textures/miranda.jpg new file mode 100644 index 0000000000000000000000000000000000000000..df21a827617ce9eabd0e4ff25fcf7945f10f6120 Binary files /dev/null and b/textures/miranda.jpg differ diff --git a/textures/moon.jpg b/textures/moon.jpg new file mode 100644 index 0000000000000000000000000000000000000000..eb5f1dd5ba7bcdbd34b9a4683bbe96298f71c40f --- /dev/null +++ b/textures/moon.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:62ac98bb9e4cc43f732a92d9e60e51c77c5f493ff3aa5752a51636f3cb84d289 +size 430321 diff --git a/textures/neptune.jpg b/textures/neptune.jpg new file mode 100644 index 0000000000000000000000000000000000000000..0c10a2717b94280a8e956ff31c772390d5d99905 Binary files /dev/null and b/textures/neptune.jpg differ diff --git a/textures/oberon.jpg b/textures/oberon.jpg new file mode 100644 index 0000000000000000000000000000000000000000..0b9846bc88748d66f5630b0e1f72260ed73bc657 Binary files /dev/null and b/textures/oberon.jpg differ diff --git a/textures/rhea.jpg b/textures/rhea.jpg new file mode 100644 index 0000000000000000000000000000000000000000..aaa21667aa169710a5c1245b4560232fb2386be1 --- /dev/null +++ b/textures/rhea.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:452692d64cba1ef08f975e6c350a860932b07ce1061a626788a2fd28ba10347c +size 117545 diff --git a/textures/saturn.jpg b/textures/saturn.jpg new file mode 100644 index 0000000000000000000000000000000000000000..1c643df553a685f406feae8869487165fe343187 Binary files /dev/null and b/textures/saturn.jpg differ diff --git a/textures/saturn_ring.png b/textures/saturn_ring.png new file mode 100644 index 0000000000000000000000000000000000000000..ce82586716badc707b49e6143c3ffc50b2326774 Binary files /dev/null and b/textures/saturn_ring.png differ diff --git a/textures/tethys.jpg b/textures/tethys.jpg new file mode 100644 index 0000000000000000000000000000000000000000..0aa931637b4372f0b26566501b859971683d58eb --- /dev/null +++ b/textures/tethys.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ff275c4f32a0b14fdf8f0f865d62245ad038ab2c10d8899f103d5c97619a7ee8 +size 109470 diff --git a/textures/titan.jpg b/textures/titan.jpg new file mode 100644 index 0000000000000000000000000000000000000000..8ac3ae0fc1cb8cadab2d8ffd03a1c31c6e44c8ab --- /dev/null +++ b/textures/titan.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:591162bb5bbe556c9cb5691717463d8779676b3257c2a0b3a41e2bd9fce913de +size 204806 diff --git a/textures/titania.jpg b/textures/titania.jpg new file mode 100644 index 0000000000000000000000000000000000000000..4589fd08594851ad2f773a06d404e24b298fc138 Binary files /dev/null and b/textures/titania.jpg differ diff --git a/textures/triton.jpg b/textures/triton.jpg new file mode 100644 index 0000000000000000000000000000000000000000..9dc8e09cba881ad8667d0bd9fdee682ed3f684df Binary files /dev/null and b/textures/triton.jpg differ diff --git a/textures/umbriel.jpg b/textures/umbriel.jpg new file mode 100644 index 0000000000000000000000000000000000000000..22590943d2dfff59208f677a7c3229915be0fb6c Binary files /dev/null and b/textures/umbriel.jpg differ diff --git a/textures/uranus.jpg b/textures/uranus.jpg new file mode 100644 index 0000000000000000000000000000000000000000..b4d88ab5919dae9843a4431e8e8d2785dc9cb0a0 Binary files /dev/null and b/textures/uranus.jpg differ