Prompt specification
Build or customize the Three.js 3D scene "Expression-pattern comparison 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: Expression-pattern comparison table
Category: Biology & Nature · Style: Procedural Solid / Shader 3D
License: MIT · Reference: https://three3d.app/scene/expression-pattern-comparison-table-x0908
Scene Description Prompt:
Create a single self-contained HTML file using Three.js from cdnjs that shows gene expression. Let viewers activate different symbolic gene sets in a toy cell; update corresponding functional markers while stating that real regulation involves continuous and interacting processes. Low-poly.
Working Three.js Starter (expression-pattern-comparison-table-x0908):
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Symbolic Gene Expression — Toy Cell</title>
<style>
:root {
color-scheme: dark;
--bg: #06111d;
--panel: #0b1724;
--panel-2: #101f2f;
--line: rgba(159, 196, 218, 0.14);
--text: #edf7fb;
--muted: #8ea6b7;
--mint: #55e6c1;
--amber: #ffc857;
--rose: #ff7082;
--violet: #aa8cff;
--cyan: #55d9e7;
}
* {
box-sizing: border-box;
}
html,
body {
width: 100%;
min-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 {
font: inherit;
}
.app {
min-height: 100vh;
display: flex;
flex-direction: column;
}
.topbar {
height: 68px;
flex: 0 0 68px;
display: flex;
align-items: center;
justify-content: space-between;
gap: 24px;
padding: 0 24px;
border-bottom: 1px solid var(--line);
background: rgba(6, 17, 29, 0.92);
backdrop-filter: blur(18px);
z-index: 10;
}
.brand {
display: flex;
align-items: center;
gap: 13px;
min-width: 0;
}
.brand-mark {
width: 34px;
height: 34px;
position: relative;
flex: 0 0 auto;
border: 1px solid rgba(85, 230, 193, 0.45);
border-radius: 50%;
background: radial-gradient(circle, rgba(85, 230, 193, 0.18), transparent 70%);
}
.brand-mark::before,
.brand-mark::after {
content: "";
position: absolute;
left: 8px;
top: 7px;
width: 16px;
height: 18px;
border: 1.5px solid var(--mint);
border-radius: 50%;
transform: rotate(34deg);
}
.brand-mark::after {
transform: rotate(-34deg);
opacity: 0.55;
}
.brand-copy {
min-width: 0;
}
.brand-title {
font-size: 13px;
font-weight: 750;
letter-spacing: 0.15em;
white-space: nowrap;
}
.brand-subtitle {
margin-top: 3px;
color: var(--muted);
font-size: 11px;
letter-spacing: 0.05em;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.top-status {
display: flex;
align-items: center;
gap: 10px;
color: var(--muted);
font-size: 11px;
letter-spacing: 0.12em;
text-transform: uppercase;
white-space: nowrap;
}
.status-dot {
width: 7px;
height: 7px;
border-radius: 50%;
background: var(--mint);
box-shadow: 0 0 15px rgba(85, 230, 193, 0.9);
}
.workspace {
min-height: 0;
flex: 1;
display: grid;
grid-template-columns: minmax(0, 1fr) 390px;
}
.stage {
position: relative;
min-width: 0;
min-height: 0;
overflow: hidden;
isolation: isolate;
background:
radial-gradient(circle at 48% 44%, rgba(36, 82, 100, 0.16), transparent 46%),
linear-gradient(145deg, #071521, #050d17);
}
#scene {
position: absolute;
inset: 0;
}
#scene canvas {
display: block;
width: 100%;
height: 100%;
outline: none;
touch-action: none;
cursor: grab;
}
#scene canvas:active {
cursor: grabbing;
}
#scene canvas:focus-visible {
outline: 2px solid var(--mint);
outline-offset: -3px;
}
.scene-copy {
position: absolute;
top: 28px;
left: 30px;
max-width: 360px;
pointer-events: none;
z-index: 3;
}
.eyebrow {
color: var(--mint);
font-size: 10px;
font-weight: 750;
letter-spacing: 0.2em;
text-transform: uppercase;
}
.scene-copy h1 {
margin: 9px 0 8px;
font-size: clamp(24px, 3vw, 38px);
line-height: 1.05;
letter-spacing: -0.035em;
font-weight: 720;
}
.scene-copy p {
max-width: 330px;
margin: 0;
color: var(--muted);
font-size: 13px;
line-height: 1.6;
}
.stage-actions {
position: absolute;
top: 28px;
right: 26px;
display: flex;
gap: 8px;
z-index: 4;
}
.small-button {
min-height: 34px;
padding: 0 12px;
border: 1px solid var(--line);
border-radius: 9px;
color: #c9dbe4;
background: rgba(9, 24, 37, 0.76);
backdrop-filter: blur(12px);
cursor: pointer;
font-size: 11px;
font-weight: 650;
letter-spacing: 0.04em;
transition: border-color 160ms ease, color 160ms ease, background 160ms ease;
}
.small-button:hover,
.small-button:focus-visible {
color: white;
border-color: rgba(85, 230, 193, 0.45);
background: rgba(16, 39, 52, 0.92);
outline: none;
}
.active-state {
position: absolute;
top: 29px;
left: 50%;
transform: translateX(-50%);
display: flex;
align-items: baseline;
gap: 6px;
padding: 9px 14px;
border: 1px solid var(--line);
border-radius: 999px;
color: var(--muted);
background: rgba(8, 21, 33, 0.7);
backdrop-filter: blur(12px);
font-size: 10px;
letter-spacing: 0.1em;
text-transform: uppercase;
z-index: 3;
pointer-events: none;
}
.active-state strong {
color: var(--text);
font-size: 14px;
letter-spacing: 0;
}
.scene-footer {
position: absolute;
left: 27px;
right: 27px;
bottom: 22px;
display: flex;
align-items: flex-end;
justify-content: space-between;
gap: 20px;
z-index: 3;
pointer-events: none;
}
.control-hint {
color: #76909f;
font-size: 10px;
line-height: 1.5;
letter-spacing: 0.06em;
}
.control-hint kbd {
display: inline-block;
margin: 0 2px;
padding: 2px 5px;
border: 1px solid var(--line);
border-radius: 4px;
color: #b5cad5;
background: rgba(12, 28, 42, 0.75);
font: inherit;
}
.overall-readout {
width: 190px;
padding: 12px 14px;
border: 1px solid var(--line);
border-radius: 12px;
background: rgba(8, 21, 33, 0.72);
backdrop-filter: blur(12px);
}
.overall-meta {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 8px;
color: var(--muted);
font-size: 9px;
letter-spacing: 0.12em;
text-transform: uppercase;
}
.overall-meta strong {
color: var(--text);
font-size: 11px;
}
.overall-meter {
height: 3px;
overflow: hidden;
border-radius: 999px;
background: rgba(255, 255, 255, 0.09);
}
.overall-meter span {
display: block;
width: 100%;
height: 100%;
border-radius: inherit;
background: linear-gradient(90deg, var(--mint), var(--cyan), var(--violet));
transform: scaleX(0);
transform-origin: left;
transition: transform 120ms linear;
}
.labels {
position: absolute;
inset: 0;
pointer-events: none;
z-index: 2;
}
.organelle-label {
position: absolute;
top: 0;
left: 0;
display: flex;
align-items: center;
gap: 7px;
color: rgba(220, 239, 246, 0.78);
font-size: 8px;
font-weight: 700;
letter-spacing: 0.15em;
text-transform: uppercase;
white-space: nowrap;
text-shadow: 0 1px 8px #000;
will-change: transform;
}
.organelle-label::before {
content: "";
width: 5px;
height: 5px;
border: 1px solid currentColor;
border-radius: 50%;
background: rgba(255, 255, 255, 0.16);
}
.panel {
min-height: 0;
overflow-y: auto;
padding: 25px 22px 30px;
border-left: 1px solid var(--line);
background:
linear-gradient(180deg, rgba(16, 31, 47, 0.97), rgba(8, 19, 31, 0.99));
scrollbar-width: thin;
scrollbar-color: #263d50 transparent;
}
.panel-heading {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 16px;
}
.panel h2 {
margin: 8px 0 0;
font-size: 24px;
line-height: 1.12;
letter-spacing: -0.025em;
}
.panel-actions {
display: flex;
gap: 6px;
flex: 0 0 auto;
}
.panel-actions button {
border: 0;
color: var(--mint);
background: transparent;
cursor: pointer;
padding: 4px 0;
font-size: 10px;
font-weight: 700;
letter-spacing: 0.04em;
}
.panel-actions button:hover,
.panel-actions button:focus-visible {
color: white;
outline: none;
}
.intro {
margin: 12px 0 20px;
color: var(--muted);
font-size: 12px;
line-height: 1.65;
}
.section-title {
display: flex;
align-items: center;
justify-content: space-between;
margin: 22px 0 10px;
color: #7893a3;
font-size: 9px;
font-weight: 750;
letter-spacing: 0.17em;
text-transform: uppercase;
}
.section-title span:last-child {
color: #536d7d;
font-size: 8px;
letter-spacing: 0.08em;
}
.gene-sets {
display: grid;
gap: 9px;
}
.set-card {
--accent: var(--mint);
width: 100%;
position: relative;
display: block;
padding: 13px 14px;
overflow: hidden;
border: 1px solid var(--line);
border-radius: 12px;
color: var(--text);
text-align: left;
background: rgba(255, 255, 255, 0.025);
cursor: pointer;
transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}
.set-card::after {
content: "";
position: absolute;
inset: 0 auto 0 0;
width: 3px;
background: var(--accent);
opacity: 0;
transition: opacity 160ms ease;
}
.set-card:hover {
transform: translateY(-1px);
border-color: rgba(255, 255, 255, 0.2);
background: rgba(255, 255, 255, 0.045);
}
.set-card:focus-visible {
outline: 2px solid var(--accent);
outline-offset: 2px;
}
.set-card.active {
border-color: color-mix(in srgb, var(--accent) 55%, transparent);
background: color-mix(in srgb, var(--accent) 7%, transparent);
}
.set-card.active::after {
opacity: 1;
}
.card-top {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 5px;
}
.set-id {
color: var(--accent);
font-size: 8px;
font-weight: 800;
letter-spacing: 0.15em;
}
.toggle {
width: 29px;
height: 16px;
padding: 2px;
border-radius: 999px;
background: #243747;
transition: background 180ms ease;
}
.toggle span {
display: block;
width: 12px;
height: 12px;
border-radius: 50%;
background: #78909d;
transition: transform 180ms ease, background 180ms ease;
}
.set-card.active .toggle {
background: color-mix(in srgb, var(--accent) 35%, #172938);
}
.set-card.active .toggle span {
transform: translateX(13px);
background: var(--accent);
box-shadow: 0 0 10px color-mix(in srgb, var(--accent) 60%, transparent);
}
.set-name {
margin-bottom: 8px;
font-size: 14px;
font-weight: 700;
letter-spacing: -0.01em;
}
.genes {
display: flex;
flex-wrap: wrap;
gap: 5px;
}
.genes span {
padding: 3px 6px;
border: 1px solid rgba(255, 255, 255, 0.08);
border-radius: 5px;
color: #91a8b6;
background: rgba(0, 0, 0, 0.12);
font: 8px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
letter-spacing: 0.04em;
}
.set-effect {
display: flex;
align-items: center;
gap: 6px;
margin-top: 9px;
color: #78909e;
font-size: 9px;
letter-spacing: 0.04em;
}
.set-effect i {
width: 5px;
height: 5px;
border-radius: 50%;
background: var(--accent);
box-shadow: 0 0 8px color-mix(in srgb, var(--accent) 65%, transparent);
}
.readouts {
display: grid;
gap: 8px;
}
.marker-row {
padding: 11px 12px;
border: 1px solid rgba(255, 255, 255, 0.07);
border-radius: 10px;
background: rgba(0, 0, 0, 0.12);
}
.marker-meta {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
margin-bottom: 7px;
}
.marker-name {
display: flex;
align-items: center;
gap: 7px;
color: #c7d9e2;
font-size: 10px;
font-weight: 650;
}
.marker-name i {
width: 6px;
height: 6px;
border-radius: 50%;
background: var(--accent);
box-shadow: 0 0 8px color-mix(in srgb, var(--accent) 65%, transparent);
}
.marker-meta strong {
color: var(--text);
font: 10px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.meter {
height: 3px;
overflow: hidden;
border-radius: 999px;
background: rgba(255, 255, 255, 0.07);
}
.meter span {
display: block;
width: 100%;
height: 100%;
border-radius: inherit;
background: var(--accent);
transform: scaleX(0);
transform-origin: left;
transition: transform 100ms linear;
}
.marker-state {
display: block;
margin-top: 6px;
color: #536d7d;
font-size: 8px;
letter-spacing: 0.08em;
text-transform: uppercase;
}
.marker-row.on .marker-state {
color: var(--accent);
}
.model-note {
position: relative;
margin-top: 19px;
padding: 14px 14px 14px 16px;
border: 1px solid rgba(85, 230, 193, 0.15);
border-radius: 12px;
background: rgba(85, 230, 193, 0.045);
}
.model-note::before {
content: "";
position: absolute;
top: 13px;
bottom: 13px;
left: 0;
width: 2px;
border-radius: 999px;
background: var(--mint);
}
.model-note strong {
display: block;
margin-bottom: 6px;
color: var(--mint);
font-size: 9px;
letter-spacing: 0.14em;
text-transform: uppercase;
}
.model-note p {
margin: 0;
color: #9eb2bd;
font-size: 10px;
line-height: 1.65;
}
.model-note p strong {
display: inline;
margin: 0;
color: #d8e8ee;
font-size: inherit;
letter-spacing: 0;
text-transform: none;
}
@media (max-width: 980px) {
body {
overflow: auto;
}
.app {
min-height: 100vh;
}
.workspace {
grid-template-columns: 1fr;
}
.stage {
height: 66vh;
min-height: 520px;
}
.panel {
overflow: visible;
border-top: 1px solid var(--line);
border-left: 0;
}
.top-status {
display: none;
}
}
@media (max-width: 620px) {
.topbar {
height: 60px;
flex-basis: 60px;
padding: 0 15px;
}
.brand-subtitle {
display: none;
}
.scene-copy {
top: 20px;
left: 20px;
max-width: 250px;
}
.scene-copy h1 {
font-size: 26px;
}
.scene-copy p {
display: none;
}
.stage-actions {
top: 20px;
right: 16px;
}
.active-state {
top: 76px;
left: 20px;
transform: none;
}
.stage-footer {
left: 17px;
right: 17px;
bottom: 17px;
}
.control-hint {
max-width: 150px;
}
.overall-readout {
width: 150px;
}
.panel {
padding: 23px 16px 30px;
}
}
@media (prefers-reduced-motion: reduce) {
*,
*::before,
*::after {
scroll-behavior: auto !important;
transition-duration: 0.01ms !important;
}
}
</style>
</head>
<body>
<div class="app">
<header class="topbar">
<div class="brand">
<div class="brand-mark" aria-hidden="true"></div>
<div class="brand-copy">
<div class="brand-title">EXPRESSION / CELL 07</div>
<div class="brand-subtitle">Symbolic low-poly regulatory atlas</div>
</div>
</div>
<div class="top-status">
<span class="status-dot"></span>
Interactive toy model
</div>
</header>
<main class="workspace">
<section class="stage" aria-label="Interactive 3D toy cell">
<div id="scene"></div>
<div class="labels" aria-hidden="true">
<div class="organelle-label" id="label-nucleus">Nucleus</div>
<div class="organelle-label" id="label-mito">Mitochondria</div>
<div class="organelle-label" id="label-golgi">Golgi body</div>
<div class="organelle-label" id="label-membrane">Cell membrane</div>
</div>
<div class="scene-copy">
<div class="eyebrow">Toy cell / live readout</div>
<h1>Expression,<br>made visible.</h1>
<p>
Activate fictional gene sets to reveal symbolic functional markers
inside a stylized cell.
</p>
</div>
<div class="active-state" aria-live="polite">
<strong id="active-count">0</strong>
<span>/ 4 sets active</span>
</div>
<div class="stage-actions">
<button class="small-button" id="pause-button" type="button">Pause motion</button>
<button class="small-button" id="reset-view" type="button">Reset view</button>
</div>
<div class="scene-footer">
<div class="control-hint">
Drag to orbit · Scroll to zoom<br>
<kbd>←</kbd> <kbd>→</kbd> rotate ·
<kbd>+</kbd> <kbd>−</kbd> zoom
</div>
<div class="overall-readout">
<div class="overall-meta">
<span>Combined activity</span>
<strong id="overall-label">0%</strong>
</div>
<div class="overall-meter"><span id="overall-fill"></span></div>
</div>
</div>
</section>
<aside class="panel">
<div class="panel-heading">
<div>
<div class="eyebrow">Regulatory inputs</div>
<h2>Activate a gene set</h2>
</div>
<div class="panel-actions">
<button id="compare-all" type="button">Compare all</button>
<button id="clear-all" type="button">Clear</button>
</div>
</div>
<p class="intro">
Each set contains fictional locus identifiers. Switch one or several
sets to compare their corresponding visual and functional readouts.
</p>
<div class="section-title">
<span>Symbolic gene sets</span>
<span>click to activate</span>
</div>
<div class="gene-sets">
<button
class="set-card"
type="button"
data-set="energy"
aria-pressed="false"
style="--accent: var(--mint)"
>
<div class="card-top">
<span class="set-id">SET 01 / ENERGY</span>
<span class="toggle" aria-hidden="true"><span></span></span>
</div>
<div class="set-name">Energy handling</div>
<div class="genes">
<span>EN-01</span><span>EN-02</span><span>EN-04</span><span>EN-07</span>
</div>
<div class="set-effect"><i></i> ATP-like sparks around mitochondria</div>
</button>
<button
class="set-card"
type="button"
data-set="transport"
aria-pressed="false"
style="--accent: var(--amber)"
>
<div class="card-top">
<span class="set-id">SET 02 / TRAFFIC</span>
<span class="toggle" aria-hidden="true"><span></span></span>
</div>
<div class="set-name">Material transport</div>
<div class="genes">
<span>TR-03</span><span>TR-05</span><span>TR-09</span><span>TR-12</span>
</div>
<div class="set-effect"><i></i> Vesicles moving toward the membrane</div>
</button>
<button
class="set-card"
type="button"
data-set="repair"
aria-pressed="false"
style="--accent: var(--rose)"
>
<div class="card-top">
<span class="set-id">SET 03 / SURVEILLANCE</span>
<span class="toggle" aria-hidden="true"><span></span></span>
</div>
<div class="set-name">Genome surveillance</div>
<div class="genes">
<span>RP-11</span><span>RP-14</span><span>RP-16</span><span>RP-19</span>
</div>
<div class="set-effect"><i></i> Pulsing repair halo around the nucleus</div>
</button>
<button
class="set-card"
type="button"
data-set="cycle"
aria-pressed="false"
style="--accent: var(--violet)"
>
<div class="card-top">
<span class="set-id">SET 04 / PROGRESSION</span>
<span class="toggle" aria-hidden="true"><span></span></span>
</div>
<div class="set-name">Cell-cycle progression</div>
<div class="genes">
<span>CC-21</span><span>CC-23</span><span>CC-27</span><span>CC-30</span>
</div>
<div class="set-effect"><i></i> Rotating division-readiness markers</div>
</button>
</div>
<div class="section-title">
<span>Functional markers</span>
<span>relative response</span>
</div>
<div class="readouts">
<div class="marker-row" id="readout-energy" style="--accent: var(--mint)">
<div class="marker-meta">
<span class="marker-name"><i></i>Energy response</span>
<strong id="value-energy">0%</strong>
</div>
<div class="meter"><span id="meter-energy"></span></div>
<small class="marker-state" id="state-energy">Inactive</small>
</div>
<div class="marker-row" id="readout-transport" style="--accent: var(--amber)">
<div class="marker-meta">
<span class="marker-name"><i></i>Transport response</span>
<strong id="value-transport">0%</strong>
</div>
<div class="meter"><span id="meter-transport"></span></div>
<small class="marker-state" id="state-transport">Inactive</small>
</div>
<div class="marker-row" id="readout-repair" style="--accent: var(--rose)">
<div class="marker-meta">
<span class="marker-name"><i></i>Surveillance response</span>
<strong id="value-repair">0%</strong>
</div>
<div class="meter"><span id="meter-repair"></span></div>
<small class="marker-state" id="state-repair">Inactive</small>
</div>
<div class="marker-row" id="readout-cycle" style="--accent: var(--violet)">
<div class="marker-meta">
<span class="marker-name"><i></i>Progression response</span>
<strong id="value-cycle">0%</strong>
</div>
<div class="meter"><span id="meter-cycle"></span></div>
<small class="marker-state" id="state-cycle">Inactive</small>
</div>
</div>
<div class="model-note">
<strong>Model note</strong>
<p>
<strong>Real gene regulation is not a collection of on/off switches.</strong>
In living systems, expression is continuous, combinatorial, context-dependent,
and shaped by interacting feedback loops. This isolated toy model shows
selected symbolic readouts for exploration, not a faithful regulatory model.
</p>
</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 mount = document.getElementById("scene");
const reducedMotion = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
const scene = new THREE.Scene();
scene.background = new THREE.Color(0x06111d);
scene.fog = new THREE.FogExp2(0x06111d, 0.024);
const camera = new THREE.PerspectiveCamera(43, 1, 0.1, 100);
const renderer = new THREE.WebGLRenderer({
antialias: true,
alpha: false,
powerPreference: "high-performance"
});
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1.08;
renderer.setClearColor(0x06111d, 1);
renderer.domElement.tabIndex = 0;
renderer.domElement.setAttribute(
"aria-label",
"Interactive low-poly toy cell. Drag to orbit, scroll to zoom, or use arrow keys."
);
mount.appendChild(renderer.domElement);
const world = new THREE.Group();
scene.add(world);
const backgroundGroup = new THREE.Group();
scene.add(backgroundGroup);
const colors = {
membrane: 0x55d9e7,
nucleus: 0x9b83df,
nucleolus: 0xd6b7ff,
mitochondria: 0xef6c72,
golgi: 0xffc857,
mint: 0x55e6c1,
amber: 0xffc857,
rose: 0xff7082,
violet: 0xaa8cff
};
scene.add(new THREE.HemisphereLight(0xa9e8ff, 0x111422, 1.45));
const keyLight = new THREE.DirectionalLight(0xd9f6ff, 2.3);
keyLight.position.set(5, 7, 8);
scene.add(keyLight);
const rimLight = new THREE.DirectionalLight(0x8c76ff, 1.65);
rimLight.position.set(-6, 1, -6);
scene.add(rimLight);
const warmLight = new THREE.PointLight(0xff8f71, 13, 14, 2);
warmLight.position.set(3.5, -2.5, 3);
scene.add(warmLight);
// ---- Low-poly cell membrane ------------------------------------------
const membraneGeometry = new THREE.IcosahedronGeometry(3.08, 2);
const membranePositions = membraneGeometry.attributes.position;
const vertex = new THREE.Vector3();
for (let i = 0; i < membranePositions.count; i++) {
vertex.fromBufferAttribute(membranePositions, i);
const factor =
1 +
0.028 * Math.sin(vertex.x * 2.1 + vertex.y * 1.4) +
0.018 * Math.sin(vertex.z * 3.2 - vertex.x * 0.8);
vertex.multiplyScalar(factor);
membranePositions.setXYZ(i, vertex.x, vertex.y, vertex.z);
}
membraneGeometry.computeVertexNormals();
const membraneMaterial = new THREE.MeshPhysicalMaterial({
color: colors.membrane,
roughness: 0.62,
metalness: 0.08,
transparent: true,
opacity: 0.11,
side: THREE.DoubleSide,
depthWrite: false,
flatShading: true
});
const membrane = new THREE.Mesh(membraneGeometry, membraneMaterial);
membrane.renderOrder = 5;
world.add(membrane);
const membraneEdges = new THREE.LineSegments(
new THREE.WireframeGeometry(membraneGeometry),
new THREE.LineBasicMaterial({
color: 0x65cbd8,
transparent: true,
opacity: 0.12,
depthWrite: false
})
);
membraneEdges.renderOrder = 6;
world.add(membraneEdges);
const membraneHalo = new THREE.Mesh(
membraneGeometry.clone(),
new THREE.MeshBasicMaterial({
color: 0x4fd9ea,
transparent: true,
opacity: 0.025,
side: THREE.BackSide,
depthWrite: false,
blending: THREE.AdditiveBlending
})
);
membraneHalo.scale.setScalar(1.035);
world.add(membraneHalo);
// ---- Nucleus ---------------------------------------------------------
const nucleusGroup = new THREE.Group();
nucleusGroup.position.set(-0.48, 0.12, 0.22);
world.add(nucleusGroup);
const nucleusMaterial = new THREE.MeshStandardMaterial({
color: colors.nucleus,
emissive: 0x493683,
emissiveIntensity: 0.08,
roughness: 0.76,
metalness: 0.05,
flatShading: true
});
const nucleus = new THREE.Mesh(
new THREE.IcosahedronGeometry(1.13, 1),
nucleusMaterial
);
nucleusGroup.add(nucleus);
const nucleusEdges = new THREE.LineSegments(
new THREE.WireframeGeometry(new THREE.IcosahedronGeometry(1.13, 1)),
new THREE.LineBasicMaterial({
color: 0xd5c4ff,
transparent: true,
opacity: 0.16
})
);
nucleusGroup.add(nucleusEdges);
const nucleolus = new THREE.Mesh(
new THREE.IcosahedronGeometry(0.38, 1),
new THREE.MeshStandardMaterial({
color: colors.nucleolus,
emissive: 0x7446b8,
emissiveIntensity: 0.22,
roughness: 0.8,
flatShading: true
})
);
nucleolus.position.set(-0.13, -0.06, 0.48);
nucleusGroup.add(nucleolus);
// Stylized endoplasmic reticulum.
const erMaterial = new THREE.MeshStandardMaterial({
color: 0xb67ad5,
emissive: 0x542d73,
emissiveIntensity: 0.15,
roughness: 0.8,
flatShading: true
});
for (let i = 0; i < 3; i++) {
const er = new THREE.Mesh(
new THREE.TorusGeometry(1.35 + i * 0.08, 0.065, 4, 28, Math.PI * 1.38),
erMaterial
);
er.rotation.set(1.05 + i * 0.34, i * 0.55, 0.2 * i);
er.position.set(-0.02 * i, 0, 0);
nucleusGroup.add(er);
}
// ---- Mitochondria ----------------------------------------------------
const mitochondria = [];
const mitochondriaMaterial = new THREE.MeshStandardMaterial({
color: colors.mitochondria,
emissive: 0x7c1e2a,
emissiveIntensity: 0.08,
roughness: 0.66,
metalness: 0.08,
flatShading: true
});
const cristaeMaterial = new THREE.MeshBasicMaterial({
color: 0xffc4a7,
transparent: true,
opacity: 0.64
});
const mitochondrionData = [
{ position: [-1.55, 1.25, 0.15], rotation: [0.2, 0.5, 0.55] },
{ position: [1.38, -1.22, 0.1], rotation: [0.7, -0.25, -0.55] },
{ position: [0.82, 1.72, -0.45], rotation: [-0.4, 0.8, 0.2] }
];
for (const data of mitochondrionData) {
const group = new THREE.Group();
group.position.set(...data.position);
group.rotation.set(...data.rotation);
const body = new THREE.Mesh(
new THREE.DodecahedronGeometry(0.48, 0),
mitochondriaMaterial
);
body.scale.set(1.55, 0.72, 0.8);
group.add(body);
for (let j = -1; j <= 1; j++) {
const ridge = new THREE.Mesh(
new THREE.TorusGeometry(0.22, 0.026, 3, 12),
cristaeMaterial
);
ridge.position.x = j * 0.27;
ridge.scale.set(1.0, 0.65, 1);
group.add(ridge);
}
mitochondria.push(group);
world.add(group);
}
// ---- Golgi body ------------------------------------------------------
const golgiGroup = new THREE.Group();
golgiGroup.position.set(1.18, 0.36, 0.76);
golgiGroup.rotation.set(0.1, -0.25, -0.15);
world.add(golgiGroup);
const golgiMaterial = new THREE.MeshStandardMaterial({
color: colors.golgi,
emissive: 0x8b5712,
emissiveIntensity: 0.05,
roughness: 0.72,
flatShading: true
});
for (let i = 0; i < 5; i++) {
const cisterna = new THREE.Mesh(
new THREE.TorusGeometry(0.6 - i * 0.047, 0.075, 4, 14, Math.PI * 1.3),
golgiMaterial
);
cisterna.rotation.set(Math.PI / 2 + i * 0.035, 0.14, Math.PI * 0.12);
cisterna.position.set(i * 0.035, (i - 2) * 0.13, -i * 0.025);
golgiGroup.add(cisterna);
}
// ---- Ribosome point cloud -------------------------------------------
const ribosomePositions = [];
for (let i = 0; i < 115; i++) {
const x = (Math.random() - 0.5) * 5.4;
const y = (Math.random() - 0.5) * 5.4;
const z = (Math.random() - 0.5) * 5.4;
const radius = Math.sqrt(x * x + y * y + z * z);
const nucleusDistance = Math.hypot(
x + 0.48,
y - 0.12,
z - 0.22
);
if (radius < 2.65 && nucleusDistance > 1.4) {
ribosomePositions.push(x, y, z);
}
}
const ribosomeGeometry = new THREE.BufferGeometry();
ribosomeGeometry.setAttribute(
"position",
new THREE.Float32BufferAttribute(ribosomePositions, 3)
);
const ribosomes = new THREE.Points(
ribosomeGeometry,
new THREE.PointsMaterial({
color: 0xa6d8e5,
size: 0.035,
transparent: true,
opacity: 0.46,
sizeAttenuation: true,
depthWrite: false
})
);
world.add(ribosomes);
// ---- Background orbital guides ---------------------------------------
function addOrbit(radius, tiltX, tiltZ, opacity) {
const points = [];
for (let i = 0; i <= 96; i++) {
const angle = (i / 96) * Math.PI * 2;
points.push(
new THREE.Vector3(
Math.cos(angle) * radius,
Math.sin(angle) * radius,
0
)
);
}
const geometry = new THREE.BufferGeometry().setFromPoints(points);
const line = new THREE.Line(
geometry,
new THREE.LineBasicMaterial({
color: 0x41677a,
transparent: true,
opacity,
depthWrite: false
})
);
line.rotation.x = tiltX;
line.rotation.z = tiltZ;
backgroundGroup.add(line);
}
addOrbit(4.25, 1.12, 0.22, 0.12);
addOrbit(5.15, 0.65, 0.8, 0.08);
addOrbit(6.1, 1.38, -0.45, 0.055);
const starPositions = [];
for (let i = 0; i < 180; i++) {
const radius = 8 + Math.random() * 12;
const theta = Math.random() * Math.PI * 2;
const phi = Math.acos(2 * Math.random() - 1);
starPositions.push(
radius * Math.sin(phi) * Math.cos(theta),
radius * Math.cos(phi),
radius * Math.sin(phi) * Math.sin(theta)
);
}
const starsGeometry = new THREE.BufferGeometry();
starsGeometry.setAttribute(
"position",
new THREE.Float32BufferAttribute(starPositions, 3)
);
const stars = new THREE.Points(
starsGeometry,
new THREE.PointsMaterial({
color: 0x7fa8bc,
size: 0.035,
transparent: true,
opacity: 0.45,
depthWrite: false
})
);
scene.add(stars);
// ---- Energy marker: ATP-like sparks ----------------------------------
const energyGroup = new THREE.Group();
world.add(energyGroup);
const energyMaterial = new THREE.MeshStandardMaterial({
color: colors.mint,
emissive: colors.mint,
emissiveIntensity: 1.7,
roughness: 0.25,
transparent: true,
opacity: 0,
depthWrite: false,
blending: THREE.AdditiveBlending
});
const energyGeometry = new THREE.OctahedronGeometry(0.09, 0);
const energyParticles = [];
for (let i = 0; i < 20; i++) {
const source = mitochondrionData[i % mitochondrionData.length];
const particle = new THREE.Mesh(energyGeometry, energyMaterial);
const base = new THREE.Vector3(
source.position[0] + (Math.random() - 0.5) * 1.25,
source.position[1] + (Math.random() - 0.5) * 0.75,
source.position[2] + 0.38 + Math.random() * 0.2
);
particle.position.copy(base);
particle.userData.base = base;
particle.userData.phase = Math.random() * Math.PI * 2;
particle.userData.speed = 0.65 + Math.random() * 0.8;
energyParticles.push(particle);
energyGroup.add(particle);
}
// ---- Transport marker: vesicle route ---------------------------------
const transportGroup = new THREE.Group();
world.add(transportGroup);
const transportPath = new THREE.CatmullRomCurve3([
new THREE.Vector3(1.15, 0.38, 0.9),
new THREE.Vector3(1.7, 0.7, 1.18),
new THREE.Vector3(2.25, 0.48, 1.42),
new THREE.Vector3(2.78, 0.13, 1.25)
]);
const pathMaterial = new THREE.LineDashedMaterial({
color: colors.amber,
dashSize: 0.13,
gapSize: 0.09,
transparent: true,
opacity: 0,
depthWrite: false
});
const pathLine = new THREE.Line(
new THREE.BufferGeometry().setFromPoints(transportPath.getPoints(80)),
pathMaterial
);
pathLine.computeLineDistances();
transportGroup.add(pathLine);
const vesicleMaterial = new THREE.MeshStandardMaterial({
color: 0xffd77e,
emissive: colors.amber,
emissiveIntensity: 1.15,
roughness: 0.38,
transparent: true,
opacity: 0,
depthWrite: false
});
const vesicles = [];
for (let i = 0; i < 6; i++) {
const vesicle = new THREE.Mesh(
new THREE.DodecahedronGeometry(0.105, 0),
vesicleMaterial
);
vesicle.userData.offset = i / 6;
vesicles.push(vesicle);
transportGroup.add(vesicle);
}
// ---- Surveillance marker: nuclear repair arcs ------------------------
const repairGroup = new THREE.Group();
repairGroup.position.copy(nucleusGroup.position);
world.add(repairGroup);
const repairMaterial = new THREE.MeshBasicMaterial({
color: colors.rose,
transparent: true,
opacity: 0,
depthWrite: false,
blending: THREE.AdditiveBlending
});
for (let i = 0; i < 4; i++) {
const arc = new THREE.Mesh(
new THREE.TorusGeometry(1.34, 0.025, 3, 42, Math.PI * 0.73),
repairMaterial
);
arc.rotation.set(i * 0.72, i * 0.91, i * 0.53);
repairGroup.add(arc);
}
const repairSparks = [];
for (let i = 0; i < 8; i++) {
const spark = new THREE.Mesh(
new THREE.OctahedronGeometry(0.055, 0),
repairMaterial
);
const angle = (i / 8) * Math.PI * 2;
spark.userData.angle = angle;
spark.userData.base = new THREE.Vector3(
Math.cos(angle) * 1.34,
Math.sin(angle) * 1.34,
0.12
);
spark.position.copy(spark.userData.base);
repairSparks.push(spark);
repairGroup.add(spark);
}
// ---- Cell-cycle marker: division readiness --------------------------
const cycleGroup = new THREE.Group();
cycleGroup.position.copy(nucleusGroup.position);
world.add(cycleGroup);
const cycleMaterial = new THREE.MeshStandardMaterial({
color: colors.violet,
emissive: 0x5133ba,
emissiveIntensity: 1.25,
roughness: 0.35,
transparent: true,
opacity: 0,
depthWrite: false
});
const cycleBars = [];
for (let i = 0; i < 12; i++) {
const angle = (i / 12) * Math.PI * 2;
const bar = new THREE.Mesh(
new THREE.BoxGeometry(0.055, 0.25, 0.065),
cycleMaterial
);
bar.position.set(
Math.cos(angle) * 1.56,
Math.sin(angle) * 1.56,
0
);
bar.rotation.z = -angle;
bar.userData.angle = angle;
bar.userData.phase = i * 0.45;
cycleBars.push(bar);
cycleGroup.add(bar);
}
// ---- Pathway state ---------------------------------------------------
const pathways = {
energy: { target: 0, value: 0, group: energyGroup },
transport: { target: 0, value: 0, group: transportGroup },
repair: { target: 0, value: 0, group: repairGroup },
cycle: { target: 0, value: 0, group: cycleGroup }
};
const setButtons = [...document.querySelectorAll(".set-card")];
function updateButtonStates() {
for (const button of setButtons) {
const active = pathways[button.dataset.set].target > 0.5;
button.classList.toggle("active", active);
button.setAttribute("aria-pressed", String(active));
}
}
setButtons.forEach((button) => {
button.addEventListener("click", () => {
const pathway = pathways[button.dataset.set];
pathway.target = pathway.target > 0.5 ? 0 : 1;
updateButtonStates();
});
});
document.getElementById("compare-all").addEventListener("click", () => {
Object.values(pathways).forEach((pathway) => {
pathway.target = 1;
});
updateButtonStates();
});
document.getElementById("clear-all").addEventListener("click", () => {
Object.values(pathways).forEach((pathway) => {
pathway.target = 0;
});
updateButtonStates();
});
// ---- Direct camera controls ------------------------------------------
const cameraState = {
theta: 0.74,
phi: 1.13,
radius: 10.4,
targetTheta: 0.74,
targetPhi: 1.13,
targetRadius: 10.4
};
function updateCamera(dt = 1) {
const damping = 1 - Math.exp(-9 * dt);
cameraState.theta +=
(cameraState.targetTheta - cameraState.theta) * damping;
cameraState.phi +=
(cameraState.targetPhi - cameraState.phi) * damping;
cameraState.radius +=
(cameraState.targetRadius - cameraState.radius) * damping;
const sinPhi = Math.sin(cameraState.phi);
camera.position.set(
cameraState.radius * sinPhi * Math.sin(cameraState.theta),
cameraState.radius * Math.cos(cameraState.phi),
cameraState.radius * sinPhi * Math.cos(cameraState.theta)
);
camera.lookAt(0, 0, 0);
}
function resetCamera() {
cameraState.targetTheta = 0.74;
cameraState.targetPhi = 1.13;
cameraState.targetRadius = 10.4;
}
document.getElementById("reset-view").addEventListener("click", resetCamera);
let dragging = false;
let lastPointerX = 0;
let lastPointerY = 0;
renderer.domElement.addEventListener("pointerdown", (event) => {
dragging = true;
lastPointerX = event.clientX;
lastPointerY = event.clientY;
renderer.domElement.setPointerCapture(event.pointerId);
});
renderer.domElement.addEventListener("pointermove", (event) => {
if (!dragging) return;
const dx = event.clientX - lastPointerX;
const dy = event.clientY - lastPointerY;
lastPointerX = event.clientX;
lastPointerY = event.clientY;
cameraState.targetTheta -= dx * 0.006;
cameraState.targetPhi = THREE.MathUtils.clamp(
cameraState.targetPhi - dy * 0.006,
0.35,
2.72
);
});
function stopDragging(event) {
dragging = false;
if (
event &&
renderer.domElement.hasPointerCapture &&
renderer.domElement.hasPointerCapture(event.pointerId)
) {
renderer.domElement.releasePointerCapture(event.pointerId);
}
}
renderer.domElement.addEventListener("pointerup", stopDragging);
renderer.domElement.addEventListener("pointercancel", stopDragging);
renderer.domElement.addEventListener(
"wheel",
(event) => {
event.preventDefault();
cameraState.targetRadius = THREE.MathUtils.clamp(
cameraState.targetRadius + event.deltaY * 0.008,
6.8,
16.5
);
},
{ passive: false }
);
renderer.domElement.addEventListener("dblclick", resetCamera);
renderer.domElement.addEventListener("keydown", (event) => {
let handled = true;
switch (event.key) {
case "ArrowLeft":
cameraState.targetTheta += 0.12;
break;
case "ArrowRight":
cameraState.targetTheta -= 0.12;
break;
case "ArrowUp":
cameraState.targetPhi = THREE.MathUtils.clamp(
cameraState.targetPhi - 0.09,
0.35,
2.72
);
break;
case "ArrowDown":
cameraState.targetPhi = THREE.MathUtils.clamp(
cameraState.targetPhi + 0.09,
0.35,
2.72
);
break;
case "+":
case "=":
cameraState.targetRadius = Math.max(
6.8,
cameraState.targetRadius - 0.6
);
break;
case "-":
case "_":
cameraState.targetRadius = Math.min(
16.5,
cameraState.targetRadius + 0.6
);
break;
case "0":
resetCamera();
break;
default:
handled = false;
}
if (handled) event.preventDefault();
});
// ---- Pause control ----------------------------------------------------
let paused = false;
const pauseButton = document.getElementById("pause-button");
pauseButton.addEventListener("click", () => {
paused = !paused;
pauseButton.textContent = paused ? "Resume motion" : "Pause motion";
pauseButton.setAttribute("aria-pressed", String(paused));
});
// ---- DOM labels projected from 3D -------------------------------------
const labelDefinitions = [
{
element: document.getElementById("label-nucleus"),
position: new THREE.Vector3(-0.48, 1.4, 0.22)
},
{
element: document.getElementById("label-mito"),
position: new THREE.Vector3(1.3, 1.65, -0.2)
},
{
element: document.getElementById("label-golgi"),
position: new THREE.Vector3(1.45, 0.15, 1.25)
},
{
element: document.getElementById("label-membrane"),
position: new THREE.Vector3(2.2, 2.05, 0.2)
}
];
function updateLabels() {
const width = mount.clientWidth;
const height = mount.clientHeight;
for (const label of labelDefinitions) {
const projected = label.position.clone().project(camera);
const visible = projected.z > -1 && projected.z < 1;
label.element.style.opacity = visible ? "1" : "0";
const x = (projected.x * 0.5 + 0.5) * width;
const y = (-projected.y * 0.5 + 0.5) * height;
label.element.style.transform =
`translate(-50%, -50%) translate(${x}px, ${y}px)`;
}
}
// ---- Resize -----------------------------------------------------------
function resize() {
const width = Math.max(mount.clientWidth, 1);
const height = Math.max(mount.clientHeight, 1);
camera.aspect = width / height;
camera.updateProjectionMatrix();
renderer.setSize(width, height, false);
}
const resizeObserver = new ResizeObserver(resize);
resizeObserver.observe(mount);
resize();
// ---- Readout updates --------------------------------------------------
function updateReadouts() {
let total = 0;
for (const [key, pathway] of Object.entries(pathways)) {
const percentage = Math.round(pathway.value * 100);
total += pathway.value;
const meter = document.getElementById(`meter-${key}`);
const value = document.getElementById(`value-${key}`);
const state = document.getElementById(`state-${key}`);
const row = document.getElementById(`readout-${key}`);
meter.style.transform = `scaleX(${pathway.value})`;
value.textContent = `${percentage}%`;
state.textContent =
pathway.value < 0.02
? "Inactive"
: pathway.value < 0.96
? "Responding"
: "Active";
row.classList.toggle("on", pathway.value > 0.02);
}
const normalizedTotal = total / 4;
document.getElementById("overall-fill").style.transform =
`scaleX(${normalizedTotal})`;
document.getElementById("overall-label").textContent =
`${Math.round(normalizedTotal * 100)}%`;
const activeCount = Object.values(pathways).filter(
(pathway) => pathway.target > 0.5
).length;
document.getElementById("active-count").textContent = activeCount;
}
// ---- Animation --------------------------------------------------------
let previousTime = performance.now();
let simulationTime = 0;
const motionScale = reducedMotion ? 0.22 : 1;
function animate(now) {
requestAnimationFrame(animate);
const dt = THREE.MathUtils.clamp((now - previousTime) / 1000, 0, 0.05);
previousTime = now;
if (!paused) {
simulationTime += dt * motionScale;
}
for (const pathway of Object.values(pathways)) {
const response = 1 - Math.exp(-5.5 * dt);
pathway.value += (pathway.target - pathway.value) * response;
pathway.group.visible = pathway.value > 0.008;
}
const energyValue = pathways.energy.value;
const transportValue = pathways.transport.value;
const repairValue = pathways.repair.value;
const cycleValue = pathways.cycle.value;
// Energy particles orbit their nearby mitochondria.
energyParticles.forEach((particle, index) => {
const phase = particle.userData.phase;
const speed = particle.userData.speed;
const base = particle.userData.base;
particle.position.x =
base.x + Math.sin(simulationTime * speed + phase) * 0.16;
particle.position.y =
base.y + Math.cos(simulationTime * speed * 1.2 + phase) * 0.18;
particle.position.z =
base.z + Math.sin(simulationTime * speed * 0.8 + phase) * 0.13;
const pulse =
0.76 +
0.24 * Math.sin(simulationTime * 3.1 + phase + index * 0.21);
particle.scale.setScalar(
Math.max(0.001, energyValue * pulse * (0.8 + energyValue * 0.35))
);
particle.rotation.x += dt * 0.8;
particle.rotation.y += dt * 1.1;
});
energyMaterial.opacity = energyValue * 0.92;
mitochondriaMaterial.emissiveIntensity = 0.08 + energyValue * 0.85;
mitochondria.forEach((mitochondrion, index) => {
mitochondrion.scale.setScalar(
1 + energyValue * 0.035 * Math.sin(simulationTime * 2 + index)
);
});
// Vesicles travel along the transport curve.
vesicles.forEach((vesicle, index) => {
const progress =
(simulationTime * 0.105 + vesicle.userData.offset) % 1;
const point = transportPath.getPointAt(progress);
vesicle.position.copy(point);
const pulse =
0.78 + 0.22 * Math.sin(simulationTime * 4 + index * 0.8);
vesicle.scale.setScalar(Math.max(0.001, transportValue * pulse));
vesicle.rotation.x += dt * 1.2;
vesicle.rotation.y += dt * 1.5;
});
pathMaterial.opacity = transportValue * 0.52;
vesicleMaterial.opacity = transportValue * 0.92;
golgiMaterial.emissiveIntensity = 0.05 + transportValue * 0.8;
// Repair halo rotates and pulses around the nucleus.
repairGroup.rotation.y = simulationTime * 0.18;
repairGroup.rotation.z = Math.sin(simulationTime * 0.4) * 0.08;
repairMaterial.opacity =
repairValue * (0.48 + 0.38 * Math.sin(simulationTime * 2.8) * 0.5 + 0.19);
repairSparks.forEach((spark, index) => {
const angle = spark.userData.angle + simulationTime * 0.14;
const base = spark.userData.base;
const radius = 1.34 + Math.sin(simulationTime * 2 + index) * 0.05;
spark.position.set(
Math.cos(angle) * radius,
Math.sin(angle) * radius,
base.z
);
spark.scale.setScalar(
Math.max(
0.001,
repairValue * (0.65 + 0.35 * Math.sin(simulationTime * 3 + index))
)
);
});
nucleusMaterial.emissiveIntensity = 0.08 + repairValue * 0.5;
// Division-readiness markers rotate around the nuclear envelope.
cycleGroup.rotation.z = simulationTime * 0.22;
cycleMaterial.opacity = cycleValue * 0.95;
cycleBars.forEach((bar, index) => {
const pulse =
0.68 +
0.32 * Math.sin(simulationTime * 2.6 + bar.userData.phase);
bar.scale.set(
Math.max(0.001, cycleValue),
Math.max(0.001, cycleValue * (0.75 + pulse * 0.45)),
Math.max(0.001, cycleValue)
);
});
nucleolus.scale.setScalar(
1 + cycleValue * 0.16 * (1 + Math.sin(simulationTime * 2.2) * 0.08)
);
// Subtle environmental motion.
backgroundGroup.rotation.y = simulationTime * 0.008;
stars.rotation.y = simulationTime * 0.003;
golgiGroup.rotation.y = -0.25 + Math.sin(simulationTime * 0.22) * 0.08;
updateCamera(dt);
updateReadouts();
updateLabels();
renderer.render(scene, camera);
}
updateButtonStates();
updateReadouts();
updateCamera(1);
requestAnimationFrame(animate);
</script>
</body>
</html>
```