Prompt specification
Build or customize the Three.js 3D scene "Endosymbiosis evidence exploration table" inside the active workspace.
Engineering Constraints:
1. Runtime & Orbit: Use Three.js r160 with OrbitControls (damping enabled) and ACESFilmicToneMapping.
2. Frame Timing: Drive all motion strictly with clock.getDelta() so animation speed is FPS-independent.
3. Viewport Hygiene: Handle window resize cleanly, cap DPR at Math.min(window.devicePixelRatio, 2), and dispose geometries/materials/renderer on unmount.
Scene Metadata:
Scene: Endosymbiosis evidence exploration table
Category: Voxel Worlds · Style: Voxel 3D
License: MIT · Reference: https://three3d.app/scene/endosymbiosis-evidence-exploration-table-x0844
Scene Description Prompt:
Please create one self-contained HTML file with Three.js from cdnjs showing endosymbiosis. Allow viewers to inspect membranes, inheritance symbols, and genetic similarities on schematic organelles; connect each observation to the inference while keeping uncertainty and simplified representation explicit. Voxel style.
Working Three.js Starter (endosymbiosis-evidence-exploration-table-x0844):
```html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Endosymbiosis — A Voxel Evidence Lab</title>
<style>
:root {
color-scheme: dark;
--bg: #07111d;
--panel: #0b1725;
--panel-2: #101f30;
--line: #24384c;
--text: #e7f0f7;
--muted: #8fa7ba;
--cyan: #5ee7ef;
--amber: #ffbd66;
--green: #79e59a;
--purple: #c79cff;
--blue: #6ebdff;
--danger: #ff8395;
}
* {
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
margin: 0;
background: var(--bg);
color: var(--text);
font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
"Segoe UI", sans-serif;
}
body {
overflow: hidden;
}
button,
input {
font: inherit;
}
button {
color: inherit;
}
#app {
display: grid;
grid-template-rows: 68px minmax(0, 1fr);
width: 100%;
height: 100%;
}
header {
z-index: 10;
display: flex;
align-items: center;
gap: 24px;
min-width: 0;
padding: 0 20px;
border-bottom: 1px solid var(--line);
background: rgba(7, 17, 29, 0.96);
}
.brand {
display: flex;
align-items: center;
gap: 11px;
flex: 0 0 auto;
}
.brand-mark {
display: grid;
grid-template-columns: repeat(3, 7px);
grid-template-rows: repeat(3, 7px);
gap: 2px;
transform: rotate(-8deg);
}
.brand-mark i {
display: block;
width: 7px;
height: 7px;
background: var(--cyan);
box-shadow: 0 0 12px rgba(94, 231, 239, 0.34);
}
.brand-mark i:nth-child(2),
.brand-mark i:nth-child(4),
.brand-mark i:nth-child(8) {
background: var(--purple);
}
.brand-mark i:nth-child(6) {
background: var(--green);
}
.brand h1 {
margin: 0;
font-size: 14px;
line-height: 1.1;
letter-spacing: 0.14em;
text-transform: uppercase;
}
.brand p {
margin: 4px 0 0;
color: var(--muted);
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
font-size: 10px;
letter-spacing: 0.08em;
text-transform: uppercase;
}
.process {
display: flex;
align-items: center;
justify-content: center;
gap: 8px;
flex: 1 1 auto;
min-width: 0;
}
.process-step {
display: flex;
align-items: center;
gap: 8px;
padding: 8px 10px;
border: 1px solid var(--line);
border-radius: 4px;
color: #b9cbd9;
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
font-size: 10px;
letter-spacing: 0.06em;
text-transform: uppercase;
white-space: nowrap;
}
.process-step b {
display: grid;
place-items: center;
width: 18px;
height: 18px;
color: #06111d;
background: var(--cyan);
border-radius: 2px;
font-size: 10px;
}
.process-arrow {
color: #496276;
font-size: 15px;
}
.header-note {
flex: 0 0 auto;
color: var(--muted);
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
font-size: 9px;
line-height: 1.5;
letter-spacing: 0.08em;
text-align: right;
text-transform: uppercase;
}
main {
display: grid;
grid-template-columns: 210px minmax(0, 1fr) 370px;
min-height: 0;
}
aside {
min-height: 0;
overflow-y: auto;
scrollbar-width: thin;
scrollbar-color: #314a60 transparent;
background: var(--panel);
}
.left-panel {
padding: 18px 14px;
border-right: 1px solid var(--line);
}
.right-panel {
border-left: 1px solid var(--line);
}
.section-label {
margin: 0 0 9px;
color: var(--muted);
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
font-size: 9px;
font-weight: 700;
letter-spacing: 0.14em;
text-transform: uppercase;
}
.control-group + .control-group {
margin-top: 23px;
}
.control-stack {
display: grid;
gap: 7px;
}
.control-button {
position: relative;
display: grid;
grid-template-columns: 30px 1fr;
align-items: center;
gap: 8px;
width: 100%;
padding: 10px;
border: 1px solid #24394d;
border-radius: 5px;
background: #0d1b2a;
cursor: pointer;
text-align: left;
transition:
border-color 140ms ease,
background 140ms ease,
transform 140ms ease;
}
.control-button:hover {
border-color: #45647e;
background: #122437;
transform: translateY(-1px);
}
.control-button.active {
border-color: var(--button-accent, var(--cyan));
background:
linear-gradient(
90deg,
color-mix(in srgb, var(--button-accent, var(--cyan)) 13%, transparent),
transparent 65%
),
#102033;
}
.control-icon {
display: grid;
place-items: center;
width: 27px;
height: 27px;
color: var(--button-accent, var(--cyan));
border: 1px solid color-mix(in srgb, var(--button-accent, var(--cyan)) 55%, transparent);
border-radius: 3px;
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
font-size: 13px;
font-weight: 700;
}
.control-copy strong {
display: block;
font-size: 11px;
letter-spacing: 0.02em;
}
.control-copy small {
display: block;
margin-top: 3px;
color: var(--muted);
font-size: 9px;
line-height: 1.3;
}
.trace-button {
width: 100%;
margin-top: 8px;
padding: 10px 11px;
border: 1px dashed #39516a;
border-radius: 4px;
background: transparent;
color: #bed0de;
cursor: pointer;
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
font-size: 9px;
letter-spacing: 0.07em;
text-transform: uppercase;
}
.trace-button[aria-pressed="true"] {
border-color: var(--amber);
color: var(--amber);
background: rgba(255, 189, 102, 0.07);
}
.model-note {
margin-top: 23px;
padding: 12px;
border: 1px solid #293e52;
border-radius: 5px;
background: #081420;
}
.model-note summary {
color: #c7d7e3;
cursor: pointer;
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
font-size: 9px;
font-weight: 700;
letter-spacing: 0.08em;
text-transform: uppercase;
}
.model-note p {
margin: 10px 0 0;
color: var(--muted);
font-size: 10px;
line-height: 1.55;
}
.model-note p + p {
margin-top: 8px;
}
#viewport {
position: relative;
min-width: 0;
min-height: 0;
overflow: hidden;
isolation: isolate;
background:
radial-gradient(circle at 50% 40%, rgba(27, 57, 79, 0.38), transparent 58%),
#07111d;
}
#viewport::after {
position: absolute;
inset: 0;
z-index: 2;
pointer-events: none;
content: "";
box-shadow: inset 0 0 80px rgba(0, 0, 0, 0.34);
}
canvas {
display: block;
width: 100%;
height: 100%;
outline: none;
cursor: grab;
touch-action: none;
}
canvas:active {
cursor: grabbing;
}
.stage-top {
position: absolute;
z-index: 4;
top: 15px;
left: 16px;
right: 16px;
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 12px;
pointer-events: none;
}
.stage-badge,
.reset-button {
border: 1px solid #2a4257;
border-radius: 4px;
background: rgba(8, 19, 31, 0.84);
color: #9fb5c6;
backdrop-filter: blur(7px);
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
font-size: 8px;
letter-spacing: 0.08em;
text-transform: uppercase;
}
.stage-badge {
max-width: 320px;
padding: 8px 10px;
line-height: 1.5;
}
.reset-button {
padding: 8px 10px;
pointer-events: auto;
cursor: pointer;
}
.reset-button:hover {
border-color: #57758f;
color: white;
}
#world-labels {
position: absolute;
z-index: 3;
inset: 0;
overflow: hidden;
pointer-events: none;
}
.world-label {
position: absolute;
min-width: 118px;
padding: 7px 9px;
border: 1px solid rgba(74, 101, 125, 0.5);
border-radius: 4px;
background: rgba(6, 16, 27, 0.78);
color: #c7d7e3;
text-align: center;
transform: translate(-50%, -100%);
backdrop-filter: blur(5px);
}
.world-label::after {
position: absolute;
left: 50%;
bottom: -7px;
width: 1px;
height: 7px;
background: #49657c;
content: "";
}
.world-label small {
display: block;
color: var(--label-accent, var(--cyan));
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
font-size: 7px;
font-weight: 700;
letter-spacing: 0.12em;
text-transform: uppercase;
}
.world-label strong {
display: block;
margin-top: 3px;
font-size: 10px;
letter-spacing: 0.02em;
}
#selected-callout {
position: absolute;
z-index: 6;
max-width: 190px;
padding: 7px 9px;
border: 1px solid var(--callout-color, var(--cyan));
border-radius: 3px;
background: rgba(5, 13, 22, 0.92);
color: #e7f0f7;
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
font-size: 8px;
letter-spacing: 0.06em;
line-height: 1.45;
text-transform: uppercase;
transform: translate(-50%, calc(-100% - 13px));
pointer-events: none;
}
#selected-callout::after {
position: absolute;
left: 50%;
bottom: -8px;
width: 1px;
height: 8px;
background: var(--callout-color, var(--cyan));
content: "";
}
.stage-bottom {
position: absolute;
z-index: 4;
right: 16px;
bottom: 14px;
left: 16px;
display: flex;
align-items: center;
justify-content: space-between;
gap: 10px;
pointer-events: none;
}
.legend {
display: flex;
flex-wrap: wrap;
gap: 8px 12px;
padding: 8px 10px;
border: 1px solid rgba(42, 66, 87, 0.65);
border-radius: 4px;
background: rgba(6, 16, 27, 0.76);
color: #9fb5c6;
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
font-size: 8px;
letter-spacing: 0.06em;
text-transform: uppercase;
backdrop-filter: blur(6px);
}
.legend span {
display: flex;
align-items: center;
gap: 5px;
}
.legend i {
width: 7px;
height: 7px;
border-radius: 1px;
background: var(--swatch);
box-shadow: 0 0 8px color-mix(in srgb, var(--swatch) 50%, transparent);
}
.gesture-hint {
padding: 7px 9px;
border-radius: 3px;
background: rgba(6, 16, 27, 0.68);
color: #7f98ab;
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
font-size: 8px;
letter-spacing: 0.06em;
text-transform: uppercase;
}
#hover-tip {
position: absolute;
z-index: 8;
max-width: 230px;
padding: 7px 9px;
border: 1px solid #45637c;
border-radius: 3px;
background: #081421;
color: #d7e4ed;
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
font-size: 9px;
line-height: 1.45;
pointer-events: none;
transform: translate(12px, 12px);
}
#hover-tip[hidden] {
display: none;
}
.inspector-inner {
padding: 19px 18px 26px;
}
.inspector-kicker {
display: flex;
align-items: center;
justify-content: space-between;
gap: 8px;
color: var(--muted);
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
font-size: 8px;
letter-spacing: 0.12em;
text-transform: uppercase;
}
.specimen-chip {
padding: 4px 6px;
border: 1px solid color-mix(in srgb, var(--chip-color, var(--cyan)) 48%, transparent);
border-radius: 3px;
color: var(--chip-color, var(--cyan));
background: color-mix(in srgb, var(--chip-color, var(--cyan)) 8%, transparent);
}
.inspector-inner h2 {
margin: 12px 0 7px;
font-size: 24px;
line-height: 1.08;
letter-spacing: -0.035em;
}
.inspector-lead {
margin: 0 0 17px;
color: var(--muted);
font-size: 11px;
line-height: 1.55;
}
.evidence-chain {
display: grid;
gap: 8px;
}
.chain-card {
position: relative;
padding: 12px 12px 12px 42px;
border: 1px solid #263c50;
border-radius: 5px;
background: #0c1927;
}
.chain-number {
position: absolute;
top: 12px;
left: 11px;
display: grid;
place-items: center;
width: 21px;
height: 21px;
border: 1px solid #3a556d;
border-radius: 3px;
color: #91a9bc;
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
font-size: 8px;
font-weight: 700;
}
.chain-card.observation {
border-color: rgba(110, 189, 255, 0.35);
}
.chain-card.observation .chain-number {
color: var(--blue);
border-color: rgba(110, 189, 255, 0.55);
background: rgba(110, 189, 255, 0.08);
}
.chain-card.inference {
border-color: rgba(255, 189, 102, 0.38);
}
.chain-card.inference .chain-number {
color: var(--amber);
border-color: rgba(255, 189, 102, 0.55);
background: rgba(255, 189, 102, 0.08);
}
.chain-card.uncertainty {
border-color: rgba(255, 131, 149, 0.35);
}
.chain-card.uncertainty .chain-number {
color: var(--danger);
border-color: rgba(255, 131, 149, 0.5);
background: rgba(255, 131, 149, 0.07);
}
.chain-card h3 {
margin: 0 0 6px;
color: #7890a4;
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
font-size: 8px;
letter-spacing: 0.12em;
text-transform: uppercase;
}
.chain-card p {
margin: 0;
color: #d5e1ea;
font-size: 11px;
line-height: 1.55;
}
.bridge {
position: relative;
margin: 9px 0 0 26px;
padding: 11px 12px;
border-left: 2px solid var(--amber);
background: rgba(255, 189, 102, 0.055);
color: #c9d6df;
font-size: 10px;
line-height: 1.55;
}
.bridge strong {
display: block;
margin-bottom: 3px;
color: var(--amber);
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
font-size: 8px;
letter-spacing: 0.1em;
text-transform: uppercase;
}
.trait-cues {
display: flex;
flex-wrap: wrap;
gap: 6px;
margin-top: 8px;
}
.trait-cues span {
padding: 5px 7px;
border: 1px solid #304a60;
border-radius: 3px;
background: #0a1724;
color: #a9bdcc;
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
font-size: 8px;
letter-spacing: 0.03em;
}
.confidence {
margin-top: 19px;
padding: 12px;
border: 1px solid #293f53;
border-radius: 5px;
background: #081521;
}
.confidence-head {
display: flex;
align-items: center;
justify-content: space-between;
gap: 8px;
color: #95adbf;
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
font-size: 8px;
letter-spacing: 0.08em;
text-transform: uppercase;
}
.confidence-head strong {
color: #dce8f0;
font-size: 9px;
}
.confidence-bars {
display: grid;
grid-template-columns: repeat(5, 1fr);
gap: 4px;
margin-top: 9px;
}
.confidence-bars i {
height: 5px;
border-radius: 1px;
background: #203548;
}
.confidence-bars i.active {
background: var(--confidence-color, var(--cyan));
box-shadow: 0 0 10px color-mix(in srgb, var(--confidence-color, var(--cyan)) 35%, transparent);
}
.confidence small {
display: block;
margin-top: 8px;
color: #718ca0;
font-size: 9px;
line-height: 1.4;
}
.scope-note {
margin-top: 14px;
padding: 11px 12px;
border: 1px dashed #354b5f;
border-radius: 4px;
color: #8fa7b9;
font-size: 9px;
line-height: 1.55;
}
.scope-note strong {
display: block;
margin-bottom: 4px;
color: #b6c8d5;
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
font-size: 8px;
letter-spacing: 0.1em;
text-transform: uppercase;
}
.next-button {
width: 100%;
margin-top: 16px;
padding: 10px 12px;
border: 1px solid #345169;
border-radius: 4px;
background: #102335;
color: #cfe0eb;
cursor: pointer;
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
font-size: 9px;
letter-spacing: 0.07em;
text-transform: uppercase;
}
.next-button:hover {
border-color: #5e819d;
background: #142a3e;
}
@media (max-width: 1220px) {
main {
grid-template-columns: 180px minmax(0, 1fr) 330px;
}
.header-note {
display: none;
}
.process-step {
padding: 7px 8px;
}
}
@media (max-width: 980px) {
body {
overflow: auto;
}
#app {
display: block;
height: auto;
min-height: 100%;
}
header {
min-height: 68px;
}
.process {
display: none;
}
main {
display: grid;
grid-template-columns: 1fr;
}
#viewport {
order: 1;
height: 62vh;
min-height: 500px;
}
.left-panel {
order: 2;
border-top: 1px solid var(--line);
border-right: 0;
}
.right-panel {
order: 3;
border-top: 1px solid var(--line);
border-left: 0;
}
.left-panel .control-stack {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
.model-note {
max-width: 620px;
}
}
@media (max-width: 560px) {
header {
padding: 0 14px;
}
.brand p {
display: none;
}
.stage-badge {
max-width: 225px;
}
.gesture-hint {
display: none;
}
.left-panel .control-stack {
grid-template-columns: 1fr;
}
.inspector-inner {
padding: 18px 14px 24px;
}
}
@media (prefers-reduced-motion: reduce) {
*,
*::before,
*::after {
scroll-behavior: auto !important;
transition-duration: 0.001ms !important;
animation-duration: 0.001ms !important;
}
}
</style>
</head>
<body>
<div id="app">
<header>
<div class="brand">
<div class="brand-mark" aria-hidden="true">
<i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i>
</div>
<div>
<h1>Endosymbiosis</h1>
<p>Voxel evidence lab · observation → inference</p>
</div>
</div>
<div class="process" aria-label="Simplified endosymbiotic sequence">
<div class="process-step"><b>1</b> Engulfment</div>
<span class="process-arrow">→</span>
<div class="process-step"><b>2</b> Retention</div>
<span class="process-arrow">→</span>
<div class="process-step"><b>3</b> Integration</div>
</div>
<div class="header-note">
Schematic / not to scale<br>
Evidence, not a literal time-lapse
</div>
</header>
<main>
<aside class="left-panel" aria-label="Model controls">
<section class="control-group">
<p class="section-label">01 / Evidence lens</p>
<div class="control-stack" id="lens-controls">
<button class="control-button active" type="button" data-lens="all" style="--button-accent:#6ebdff">
<span class="control-icon">∑</span>
<span class="control-copy">
<strong>All observations</strong>
<small>Show every voxel pin</small>
</span>
</button>
<button class="control-button" type="button" data-lens="membrane" style="--button-accent:#5ee7ef">
<span class="control-icon">▣</span>
<span class="control-copy">
<strong>Membranes</strong>
<small>Boundaries and internal layers</small>
</span>
</button>
<button class="control-button" type="button" data-lens="inheritance" style="--button-accent:#ffbd66">
<span class="control-icon">⑂</span>
<span class="control-copy">
<strong>Inheritance</strong>
<small>Division and cellular transmission</small>
</span>
</button>
<button class="control-button" type="button" data-lens="genetics" style="--button-accent:#c79cff">
<span class="control-icon">≋</span>
<span class="control-copy">
<strong>Genetic similarity</strong>
<small>DNA, ribosomes, and phylogeny</small>
</span>
</button>
</div>
</section>
<section class="control-group">
<p class="section-label">02 / Specimen</p>
<div class="control-stack" id="specimen-controls">
<button class="control-button" type="button" data-specimen="bacterium" style="--button-accent:#5ee7ef">
<span class="control-icon">B</span>
<span class="control-copy">
<strong>Bacterium</strong>
<small>Generic reference cell</small>
</span>
</button>
<button class="control-button" type="button" data-specimen="mitochondrion" style="--button-accent:#ffbd66">
<span class="control-icon">M</span>
<span class="control-copy">
<strong>Mitochondrion</strong>
<small>Double-membrane organelle</small>
</span>
</button>
<button class="control-button" type="button" data-specimen="chloroplast" style="--button-accent:#79e59a">
<span class="control-icon">C</span>
<span class="control-copy">
<strong>Chloroplast</strong>
<small>Plastid with thylakoids</small>
</span>
</button>
</div>
<button
id="trace-button"
class="trace-button"
type="button"
aria-pressed="false"
title="Show a stylized copy-and-partition symbol near each specimen"
>
▶ Trace inheritance symbol
</button>
</section>
<details class="model-note" open>
<summary>Representation limits</summary>
<p>
The bacterium is a generic reference silhouette, not a claimed direct
ancestor of both organelles. Mitochondria and primary plastids have
different bacterial ancestry.
</p>
<p>
Cutaways, colors, genome symbols, and inheritance paths are teaching
devices. No dimensions, sequence data, or evolutionary timescale are shown.
</p>
</details>
</aside>
<section id="viewport" aria-label="Interactive three-dimensional comparison">
<canvas
id="scene"
tabindex="0"
aria-label="Voxel models of a bacterium, mitochondrion, and chloroplast. Drag to orbit, scroll to zoom, and select colored evidence pins."
></canvas>
<div class="stage-top">
<div class="stage-badge">
Comparison of modern endpoints · not an ancestor-to-organelle time-lapse
</div>
<button class="reset-button" id="reset-view" type="button">Reset view</button>
</div>
<div id="world-labels" aria-hidden="true"></div>
<div id="selected-callout" hidden aria-hidden="true"></div>
<div id="hover-tip" hidden></div>
<div class="stage-bottom">
<div class="legend" aria-label="Evidence pin legend">
<span><i style="--swatch:#5ee7ef"></i>Membrane</span>
<span><i style="--swatch:#ffbd66"></i>Inheritance</span>
<span><i style="--swatch:#c79cff"></i>Genetics</span>
</div>
<div class="gesture-hint">Drag orbit · shift-drag pan · scroll zoom · click pin</div>
</div>
</section>
<aside class="right-panel" aria-label="Evidence inspector">
<div
id="inspector"
class="inspector-inner"
aria-live="polite"
aria-atomic="true"
></div>
</aside>
</main>
</div>
<script type="module">
import * as THREE from "https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
const viewport = document.getElementById("viewport");
const canvas = document.getElementById("scene");
const worldLabels = document.getElementById("world-labels");
const selectedCallout = document.getElementById("selected-callout");
const hoverTip = document.getElementById("hover-tip");
const inspector = document.getElementById("inspector");
const traceButton = document.getElementById("trace-button");
const reducedMotion = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
const lensMeta = {
all: {
title: "All observations",
color: "#6ebdff",
icon: "∑"
},
membrane: {
title: "Membrane evidence",
color: "#5ee7ef",
icon: "▣"
},
inheritance: {
title: "Inheritance evidence",
color: "#ffbd66",
icon: "⑂"
},
genetics: {
title: "Genetic evidence",
color: "#c79cff",
icon: "≋"
}
};
const specimens = {
bacterium: {
name: "Bacterium",
subtitle: "Generic cellular reference",
color: "#5ee7ef",
top: 1.65
},
mitochondrion: {
name: "Mitochondrion",
subtitle: "Double-membrane organelle",
color: "#ffbd66",
top: 1.9
},
chloroplast: {
name: "Chloroplast",
subtitle: "Primary plastid reference",
color: "#79e59a",
top: 2.15
}
};
const evidence = {
bacterium: {
membrane: {
observation:
"The reference bacterium is enclosed by a cell envelope that separates its cytoplasm and genome from the environment.",
inference:
"This supplies a baseline for interpreting organelle boundaries. It does not, by itself, establish the ancestry of either organelle.",
bridge:
"Use this cell only as a structural reference; the organelle membranes must be compared by topology, proteins, and lipids.",
uncertainty:
"The generic bacterium is not claimed to be the direct ancestor of both mitochondria and plastids.",
support: 1,
supportLabel: "Reference",
confidence: "Baseline only",
cues: ["Cell envelope", "Cytoplasm", "Outside / inside"]
},
inheritance: {
observation:
"A bacterium copies its genome and divides, passing linked cellular traits to daughter cells.",
inference:
"This shows the basic mechanism by which a retained bacterial population could persist and reproduce inside a host cell.",
bridge:
"The symbol links autonomous division with transmission from parent cell to daughter cell.",
uncertainty:
"Independent evolution of division is possible, so this is compatibility with endosymbiosis rather than proof of ancestry.",
support: 2,
supportLabel: "Suggestive",
confidence: "Mechanistic context",
cues: ["Genome copying", "Binary fission", "Parent → daughters"]
},
genetics: {
observation:
"Reference bacteria typically use a circular chromosome and bacterial-type ribosomes.",
inference:
"These features define part of the comparison set against which organellar DNA, translation machinery, and sequence phylogenies are tested.",
bridge:
"Similarity is meaningful only when multiple traits and independent sequence relationships point in the same direction.",
uncertainty:
"A generic bacterium does not represent the distinct lineages associated with mitochondria and primary plastids.",
support: 3,
supportLabel: "Reference",
confidence: "Comparative baseline",
cues: ["Circular DNA", "Bacterial ribosome", "Gene sequence"]
}
},
mitochondrion: {
membrane: {
observation:
"Most mitochondria are bounded by two membranes, and their protein and lipid compositions are not identical.",
inference:
"A double boundary is consistent with a bacterium being enclosed by a host vesicle during endosymbiosis.",
bridge:
"Boundary count makes engulfment plausible; biochemical similarity makes the proposed origin experimentally testable.",
uncertainty:
"Membranes can be gained, lost, or remodeled. Topology alone is weak evidence, and the precise origin of each layer remains nuanced.",
support: 2,
supportLabel: "Suggestive",
confidence: "Suggestive, not decisive",
cues: ["Two boundaries", "Outer membrane", "Inner membrane"]
},
inheritance: {
observation:
"Mitochondria divide by fission and are inherited cytoplasmically. Many animals transmit them maternally, but inheritance routes vary widely.",
inference:
"Non-Mendelian, cell-associated inheritance plus autonomous division resembles the behavior expected for an intracellular bacterial population.",
bridge:
"The pattern connects the organelle to the host's cellular lineage while preserving bacterial-like reproduction.",
uncertainty:
"Cytoplasmic inheritance is not unique to endosymbionts, and organelle inheritance differs among organisms and tissues.",
support: 3,
supportLabel: "Moderate",
confidence: "Moderate support",
cues: ["Fission", "Cytoplasmic", "Often maternal"]
},
genetics: {
observation:
"Mitochondria retain a small circular genome and bacterial-like ribosomal genes, while most mitochondrial proteins are now encoded in the host nucleus.",
inference:
"This mixed genome strongly supports bacterial ancestry followed by extensive transfer of genes from the endosymbiont to the host nucleus.",
bridge:
"Sequence phylogeny and the organelle–nucleus division of labor are stronger than circular DNA shape alone.",
uncertainty:
"Gene loss and transfer erase much of the original signal. An organellar genome is not a preserved, unchanged bacterial cell.",
support: 5,
supportLabel: "Strong",
confidence: "Strong, with caveats",
cues: ["Circular DNA", "Bacterial ribosome", "Sequence phylogeny", "Transferred genes"]
}
},
chloroplast: {
membrane: {
observation:
"Primary plastids have a double envelope and an internal thylakoid membrane system; the combined architecture includes several membrane boundaries.",
inference:
"The nested architecture is consistent with a cyanobacterium being engulfed and its photosynthetic membranes retained inside a host cell.",
bridge:
"Envelope plus internal membrane topology fits the proposed history of an engulfed photosynthetic cell.",
uncertainty:
"Some plastids arose through secondary or tertiary endosymbiosis, adding further membranes. The origin of individual layers is not simple.",
support: 3,
supportLabel: "Moderate",
confidence: "Moderate support",
cues: ["Double envelope", "Thylakoids", "Internal membranes"]
},
inheritance: {
observation:
"Plastids divide by fission and are usually inherited cytoplasmically. Maternal transmission is common in land plants, but the details vary.",
inference:
"Cell-associated transmission and autonomous division are compatible with inheritance of a former intracellular photosynthetic symbiont.",
bridge:
"The division symbol shows a continuing cellular population whose members are distributed with host cells.",
uncertainty:
"Cytoplasmic inheritance and fission are not uniquely endosymbiotic, and patterns of organelle transmission vary.",
support: 3,
supportLabel: "Moderate",
confidence: "Moderate support",
cues: ["Fission", "Cytoplasmic", "Often maternal"]
},
genetics: {
observation:
"Primary plastids retain a circular genome and bacterial-type ribosomes. Sequence phylogenies place primary plastids among cyanobacteria.",
inference:
"Concordant sequence, translation-machinery, and organellar structure evidence supports cyanobacterial ancestry of primary plastids.",
bridge:
"The genome is a historical record, while the host nucleus now contains many genes transferred from the plastid.",
uncertainty:
"Secondary plastids can have different ancestry, and extensive gene loss and transfer complicate simple genome-to-genome comparisons.",
support: 5,
supportLabel: "Strong",
confidence: "Strong for primary plastids",
cues: ["Circular DNA", "Bacterial ribosome", "Sequence phylogeny", "Transferred genes"]
}
}
};
const state = {
lens: "all",
specimen: "bacterium",
selectedEvidence: null,
trace: false
};
const scene = new THREE.Scene();
scene.background = new THREE.Color(0x07111d);
const renderer = new THREE.WebGLRenderer({
canvas,
antialias: true,
alpha: false,
powerPreference: "high-performance"
});
renderer.setPixelRatio(Math.min(window.devicePixelRatio || 1, 2));
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
const camera = new THREE.OrthographicCamera(-6, 6, 5, -5, 0.1, 100);
const cameraState = {
theta: 0.72,
phi: 1.17,
zoom: 1,
target: new THREE.Vector3(0, -0.25, 0)
};
const ambient = new THREE.HemisphereLight(0xa8d7ef, 0x08101b, 2.0);
scene.add(ambient);
const keyLight = new THREE.DirectionalLight(0xffffff, 3.4);
keyLight.position.set(-6, 10, 9);
keyLight.castShadow = true;
keyLight.shadow.mapSize.set(1024, 1024);
keyLight.shadow.camera.left = -10;
keyLight.shadow.camera.right = 10;
keyLight.shadow.camera.top = 8;
keyLight.shadow.camera.bottom = -8;
scene.add(keyLight);
const rimLight = new THREE.PointLight(0x5ee7ef, 15, 22, 2);
rimLight.position.set(-8, 2, -4);
scene.add(rimLight);
const warmLight = new THREE.PointLight(0xffbd66, 11, 18, 2);
warmLight.position.set(8, 0, 5);
scene.add(warmLight);
const modelRoot = new THREE.Group();
scene.add(modelRoot);
const specimenObjects = {};
const markerObjects = [];
const markerHitboxes = [];
const modelPickMeshes = [];
const traceObjects = [];
function standardMaterial(color, emissive = 0x000000, emissiveIntensity = 0) {
return new THREE.MeshStandardMaterial({
color,
emissive,
emissiveIntensity,
roughness: 0.76,
metalness: 0.08
});
}
function voxelMesh(positions, material, size = 0.22, specimen = null) {
const geometry = new THREE.BoxGeometry(size, size, size);
const mesh = new THREE.InstancedMesh(geometry, material, positions.length);
const dummy = new THREE.Object3D();
positions.forEach((position, index) => {
dummy.position.set(position[0], position[1], position[2]);
dummy.rotation.set(0, 0, 0);
dummy.scale.set(1, 1, 1);
dummy.updateMatrix();
mesh.setMatrixAt(index, dummy.matrix);
});
mesh.instanceMatrix.needsUpdate = true;
mesh.castShadow = true;
mesh.receiveShadow = true;
if (specimen) {
mesh.userData.specimen = specimen;
modelPickMeshes.push(mesh);
}
return mesh;
}
function ellipsoidShell(rx, ry, rz, size, innerThreshold = 0.58, cutaway = true) {
const positions = [];
const nx = Math.ceil(rx / size);
const ny = Math.ceil(ry / size);
const nz = Math.ceil(rz / size);
for (let ix = -nx; ix <= nx; ix++) {
for (let iy = -ny; iy <= ny; iy++) {
for (let iz = -nz; iz <= nz; iz++) {
const x = ix * size;
const y = iy * size;
const z = iz * size;
const q =
(x * x) / (rx * rx) +
(y * y) / (ry * ry) +
(z * z) / (rz * rz);
if (q <= 1 && q >= innerThreshold) {
const inFrontNotch =
cutaway &&
z > 0.015 &&
Math.abs(x) < rx * 0.47 &&
y < ry * 0.56;
if (!inFrontNotch) {
positions.push([x, y, z]);
}
}
}
}
}
return positions;
}
function genomeRing(cx, cy, z, rx, ry, count = 24) {
const positions = [];
for (let i = 0; i < count; i++) {
const angle = (i / count) * Math.PI * 2;
positions.push([
cx + Math.cos(angle) * rx,
cy + Math.sin(angle) * ry,
z + Math.sin(angle * 2) * 0.035
]);
}
return positions;
}
function addTraceSymbol(group, color) {
const trace = new THREE.Group();
trace.position.set(0, -1.91, 0.92);
trace.visible = false;
const material = standardMaterial(color, color, 0.65);
const parent = new THREE.Mesh(
new THREE.BoxGeometry(0.28, 0.18, 0.18),
material
);
parent.position.x = -0.56;
parent.userData.phase = 0;
const left = new THREE.Mesh(
new THREE.BoxGeometry(0.22, 0.16, 0.16),
material
);
left.position.x = -0.16;
left.userData.phase = 1;
const right = left.clone();
right.position.x = 0.16;
right.userData.phase = 2;
const stem = new THREE.Mesh(
new THREE.BoxGeometry(0.25, 0.06, 0.06),
material
);
stem.position.x = 0;
stem.userData.phase = 0;
trace.add(parent, stem, left, right);
group.add(trace);
traceObjects.push(trace);
}
function buildSpecimen(id, x, config) {
const group = new THREE.Group();
group.position.set(x, -0.28, 0);
modelRoot.add(group);
const specimen = {
id,
group,
top: config.top,
materials: {},
genome: null
};
const outerMaterial = standardMaterial(
config.outer,
config.outer,
0.12
);
const innerMaterial = standardMaterial(
config.inner || config.outer,
config.inner || config.outer,
0.1
);
const genomeMaterial = standardMaterial(0xf3efff, 0xbfa8ff, 0.38);
const ribosomeMaterial = standardMaterial(0xc79cff, 0x6d3aa7, 0.22);
const interiorMaterial = standardMaterial(
config.interior,
config.interior,
0.12
);
specimen.materials.outer = outerMaterial;
specimen.materials.inner = innerMaterial;
specimen.materials.genome = genomeMaterial;
specimen.materials.ribosome = ribosomeMaterial;
specimen.materials.interior = interiorMaterial;
const outer = voxelMesh(
ellipsoidShell(config.rx, config.ry, config.rz, 0.22, 0.58, true),
outerMaterial,
0.22,
id
);
group.add(outer);
if (config.doubleMembrane) {
const inner = voxelMesh(
ellipsoidShell(
config.rx * 0.77,
config.ry * 0.77,
config.rz * 0.77,
0.2,
0.5,
true
),
innerMaterial,
0.2,
id
);
group.add(inner);
}
const genome = voxelMesh(
genomeRing(
config.genomeOffset || 0,
0,
config.genomeZ || 0.62,
config.genomeRX || 0.7,
config.genomeRY || 0.43,
24
),
genomeMaterial,
0.115,
id
);
group.add(genome);
specimen.genome = genome;
const ribosomePositions = [];
const count = id === "chloroplast" ? 22 : 17;
for (let i = 0; i < count; i++) {
const a = i * 2.399963;
const radius = 0.35 + (i % 5) * 0.13;
ribosomePositions.push([
Math.cos(a) * radius,
Math.sin(a * 1.7) * 0.48,
0.18 + (i % 4) * 0.17
]);
}
const ribosomes = voxelMesh(
ribosomePositions,
ribosomeMaterial,
0.105,
id
);
group.add(ribosomes);
if (id === "mitochondrion") {
const cristae = [];
for (let row = 0; row < 5; row++) {
for (let i = -5; i <= 5; i++) {
const y = -0.57 + row * 0.27 + (i % 2 === 0 ? 0.07 : -0.07);
const z = 0.25 + Math.sin(i * 0.8 + row) * 0.08;
cristae.push([i * 0.22, y, z]);
}
}
const cristaeMesh = voxelMesh(
cristae,
interiorMaterial,
0.18,
id
);
group.add(cristaeMesh);
}
if (id === "chloroplast") {
const thylakoids = [];
for (const xPos of [-1.15, -0.38, 0.38, 1.15]) {
for (const yPos of [-0.42, 0.38]) {
for (let layer = 0; layer < 4; layer++) {
for (let a = -1; a <= 1; a++) {
for (let b = 0; b <= 1; b++) {
thylakoids.push([
xPos + a * 0.14,
yPos + layer * 0.12,
0.26 + b * 0.12
]);
}
}
}
}
}
const thylakoidMesh = voxelMesh(
thylakoids,
interiorMaterial,
0.115,
id
);
group.add(thylakoidMesh);
}
const padMaterial = standardMaterial(0x102538, config.outer, 0.06);
const pad = new THREE.Mesh(
new THREE.BoxGeometry(config.rx * 1.85, 0.08, config.rz * 2.1),
padMaterial
);
pad.position.y = -1.95;
pad.receiveShadow = true;
group.add(pad);
specimen.padMaterial = padMaterial;
addTraceSymbol(group, config.traceColor);
specimenObjects[id] = specimen;
return specimen;
}
buildSpecimen("bacterium", -4.15, {
rx: 1.42,
ry: 1.03,
rz: 1.0,
outer: 0x47b9c7,
inner: 0x2b8293,
interior: 0x68e4e9,
genomeZ: 0.49,
genomeRX: 0.58,
genomeRY: 0.35,
traceColor: 0x5ee7ef
});
buildSpecimen("mitochondrion", 0, {
rx: 1.95,
ry: 1.2,
rz: 1.08,
outer: 0xd48b45,
inner: 0xf0b05f,
interior: 0xff836f,
genomeOffset: -0.05,
genomeZ: 0.65,
genomeRX: 0.75,
genomeRY: 0.44,
doubleMembrane: true,
traceColor: 0xffbd66
});
buildSpecimen("chloroplast", 4.2, {
rx: 2.05,
ry: 1.42,
rz: 1.3,
outer: 0x4eb86c,
inner: 0x83d98c,
interior: 0xb3f36a,
genomeOffset: -0.05,
genomeZ: 0.77,
genomeRX: 0.83,
genomeRY: 0.5,
doubleMembrane: true,
traceColor: 0x79e59a
});
function addFloor() {
const positions = [];
for (let x = -8; x <= 8; x += 0.34) {
for (let z = -4; z <= 4; z += 0.34) {
positions.push([x, -2.02, z]);
}
}
const gridMaterial = standardMaterial(0x163047, 0x153650, 0.05);
const grid = voxelMesh(positions, gridMaterial, 0.025);
grid.receiveShadow = true;
scene.add(grid);
const floor = new THREE.Mesh(
new THREE.PlaneGeometry(30, 24),
standardMaterial(0x07121e, 0x07121e, 0)
);
floor.rotation.x = -Math.PI / 2;
floor.position.y = -2.08;
floor.receiveShadow = true;
scene.add(floor);
}
addFloor();
function addMarker(type, specimenId, position) {
const color = lensMeta[type].color;
const material = standardMaterial(
new THREE.Color(color),
new THREE.Color(color),
0.55
);
const group = new THREE.Group();
group.position.copy(position);
const positions = [];
if (type === "membrane") {
positions.push(
[-0.22, 0, 0],
[0.22, 0, 0],
[0, -0.22, 0],
[0, 0.22, 0]
);
} else if (type === "inheritance") {
positions.push(
[-0.24, 0, 0],
[0, 0, 0],
[0.24, 0, 0]
);
} else {
for (let i = 0; i < 8; i++) {
positions.push([
-0.2 + i * 0.057,
(i % 2 === 0 ? -1 : 1) * 0.13,
(i % 2 === 0 ? -1 : 1) * 0.04
]);
}
}
const visible = voxelMesh(positions, material, 0.14);
visible.userData.evidenceId = `${specimenId}.${type}`;
group.add(visible);
const hitbox = new THREE.Mesh(
new THREE.BoxGeometry(0.72, 0.72, 0.72),
new THREE.MeshBasicMaterial({
transparent: true,
opacity: 0,
depthWrite: false
})
);
hitbox.userData.evidenceId = `${specimenId}.${type}`;
hitbox.userData.type = type;
hitbox.userData.specimen = specimenId;
group.add(hitbox);
const marker = {
id: `${specimenId}.${type}`,
type,
specimen: specimenId,
group,
material,
hitbox
};
markerObjects.push(marker);
markerHitboxes.push(hitbox);
specimenObjects[specimenId].group.add(group);
return marker;
}
addMarker(
"membrane",
"bacterium",
new THREE.Vector3(1.03, 0.72, 0.48)
);
addMarker(
"membrane",
"mitochondrion",
new THREE.Vector3(1.47, 0.83, 0.5)
);
addMarker(
"membrane",
"chloroplast",
new THREE.Vector3(1.55, 1.02, 0.58)
);
addMarker(
"inheritance",
"bacterium",
new THREE.Vector3(-0.35, -0.87, 0.92)
);
addMarker(
"inheritance",
"mitochondrion",
new THREE.Vector3(-0.42, -0.91, 1.0)
);
addMarker(
"inheritance",
"chloroplast",
new THREE.Vector3(-0.45, -1.02, 1.13)
);
addMarker(
"genetics",
"bacterium",
new THREE.Vector3(-0.54, -0.08, 0.93)
);
addMarker(
"genetics",
"mitochondrion",
new THREE.Vector3(-0.68, -0.12, 1.08)
);
addMarker(
"genetics",
"chloroplast",
new THREE.Vector3(-0.76, -0.16, 1.22)
);
const specimenLabelElements = {};
for (const [id, specimen] of Object.entries(specimenObjects)) {
const element = document.createElement("div");
element.className = "world-label";
element.style.setProperty("--label-accent", specimens[id].color);
element.innerHTML = `
<small>${specimens[id].subtitle}</small>
<strong>${specimens[id].name}</strong>
`;
worldLabels.appendChild(element);
specimenLabelElements[id] = element;
}
function updateControls() {
document.querySelectorAll("[data-lens]").forEach((button) => {
button.classList.toggle("active", button.dataset.lens === state.lens);
});
document.querySelectorAll("[data-specimen]").forEach((button) => {
button.classList.toggle("active", button.dataset.specimen === state.specimen);
});
traceButton.setAttribute("aria-pressed", String(state.trace));
traceButton.textContent = state.trace
? "■ Stop inheritance trace"
: "▶ Trace inheritance symbol";
}
function confidenceColor(value) {
if (value >= 5) return "#c79cff";
if (value >= 3) return "#79e59a";
if (value >= 2) return "#ffbd66";
return "#5ee7ef";
}
function renderInspector() {
const isOverview = state.lens === "all";
const specimen = specimens[state.specimen];
const lens = lensMeta[state.lens];
if (isOverview) {
inspector.innerHTML = `
<div class="inspector-kicker">
<span>Integrated evidence / overview</span>
<span class="specimen-chip" style="--chip-color:${specimen.color}">${specimen.name}</span>
</div>
<h2>From resemblance<br>to an evolutionary inference</h2>
<p class="inspector-lead">
Select a colored voxel pin to follow one line of evidence. The model
keeps observation, inference, and uncertainty separate.
</p>
<div class="evidence-chain">
<article class="chain-card observation">
<span class="chain-number">01</span>
<h3>Observation / modeled features</h3>
<p>
The comparison combines membrane architecture, reproductive
behavior, genomes, ribosomes, and sequence relationships.
</p>
</article>
<article class="chain-card inference">
<span class="chain-number">02</span>
<h3>Evolutionary inference</h3>
<p>
The integrated explanation is that a bacterium was engulfed,
survived, reproduced inside a host cell, and became integrated
with the host lineage.
</p>
</article>
<div class="bridge">
<strong>Why the observations support the inference</strong>
Multiple independent observations are more compelling than any
single resemblance. Sequence phylogenies provide especially
specific historical evidence.
</div>
<article class="chain-card uncertainty">
<span class="chain-number">03</span>
<h3>Uncertainty / scope</h3>
<p>
This is a simplified reconstruction of possible relationships.
It does not depict every ancient event, and evolutionary
alternatives and details remain debated.
</p>
</article>
</div>
<div class="trait-cues">
<span>Membrane topology</span>
<span>Cellular division</span>
<span>Circular DNA</span>
<span>Bacterial-type ribosomes</span>
<span>Sequence phylogeny</span>
</div>
<div class="confidence" style="--confidence-color:#6ebdff">
<div class="confidence-head">
<span>Relative support</span>
<strong>Strong overall</strong>
</div>
<div class="confidence-bars">
<i class="active"></i><i class="active"></i><i class="active"></i><i class="active"></i><i></i>
</div>
<small>
A qualitative synthesis, not a probability. Individual lines
of evidence have different strengths.
</small>
</div>
<div class="scope-note">
<strong>Important limitation</strong>
The bacterium is a generic reference. Mitochondria trace to an
alpha-proteobacterial lineage, while primary plastids trace to
cyanobacteria.
</div>
<button class="next-button" id="next-evidence" type="button">
Inspect one line of evidence →
</button>
`;
document.getElementById("next-evidence").addEventListener("click", () => {
state.lens = "membrane";
state.selectedEvidence = `${state.specimen}.membrane`;
updateSceneState();
renderInspector();
});
return;
}
const data = evidence[state.specimen][state.lens];
const bars = Array.from({ length: 5 }, (_, i) =>
`<i class="${i < data.support ? "active" : ""}"></i>`
).join("");
inspector.innerHTML = `
<div class="inspector-kicker">
<span>${lens.title}</span>
<span class="specimen-chip" style="--chip-color:${specimen.color}">${specimen.name}</span>
</div>
<h2>${lens.title}</h2>
<p class="inspector-lead">
${specimen.subtitle}. The selected feature is shown as a voxel symbol;
the text separates what is modeled from what is inferred.
</p>
<div class="evidence-chain">
<article class="chain-card observation">
<span class="chain-number">01</span>
<h3>Observation / what the model shows</h3>
<p>${data.observation}</p>
</article>
<article class="chain-card inference">
<span class="chain-number">02</span>
<h3>Inference / evolutionary meaning</h3>
<p>${data.inference}</p>
</article>
<div class="bridge">
<strong>Connection from observation to inference</strong>
${data.bridge}
</div>
<article class="chain-card uncertainty">
<span class="chain-number">03</span>
<h3>Uncertainty / alternative explanation</h3>
<p>${data.uncertainty}</p>
</article>
</div>
<div class="trait-cues">
${data.cues.map((cue) => `<span>${cue}</span>`).join("")}
</div>
<div class="confidence" style="--confidence-color:${confidenceColor(data.support)}">
<div class="confidence-head">
<span>Relative support</span>
<strong>${data.supportLabel} · ${data.confidence}</strong>
</div>
<div class="confidence-bars">${bars}</div>
<small>
A qualitative teaching scale, not a statistical probability or a
measure of certainty.
</small>
</div>
<div class="scope-note">
<strong>What this view does not show</strong>
${state.lens === "genetics"
? "No actual DNA sequence, phylogenetic tree, or timescale is plotted; the symbols summarize published biological evidence."
: state.lens === "membrane"
? "The cutaway simplifies a dynamic three-dimensional membrane system, and protein and lipid origins can be mixed."
: "The copy-and-partition symbol is conceptual. Actual organelle transmission depends on the organism and cell type."}
</div>
<button class="next-button" id="next-evidence" type="button">
Next observation →
</button>
`;
document.getElementById("next-evidence").addEventListener("click", () => {
const lenses = ["membrane", "inheritance", "genetics"];
const specimenIds = Object.keys(specimens);
const currentLens = lenses.indexOf(state.lens);
const currentSpecimen = specimenIds.indexOf(state.specimen);
const nextIndex = (currentLens + 1) % lenses.length;
if (nextIndex === 0) {
const nextSpecimen = (currentSpecimen + 1) % specimenIds.length;
state.specimen = specimenIds[nextSpecimen];
}
state.lens = lenses[nextIndex];
state.selectedEvidence = `${state.specimen}.${state.lens}`;
updateSceneState();
renderInspector();
});
}
function updateSceneState() {
for (const marker of markerObjects) {
const active =
state.lens === "all" ||
marker.type === state.lens;
marker.group.visible = active;
marker.hitbox.visible = active;
const selected = state.selectedEvidence === marker.id;
marker.material.emissiveIntensity = selected ? 1.5 : 0.55;
}
for (const specimen of Object.values(specimenObjects)) {
const membraneStrength =
state.lens === "membrane" ? 0.62 :
state.lens === "all" ? 0.24 : 0.08;
const genomeStrength =
state.lens === "genetics" ? 1.05 :
state.lens === "inheritance" ? 0.52 :
state.lens === "all" ? 0.34 : 0.12;
const ribosomeStrength =
state.lens === "genetics" ? 0.72 :
state.lens === "all" ? 0.24 : 0.08;
specimen.materials.outer.emissiveIntensity = membraneStrength;
specimen.materials.inner.emissiveIntensity = membraneStrength * 0.9;
specimen.materials.genome.emissiveIntensity = genomeStrength;
specimen.materials.ribosome.emissiveIntensity = ribosomeStrength;
specimen.materials.interior.emissiveIntensity =
state.lens === "genetics" ? 0.42 : 0.08;
specimen.padMaterial.emissiveIntensity =
specimen.id === state.specimen ? 0.24 : 0.04;
}
for (const trace of traceObjects) {
trace.visible =
state.trace &&
(state.lens === "inheritance" || state.lens === "all");
}
updateControls();
}
function selectEvidence(evidenceId) {
const [specimen, lens] = evidenceId.split(".");
state.specimen = specimen;
state.lens = lens;
state.selectedEvidence = evidenceId;
updateSceneState();
renderInspector();
}
document.querySelectorAll("[data-lens]").forEach((button) => {
button.addEventListener("click", () => {
state.lens = button.dataset.lens;
state.selectedEvidence =
state.lens === "all" ? null : `${state.specimen}.${state.lens}`;
updateSceneState();
renderInspector();
});
});
document.querySelectorAll("[data-specimen]").forEach((button) => {
button.addEventListener("click", () => {
state.specimen = button.dataset.specimen;
state.selectedEvidence =
state.lens === "all" ? null : `${state.specimen}.${state.lens}`;
updateSceneState();
renderInspector();
});
});
traceButton.addEventListener("click", () => {
state.trace = !state.trace;
updateSceneState();
});
const raycaster = new THREE.Raycaster();
const pointer = new THREE.Vector2();
const pointerState = {
down: false,
moved: false,
startX: 0,
startY: 0,
lastX: 0,
lastY: 0,
shift: false,
button: 0
};
function activeHitboxes() {
return markerHitboxes.filter((hitbox) =>
state.lens === "all" || hitbox.userData.type === state.lens
);
}
function updatePointer(event) {
const rect = canvas.getBoundingClientRect();
pointer.x = ((event.clientX - rect.left) / rect.width) * 2 - 1;
pointer.y = -((event.clientY - rect.top) / rect.height) * 2 + 1;
}
function pickAtPointer(event) {
updatePointer(event);
raycaster.setFromCamera(pointer, camera);
const markerHits = raycaster.intersectObjects(activeHitboxes(), false);
if (markerHits.length) {
return { type: "evidence", id: markerHits[0].object.userData.evidenceId };
}
const modelHits = raycaster.intersectObjects(modelPickMeshes, false);
if (modelHits.length) {
return {
type: "specimen",
id: modelHits[0].object.userData.specimen
};
}
return null;
}
canvas.addEventListener("pointerdown", (event) => {
pointerState.down = true;
pointerState.moved = false;
pointerState.startX = event.clientX;
pointerState.startY = event.clientY;
pointerState.lastX = event.clientX;
pointerState.lastY = event.clientY;
pointerState.shift = event.shiftKey;
pointerState.button = event.button;
canvas.setPointerCapture(event.pointerId);
});
canvas.addEventListener("pointermove", (event) => {
if (pointerState.down) {
const dx = event.clientX - pointerState.lastX;
const dy = event.clientY - pointerState.lastY;
const totalDistance = Math.hypot(
event.clientX - pointerState.startX,
event.clientY - pointerState.startY
);
if (totalDistance > 4) {
pointerState.moved = true;
}
if (pointerState.shift || pointerState.button === 2) {
const right = new THREE.Vector3().setFromMatrixColumn(camera.matrix, 0);
const up = new THREE.Vector3().setFromMatrixColumn(camera.matrix, 1);
const scale = 0.012 / cameraState.zoom;
cameraState.target.addScaledVector(right, -dx * scale);
cameraState.target.addScaledVector(up, dy * scale);
} else {
cameraState.theta -= dx * 0.006;
cameraState.phi = THREE.MathUtils.clamp(
cameraState.phi + dy * 0.005,
0.56,
1.46
);
}
pointerState.lastX = event.clientX;
pointerState.lastY = event.clientY;
hoverTip.hidden = true;
return;
}
const hit = pickAtPointer(event);
if (hit?.type === "evidence") {
const [specimenId, lens] = hit.id.split(".");
const item = evidence[specimenId][lens];
canvas.style.cursor = "pointer";
hoverTip.textContent =
`${lensMeta[lens].title} · ${specimens[specimenId].name}\n${item.observation}`;
hoverTip.style.whiteSpace = "pre-line";
const rect = viewport.getBoundingClientRect();
hoverTip.style.left = `${event.clientX - rect.left}px`;
hoverTip.style.top = `${event.clientY - rect.top}px`;
hoverTip.hidden = false;
} else if (hit?.type === "specimen") {
canvas.style.cursor = "pointer";
hoverTip.hidden = true;
} else {
canvas.style.cursor = "grab";
hoverTip.hidden = true;
}
});
canvas.addEventListener("pointerup", (event) => {
canvas.releasePointerCapture(event.pointerId);
if (!pointerState.moved && pointerState.button === 0) {
const hit = pickAtPointer(event);
if (hit?.type === "evidence") {
selectEvidence(hit.id);
} else if (hit?.type === "specimen") {
state.specimen = hit.id;
state.selectedEvidence =
state.lens === "all" ? null : `${state.specimen}.${state.lens}`;
updateSceneState();
renderInspector();
}
}
pointerState.down = false;
});
canvas.addEventListener("pointerleave", () => {
hoverTip.hidden = true;
pointerState.down = false;
});
canvas.addEventListener("contextmenu", (event) => event.preventDefault());
canvas.addEventListener(
"wheel",
(event) => {
event.preventDefault();
cameraState.zoom = THREE.MathUtils.clamp(
cameraState.zoom * Math.exp(-event.deltaY * 0.001),
0.65,
1.8
);
resize();
},
{ passive: false }
);
function resetView() {
cameraState.theta = 0.72;
cameraState.phi = 1.17;
cameraState.zoom = 1;
cameraState.target.set(0, -0.25, 0);
resize();
}
document.getElementById("reset-view").addEventListener("click", resetView);
canvas.addEventListener("keydown", (event) => {
const amount = 0.08;
if (event.key === "ArrowLeft") cameraState.theta -= amount;
if (event.key === "ArrowRight") cameraState.theta += amount;
if (event.key === "ArrowUp") cameraState.phi -= amount;
if (event.key === "ArrowDown") cameraState.phi += amount;
if (event.key === "+" || event.key === "=") cameraState.zoom *= 1.08;
if (event.key === "-") cameraState.zoom /= 1.08;
if (event.key.toLowerCase() === "r") resetView();
cameraState.phi = THREE.MathUtils.clamp(cameraState.phi, 0.56, 1.46);
cameraState.zoom = THREE.MathUtils.clamp(cameraState.zoom, 0.65, 1.8);
resize();
event.preventDefault();
});
function updateCamera() {
const radius = 18;
const sinPhi = Math.sin(cameraState.phi);
camera.position.set(
cameraState.target.x + radius * sinPhi * Math.sin(cameraState.theta),
cameraState.target.y + radius * Math.cos(cameraState.phi),
cameraState.target.z + radius * sinPhi * Math.cos(cameraState.theta)
);
camera.lookAt(cameraState.target);
camera.updateMatrixWorld();
}
function resize() {
const width = Math.max(1, viewport.clientWidth);
const height = Math.max(1, viewport.clientHeight);
const aspect = width / height;
// Keep the three specimens visible on narrow or wide layouts.
const viewHeight = Math.max(8.7, 12.6 / aspect) / cameraState.zoom;
camera.left = (-viewHeight * aspect) / 2;
camera.right = (viewHeight * aspect) / 2;
camera.top = viewHeight / 2;
camera.bottom = -viewHeight / 2;
camera.updateProjectionMatrix();
renderer.setSize(width, height, false);
}
const resizeObserver = new ResizeObserver(resize);
resizeObserver.observe(viewport);
function projectToViewport(worldPosition) {
const projected = worldPosition.clone().project(camera);
return {
x: (projected.x * 0.5 + 0.5) * viewport.clientWidth,
y: (-projected.y * 0.5 + 0.5) * viewport.clientHeight,
visible: projected.z >= -1 && projected.z <= 1
};
}
function updateWorldLabels() {
for (const [id, specimen] of Object.entries(specimenObjects)) {
const world = specimen.group.localToWorld(
new THREE.Vector3(0, specimen.top, 0)
);
const point = projectToViewport(world);
const element = specimenLabelElements[id];
element.style.left = `${point.x}px`;
element.style.top = `${point.y}px`;
element.style.display = point.visible ? "block" : "none";
}
if (state.selectedEvidence) {
const marker = markerObjects.find(
(item) => item.id === state.selectedEvidence
);
if (marker) {
const world = marker.group.getWorldPosition(new THREE.Vector3());
const point = projectToViewport(world);
const [specimenId, lens] = marker.id.split(".");
selectedCallout.hidden = !point.visible;
selectedCallout.style.left = `${point.x}px`;
selectedCallout.style.top = `${point.y - 8}px`;
selectedCallout.style.setProperty("--callout-color", lensMeta[lens].color);
selectedCallout.textContent =
`${lensMeta[lens].title} · ${specimens[specimenId].name}`;
}
} else {
selectedCallout.hidden = true;
}
}
function animate(time) {
requestAnimationFrame(animate);
const t = time * 0.001;
updateCamera();
for (const marker of markerObjects) {
const targetScale =
marker.id === state.selectedEvidence ? 1.35 : 1;
const nextScale = THREE.MathUtils.lerp(
marker.group.scale.x,
targetScale,
reducedMotion ? 1 : 0.12
);
marker.group.scale.setScalar(nextScale);
if (marker.type === "genetics" && !reducedMotion) {
marker.group.rotation.y = Math.sin(t * 0.9) * 0.22;
}
}
for (const specimen of Object.values(specimenObjects)) {
if (specimen.genome && !reducedMotion) {
specimen.genome.rotation.z = Math.sin(t * 0.45) * 0.025;
}
}
for (const trace of traceObjects) {
if (!trace.visible) continue;
trace.children.forEach((child) => {
const phase = child.userData.phase || 0;
const pulse = reducedMotion ? 1 : 0.88 + Math.sin(t * 2.3 - phase * 0.8) * 0.12;
child.scale.setScalar(pulse);
});
}
updateWorldLabels();
renderer.render(scene, camera);
}
updateSceneState();
renderInspector();
resize();
updateCamera();
requestAnimationFrame(animate);
</script>
</body>
</html>
```