Prompt specification
Build or customize the Three.js 3D scene "Underground seedling development tray" 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: Underground seedling development tray
Category: Biology & Nature · Style: Procedural Solid / Shader 3D
License: MIT · Reference: https://three3d.app/scene/underground-seedling-development-tray-x0771
Scene Description Prompt:
Please create one self-contained HTML file with Three.js from cdnjs showing root gravitropism. Compose several transparent soil cells with seeds, roots, shoots, and moisture zones; a timeline reveals how each plant establishes distinct aboveground and belowground directions. Stylized solid forms.
Working Three.js Starter (underground-seedling-development-tray-x0771):
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Root Gravitropism — Interactive Botanical Study</title>
<style>
:root {
--ink: #25332d;
--muted: #6d756d;
--paper: #e9e6dd;
--panel: rgba(249, 247, 240, 0.88);
--line: rgba(50, 68, 59, 0.16);
--root: #dca85d;
--shoot: #3d9360;
--water: #6ba6b6;
--accent: #a95f3e;
--timeline-fill: 72%;
}
* {
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: var(--paper);
color: var(--ink);
font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
"Segoe UI", sans-serif;
}
button,
input {
font: inherit;
}
button {
color: inherit;
}
#stage {
position: fixed;
inset: 0;
}
#stage canvas {
display: block;
width: 100%;
height: 100%;
cursor: grab;
touch-action: none;
}
#stage canvas.dragging {
cursor: grabbing;
}
.header {
position: fixed;
z-index: 10;
top: 22px;
left: 24px;
right: 24px;
display: flex;
align-items: flex-start;
justify-content: space-between;
pointer-events: none;
}
.eyebrow {
display: flex;
align-items: center;
gap: 10px;
margin-bottom: 7px;
color: var(--muted);
font-size: 10px;
font-weight: 750;
letter-spacing: 0.18em;
text-transform: uppercase;
}
.eyebrow::before {
width: 23px;
height: 1px;
background: var(--accent);
content: "";
}
h1 {
margin: 0;
font-family: Georgia, "Times New Roman", serif;
font-size: clamp(27px, 3.1vw, 46px);
font-weight: 400;
letter-spacing: -0.045em;
line-height: 0.95;
}
.subtitle {
max-width: 440px;
margin-top: 10px;
color: var(--muted);
font-size: 12px;
line-height: 1.5;
}
.header-actions {
display: flex;
align-items: center;
gap: 9px;
pointer-events: auto;
}
.badge,
.control-button {
border: 1px solid var(--line);
background: rgba(248, 246, 239, 0.72);
box-shadow: 0 8px 25px rgba(45, 51, 43, 0.05);
backdrop-filter: blur(12px);
}
.badge {
display: flex;
align-items: center;
gap: 8px;
padding: 9px 12px;
border-radius: 999px;
color: var(--muted);
font-size: 9px;
font-weight: 750;
letter-spacing: 0.14em;
text-transform: uppercase;
}
.badge::before {
width: 7px;
height: 7px;
border-radius: 50%;
background: var(--shoot);
box-shadow: 0 0 0 4px rgba(61, 147, 96, 0.12);
content: "";
}
.control-button {
height: 36px;
padding: 0 13px;
border-radius: 999px;
cursor: pointer;
font-size: 10px;
font-weight: 700;
letter-spacing: 0.08em;
text-transform: uppercase;
transition: background 160ms ease, transform 160ms ease;
}
.control-button:hover {
background: rgba(255, 255, 255, 0.95);
transform: translateY(-1px);
}
.insight {
position: fixed;
z-index: 9;
top: 142px;
left: 24px;
width: 238px;
padding: 17px 18px;
border: 1px solid var(--line);
border-radius: 16px;
background: var(--panel);
box-shadow: 0 18px 50px rgba(45, 51, 43, 0.08);
backdrop-filter: blur(16px);
}
.insight-title {
margin: 0 0 11px;
font-family: Georgia, "Times New Roman", serif;
font-size: 19px;
font-weight: 400;
letter-spacing: -0.02em;
}
.insight p {
margin: 0 0 14px;
color: var(--muted);
font-size: 11px;
line-height: 1.55;
}
.legend {
display: grid;
gap: 8px;
padding-top: 12px;
border-top: 1px solid var(--line);
}
.legend-item {
display: flex;
align-items: center;
gap: 9px;
color: #566159;
font-size: 10px;
font-weight: 650;
letter-spacing: 0.03em;
}
.legend-dot {
width: 9px;
height: 9px;
border-radius: 50%;
}
.legend-dot.root {
background: var(--root);
}
.legend-dot.shoot {
background: var(--shoot);
}
.legend-dot.water {
background: var(--water);
box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.35);
}
.hint {
position: fixed;
z-index: 8;
top: 91px;
right: 24px;
color: rgba(61, 72, 65, 0.7);
font-size: 9px;
font-weight: 700;
letter-spacing: 0.12em;
text-transform: uppercase;
pointer-events: none;
}
.specimen-label {
position: fixed;
z-index: 5;
min-width: 112px;
padding: 8px 10px;
border: 1px solid rgba(54, 68, 59, 0.12);
border-radius: 10px;
background: rgba(247, 245, 238, 0.78);
box-shadow: 0 10px 28px rgba(48, 57, 50, 0.05);
backdrop-filter: blur(10px);
text-align: center;
pointer-events: none;
transform: translate(-50%, -100%);
}
.specimen-label .number {
display: block;
margin-bottom: 2px;
color: var(--accent);
font-size: 8px;
font-weight: 800;
letter-spacing: 0.15em;
text-transform: uppercase;
}
.specimen-label .name {
display: block;
font-family: Georgia, "Times New Roman", serif;
font-size: 13px;
letter-spacing: -0.01em;
}
.gravity-label {
position: fixed;
z-index: 5;
padding: 5px 8px;
border-radius: 999px;
background: rgba(169, 95, 62, 0.1);
color: var(--accent);
font-family: Georgia, "Times New Roman", serif;
font-size: 16px;
font-style: italic;
pointer-events: none;
transform: translate(-50%, -50%);
}
.timeline-panel {
position: fixed;
z-index: 20;
bottom: 22px;
left: 50%;
width: min(880px, calc(100% - 48px));
padding: 16px 19px 13px;
border: 1px solid rgba(49, 65, 56, 0.15);
border-radius: 19px;
background: rgba(248, 246, 240, 0.92);
box-shadow: 0 22px 65px rgba(43, 50, 43, 0.16);
backdrop-filter: blur(18px);
transform: translateX(-50%);
}
.timeline-top {
display: grid;
grid-template-columns: 140px 1fr auto;
gap: 18px;
align-items: center;
}
.play-button {
display: flex;
align-items: center;
gap: 10px;
width: 140px;
height: 42px;
padding: 0 14px;
border: 0;
border-radius: 11px;
background: var(--ink);
color: #f5f3eb;
cursor: pointer;
font-size: 10px;
font-weight: 750;
letter-spacing: 0.1em;
text-transform: uppercase;
transition: transform 160ms ease, background 160ms ease;
}
.play-button:hover {
background: #34483d;
transform: translateY(-1px);
}
.play-icon {
display: grid;
width: 21px;
height: 21px;
place-items: center;
border: 1px solid rgba(255, 255, 255, 0.28);
border-radius: 50%;
font-size: 8px;
line-height: 1;
}
.phase-block {
min-width: 0;
}
.phase-kicker {
color: var(--muted);
font-size: 8px;
font-weight: 800;
letter-spacing: 0.15em;
text-transform: uppercase;
}
.phase-title {
overflow: hidden;
margin-top: 3px;
font-family: Georgia, "Times New Roman", serif;
font-size: 18px;
letter-spacing: -0.02em;
text-overflow: ellipsis;
white-space: nowrap;
}
.time-readout {
text-align: right;
}
.time-readout strong {
display: block;
font-family: Georgia, "Times New Roman", serif;
font-size: 22px;
font-weight: 400;
letter-spacing: -0.03em;
}
.time-readout span {
color: var(--muted);
font-size: 8px;
font-weight: 750;
letter-spacing: 0.15em;
text-transform: uppercase;
}
.range-wrap {
position: relative;
margin-top: 15px;
}
#timeline {
width: 100%;
height: 18px;
margin: 0;
appearance: none;
background: transparent;
cursor: pointer;
}
#timeline::-webkit-slider-runnable-track {
height: 4px;
border-radius: 999px;
background: linear-gradient(
to right,
var(--accent) 0%,
var(--accent) var(--timeline-fill),
rgba(65, 78, 70, 0.14) var(--timeline-fill),
rgba(65, 78, 70, 0.14) 100%
);
}
#timeline::-moz-range-track {
height: 4px;
border-radius: 999px;
background: rgba(65, 78, 70, 0.14);
}
#timeline::-moz-range-progress {
height: 4px;
border-radius: 999px;
background: var(--accent);
}
#timeline::-webkit-slider-thumb {
width: 16px;
height: 16px;
margin-top: -6px;
appearance: none;
border: 3px solid #f8f6f0;
border-radius: 50%;
background: var(--accent);
box-shadow: 0 2px 8px rgba(74, 54, 40, 0.28);
}
#timeline::-moz-range-thumb {
width: 11px;
height: 11px;
border: 3px solid #f8f6f0;
border-radius: 50%;
background: var(--accent);
box-shadow: 0 2px 8px rgba(74, 54, 40, 0.28);
}
.ticks {
display: flex;
justify-content: space-between;
margin-top: 1px;
}
.tick {
position: relative;
padding: 0;
border: 0;
background: transparent;
color: var(--muted);
cursor: pointer;
font-size: 8px;
font-weight: 750;
letter-spacing: 0.08em;
}
.tick::before {
position: absolute;
top: -8px;
left: 50%;
width: 1px;
height: 4px;
background: rgba(55, 70, 61, 0.23);
content: "";
}
.timeline-note {
display: flex;
justify-content: space-between;
gap: 16px;
margin-top: 11px;
padding-top: 10px;
border-top: 1px solid var(--line);
color: var(--muted);
font-size: 9px;
line-height: 1.45;
}
.timeline-note strong {
color: var(--ink);
font-weight: 700;
}
#loading {
position: fixed;
z-index: 50;
inset: 0;
display: grid;
place-items: center;
background: var(--paper);
color: var(--muted);
font-size: 10px;
font-weight: 750;
letter-spacing: 0.18em;
text-transform: uppercase;
transition: opacity 400ms ease;
}
#loading.hidden {
opacity: 0;
pointer-events: none;
}
@media (max-width: 1050px) {
.insight {
display: none;
}
}
@media (max-width: 680px) {
.header {
top: 17px;
left: 16px;
right: 16px;
}
h1 {
font-size: 29px;
}
.subtitle,
.badge,
.hint {
display: none;
}
.control-button {
height: 33px;
padding: 0 10px;
font-size: 8px;
}
.timeline-panel {
bottom: 12px;
width: calc(100% - 24px);
padding: 13px;
border-radius: 16px;
}
.timeline-top {
grid-template-columns: 42px 1fr auto;
gap: 10px;
}
.play-button {
width: 42px;
padding: 0;
justify-content: center;
}
.play-button .play-text {
display: none;
}
.phase-title {
font-size: 15px;
}
.time-readout strong {
font-size: 19px;
}
.timeline-note span:last-child {
display: none;
}
.specimen-label {
min-width: 78px;
padding: 6px;
}
.specimen-label .name {
font-size: 10px;
}
}
</style>
</head>
<body>
<main id="stage" aria-label="Interactive 3D model of root gravitropism"></main>
<header class="header">
<div>
<div class="eyebrow">Botanical behavior study / 01</div>
<h1>Root gravitropism</h1>
<div class="subtitle">
Two organs, one gravity signal: roots follow the pull downward while
shoots reverse it and establish an upward direction.
</div>
</div>
<div class="header-actions">
<div class="badge">Live growth model</div>
<button class="control-button" id="resetCamera" type="button">
Reset view
</button>
</div>
</header>
<aside class="insight">
<h2 class="insight-title">Gravity writes two instructions.</h2>
<p>
The root cap senses the vertical pull and redirects each root toward the
soil. The shoot counter-curves, lifting its growing tip into the air.
</p>
<div class="legend">
<div class="legend-item">
<span class="legend-dot root"></span>
Positive gravitropism · root
</div>
<div class="legend-item">
<span class="legend-dot shoot"></span>
Negative gravitropism · shoot
</div>
<div class="legend-item">
<span class="legend-dot water"></span>
Translucent moisture zones
</div>
</div>
</aside>
<div class="hint">Drag to orbit · Scroll to zoom</div>
<section class="timeline-panel" aria-label="Growth timeline">
<div class="timeline-top">
<button class="play-button" id="playButton" type="button" aria-label="Play timeline">
<span class="play-icon" id="playIcon">▶</span>
<span class="play-text" id="playText">Play</span>
</button>
<div class="phase-block">
<div class="phase-kicker">Current developmental phase</div>
<div class="phase-title" id="phaseTitle">Shoot ascent</div>
</div>
<div class="time-readout">
<strong id="timeValue">34.6 h</strong>
<span>elapsed time</span>
</div>
</div>
<div class="range-wrap">
<input
id="timeline"
type="range"
min="0"
max="1000"
value="720"
aria-label="Plant growth timeline"
/>
<div class="ticks">
<button class="tick" type="button" data-time="0">0 H</button>
<button class="tick" type="button" data-time="6">6 H</button>
<button class="tick" type="button" data-time="12">12 H</button>
<button class="tick" type="button" data-time="24">24 H</button>
<button class="tick" type="button" data-time="48">48 H</button>
</div>
</div>
<div class="timeline-note">
<span id="phaseDetail">
Root tips continue descending while shoots bend against gravity.
</span>
<span><strong>Tip growth</strong> determines the visible direction.</span>
</div>
</section>
<div id="loading">Preparing the growth chamber…</div>
<script type="module">
import * as THREE from
"https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
const stage = document.getElementById("stage");
const timeline = document.getElementById("timeline");
const playButton = document.getElementById("playButton");
const playIcon = document.getElementById("playIcon");
const playText = document.getElementById("playText");
const phaseTitle = document.getElementById("phaseTitle");
const phaseDetail = document.getElementById("phaseDetail");
const timeValue = document.getElementById("timeValue");
const renderer = new THREE.WebGLRenderer({
antialias: true,
powerPreference: "high-performance"
});
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1.05;
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
stage.appendChild(renderer.domElement);
const scene = new THREE.Scene();
scene.background = new THREE.Color(0xe9e6dd);
scene.fog = new THREE.Fog(0xe9e6dd, 22, 43);
const camera = new THREE.PerspectiveCamera(
40,
window.innerWidth / window.innerHeight,
0.1,
100
);
const world = new THREE.Group();
world.position.y = 0.12;
scene.add(world);
const hemi = new THREE.HemisphereLight(0xfffbef, 0x8c7968, 2.15);
scene.add(hemi);
const key = new THREE.DirectionalLight(0xfff4dc, 3.25);
key.position.set(-5, 11, 8);
key.castShadow = true;
key.shadow.mapSize.set(1024, 1024);
key.shadow.camera.left = -12;
key.shadow.camera.right = 12;
key.shadow.camera.top = 10;
key.shadow.camera.bottom = -8;
key.shadow.camera.near = 1;
key.shadow.camera.far = 30;
key.shadow.bias = -0.0008;
scene.add(key);
const rim = new THREE.DirectionalLight(0xb8d9dc, 1.25);
rim.position.set(9, 4, -8);
scene.add(rim);
const floor = new THREE.Mesh(
new THREE.PlaneGeometry(60, 60),
new THREE.MeshStandardMaterial({
color: 0xe2ded3,
roughness: 0.96,
metalness: 0
})
);
floor.rotation.x = -Math.PI / 2;
floor.position.y = -3.48;
floor.receiveShadow = true;
scene.add(floor);
const floorRing = new THREE.Mesh(
new THREE.RingGeometry(10.8, 10.84, 96),
new THREE.MeshBasicMaterial({
color: 0xb8b3a8,
transparent: true,
opacity: 0.32,
side: THREE.DoubleSide
})
);
floorRing.rotation.x = -Math.PI / 2;
floorRing.position.y = -3.465;
scene.add(floorRing);
const specimens = [
{
name: "Plumb",
x: -4.85,
root: [
[0, -0.12, 0],
[0.03, -0.48, 0.01],
[0.06, -1.05, 0],
[0.02, -1.62, -0.02],
[0.08, -2.25, 0],
[0.04, -2.92, 0]
],
shoot: [
[0, 0.01, 0],
[0.01, 0.54, 0],
[-0.02, 1.12, 0.01],
[0.02, 1.72, 0],
[0, 2.31, 0],
[0.04, 2.92, 0]
],
branches: [
{
delay: 0.33,
points: [
[0.04, -0.91, 0],
[-0.3, -1.18, 0.03],
[-0.55, -1.47, 0.02],
[-0.72, -1.91, -0.02]
]
},
{
delay: 0.56,
points: [
[0.03, -1.62, -0.02],
[0.34, -1.92, 0.02],
[0.56, -2.25, 0],
[0.68, -2.67, 0.01]
]
},
{
delay: 0.72,
points: [
[0.07, -2.19, 0],
[-0.22, -2.48, -0.03],
[-0.39, -2.82, 0]
]
}
],
moisture: [
[-0.48, -1.4, 0.03, 0.62, 0.44, 0.38],
[0.46, -2.42, -0.04, 0.56, 0.4, 0.36]
]
},
{
name: "East bow",
x: -1.62,
root: [
[0, -0.12, 0],
[0.04, -0.43, 0.01],
[0.25, -0.82, 0.04],
[0.58, -1.25, 0.02],
[0.78, -1.77, -0.01],
[0.76, -2.37, 0],
[0.58, -2.95, 0.02]
],
shoot: [
[0, 0.01, 0],
[0.01, 0.48, 0.01],
[0.13, 0.98, 0.02],
[0.37, 1.48, 0],
[0.58, 2.06, -0.02],
[0.69, 2.58, 0],
[0.67, 2.96, 0]
],
branches: [
{
delay: 0.36,
points: [
[0.28, -0.86, 0.03],
[0.1, -1.17, 0.05],
[-0.15, -1.46, 0.02],
[-0.28, -1.91, 0]
]
},
{
delay: 0.57,
points: [
[0.59, -1.27, 0.02],
[0.9, -1.62, -0.03],
[1.03, -2.02, 0],
[1.0, -2.43, 0.01]
]
},
{
delay: 0.73,
points: [
[0.75, -1.85, 0],
[0.44, -2.14, -0.03],
[0.35, -2.55, 0]
]
}
],
moisture: [
[0.5, -1.46, 0.02, 0.65, 0.46, 0.4],
[-0.38, -2.45, -0.03, 0.53, 0.4, 0.35]
]
},
{
name: "West bow",
x: 1.62,
root: [
[0, -0.12, 0],
[-0.05, -0.45, 0.01],
[-0.24, -0.87, 0.03],
[-0.53, -1.29, 0.02],
[-0.72, -1.78, -0.01],
[-0.7, -2.36, 0],
[-0.91, -2.92, 0.01]
],
shoot: [
[0, 0.01, 0],
[-0.02, 0.49, 0.01],
[-0.19, 0.98, 0.02],
[-0.4, 1.48, 0],
[-0.59, 2.03, -0.02],
[-0.64, 2.55, 0],
[-0.61, 2.96, 0]
],
branches: [
{
delay: 0.34,
points: [
[-0.27, -0.91, 0.03],
[-0.02, -1.22, 0.05],
[0.24, -1.54, 0.01],
[0.4, -1.95, 0]
]
},
{
delay: 0.56,
points: [
[-0.55, -1.31, 0.02],
[-0.88, -1.67, -0.03],
[-1.0, -2.08, 0],
[-0.96, -2.46, 0.01]
]
},
{
delay: 0.72,
points: [
[-0.71, -1.85, 0],
[-0.42, -2.18, -0.03],
[-0.3, -2.58, 0]
]
}
],
moisture: [
[-0.52, -1.43, 0.02, 0.62, 0.44, 0.39],
[0.43, -2.4, -0.03, 0.55, 0.4, 0.36]
]
},
{
name: "S profile",
x: 4.85,
root: [
[0, -0.12, 0],
[0.05, -0.43, 0.03],
[0.3, -0.79, 0.05],
[0.51, -1.15, 0.02],
[0.47, -1.52, 0],
[0.22, -1.83, 0.02],
[0.28, -2.3, 0],
[0.58, -2.67, 0.01],
[0.72, -2.98, 0]
],
shoot: [
[0, 0.01, 0],
[0.13, 0.46, 0.02],
[-0.11, 0.91, 0.03],
[0.18, 1.38, 0.01],
[0.13, 1.83, -0.01],
[0.3, 2.35, 0],
[0.24, 2.95, 0]
],
branches: [
{
delay: 0.33,
points: [
[0.32, -0.82, 0.05],
[0.03, -1.1, 0.03],
[-0.24, -1.34, 0],
[-0.42, -1.76, 0.01]
]
},
{
delay: 0.55,
points: [
[0.5, -1.19, 0.02],
[0.8, -1.51, 0],
[0.92, -1.92, -0.02],
[0.85, -2.28, 0]
]
},
{
delay: 0.71,
points: [
[0.23, -1.86, 0.02],
[-0.05, -2.17, 0],
[-0.18, -2.59, 0.01]
]
}
],
moisture: [
[0.53, -1.35, 0.03, 0.62, 0.45, 0.4],
[-0.45, -2.45, -0.02, 0.56, 0.4, 0.36]
]
}
];
const rootMaterial = new THREE.MeshStandardMaterial({
color: 0xd8a65b,
roughness: 0.64,
metalness: 0.02
});
const rootBranchMaterial = new THREE.MeshStandardMaterial({
color: 0xe0b878,
roughness: 0.7
});
const shootMaterial = new THREE.MeshStandardMaterial({
color: 0x3f9560,
roughness: 0.5
});
const leafMaterial = new THREE.MeshStandardMaterial({
color: 0x5b9f63,
roughness: 0.62
});
const seedMaterial = new THREE.MeshStandardMaterial({
color: 0x8d603a,
roughness: 0.76
});
const seedHighlightMaterial = new THREE.MeshStandardMaterial({
color: 0xd7bc83,
roughness: 0.7
});
const rootTipMaterial = new THREE.MeshStandardMaterial({
color: 0xf0ce91,
roughness: 0.52
});
const shootTipMaterial = new THREE.MeshStandardMaterial({
color: 0x8fbd6e,
roughness: 0.55
});
function makePoints(array) {
return array.map((point) => new THREE.Vector3(...point));
}
function createTube(points, radius, material, segments = 72) {
const curve = new THREE.CatmullRomCurve3(
makePoints(points),
false,
"centripetal"
);
const geometry = new THREE.TubeGeometry(
curve,
segments,
radius,
8,
false
);
const mesh = new THREE.Mesh(geometry, material);
mesh.castShadow = true;
mesh.receiveShadow = true;
return { mesh, curve, geometry };
}
function setReveal(mesh, amount) {
const total = mesh.geometry.index.count;
const radial = 8;
const visible = Math.max(0, Math.floor(total * amount / (radial * 6))) * radial * 6;
mesh.geometry.setDrawRange(0, visible);
}
function createCell(spec, index) {
const group = new THREE.Group();
group.position.x = spec.x;
world.add(group);
const shellGeometry = new THREE.BoxGeometry(2.62, 6.55, 1.76);
const shell = new THREE.Mesh(
shellGeometry,
new THREE.MeshPhysicalMaterial({
color: 0x9eb5b5,
transparent: true,
opacity: 0.065,
roughness: 0.22,
metalness: 0,
side: THREE.DoubleSide,
depthWrite: false
})
);
shell.position.y = -0.12;
shell.renderOrder = 5;
group.add(shell);
const edges = new THREE.LineSegments(
new THREE.EdgesGeometry(shellGeometry),
new THREE.LineBasicMaterial({
color: 0x6c827e,
transparent: true,
opacity: 0.32
})
);
edges.position.copy(shell.position);
group.add(edges);
const soil = new THREE.Mesh(
new THREE.BoxGeometry(2.55, 3.32, 1.69),
new THREE.MeshStandardMaterial({
color: 0x896447,
transparent: true,
opacity: 0.115,
roughness: 0.95,
depthWrite: false
})
);
soil.position.y = -1.7;
soil.renderOrder = 2;
group.add(soil);
const surface = new THREE.Mesh(
new THREE.BoxGeometry(2.56, 0.085, 1.69),
new THREE.MeshStandardMaterial({
color: 0x72553d,
transparent: true,
opacity: 0.4,
roughness: 1
})
);
surface.position.y = -0.025;
surface.receiveShadow = true;
group.add(surface);
const base = new THREE.Mesh(
new THREE.BoxGeometry(2.7, 0.11, 1.83),
new THREE.MeshStandardMaterial({
color: 0xb9b6aa,
transparent: true,
opacity: 0.58,
roughness: 0.7
})
);
base.position.y = -3.38;
base.receiveShadow = true;
group.add(base);
const granuleGeometry = new THREE.IcosahedronGeometry(0.035, 0);
const granuleMaterial = new THREE.MeshStandardMaterial({
color: 0x6f513c,
transparent: true,
opacity: 0.38,
roughness: 1,
depthWrite: false
});
const granules = new THREE.InstancedMesh(
granuleGeometry,
granuleMaterial,
58
);
const matrix = new THREE.Matrix4();
let randomSeed = 1921 + index * 97;
const random = () => {
randomSeed = (randomSeed * 16807) % 2147483647;
return (randomSeed - 1) / 2147483646;
};
for (let i = 0; i < 58; i++) {
const x = (random() - 0.5) * 2.38;
const y = -0.16 - random() * 3.08;
const z = (random() - 0.5) * 1.48;
const s = 0.55 + random() * 1.25;
matrix.compose(
new THREE.Vector3(x, y, z),
new THREE.Quaternion().setFromEuler(
new THREE.Euler(random() * Math.PI, random() * Math.PI, random() * Math.PI)
),
new THREE.Vector3(s, s * 0.72, s)
);
granules.setMatrixAt(i, matrix);
}
granules.instanceMatrix.needsUpdate = true;
granules.renderOrder = 3;
group.add(granules);
const moistureMeshes = [];
spec.moisture.forEach((zone, zoneIndex) => {
const [x, y, z, sx, sy, sz] = zone;
const moisture = new THREE.Mesh(
new THREE.SphereGeometry(1, 20, 14),
new THREE.MeshPhysicalMaterial({
color: zoneIndex === 0 ? 0x70afbf : 0x8abdc4,
transparent: true,
opacity: 0.16,
roughness: 0.18,
metalness: 0,
depthWrite: false,
side: THREE.DoubleSide
})
);
moisture.position.set(x, y, z);
moisture.scale.set(sx, sy, sz);
moisture.renderOrder = 4;
moisture.userData.baseScale = new THREE.Vector3(sx, sy, sz);
group.add(moisture);
moistureMeshes.push(moisture);
const dropMaterial = new THREE.MeshStandardMaterial({
color: 0x6faabd,
transparent: true,
opacity: 0.42,
roughness: 0.38,
depthWrite: false
});
for (let d = 0; d < 4; d++) {
const drop = new THREE.Mesh(
new THREE.SphereGeometry(0.045, 10, 8),
dropMaterial
);
drop.position.set(
x + (d - 1.5) * 0.15,
y + (d % 2 === 0 ? -0.18 : 0.16),
z + (d % 2 === 0 ? 0.18 : -0.15)
);
drop.scale.set(0.8, 1.35, 0.8);
group.add(drop);
}
});
const plant = new THREE.Group();
group.add(plant);
const seed = new THREE.Mesh(
new THREE.SphereGeometry(0.16, 18, 12),
seedMaterial
);
seed.scale.set(1.18, 0.76, 0.88);
seed.position.set(0, -0.08, 0);
seed.castShadow = true;
plant.add(seed);
const hilum = new THREE.Mesh(
new THREE.SphereGeometry(0.075, 12, 8),
seedHighlightMaterial
);
hilum.scale.set(0.75, 0.35, 0.7);
hilum.position.set(0.02, -0.085, 0.135);
plant.add(hilum);
const root = createTube(spec.root, 0.053, rootMaterial, 88);
plant.add(root.mesh);
const rootTip = new THREE.Mesh(
new THREE.SphereGeometry(0.076, 12, 10),
rootTipMaterial
);
rootTip.castShadow = true;
plant.add(rootTip);
const branches = spec.branches.map((branch) => {
const tube = createTube(branch.points, 0.029, rootBranchMaterial, 44);
plant.add(tube.mesh);
return {
...tube,
delay: branch.delay
};
});
const shootPivot = new THREE.Group();
plant.add(shootPivot);
const shoot = createTube(spec.shoot, 0.061, shootMaterial, 78);
shootPivot.add(shoot.mesh);
const shootTip = new THREE.Mesh(
new THREE.SphereGeometry(0.078, 12, 10),
shootTipMaterial
);
shootTip.castShadow = true;
shootPivot.add(shootTip);
const leaves = [];
const leafPositions = [0.39, 0.57, 0.75, 0.91];
leafPositions.forEach((t, leafIndex) => {
const point = shoot.curve.getPointAt(t);
const tangent = shoot.curve.getTangentAt(t);
const side = leafIndex % 2 === 0 ? 1 : -1;
const leaf = new THREE.Mesh(
new THREE.SphereGeometry(1, 16, 10),
leafMaterial
);
const length = 0.28 + (1 - Math.abs(t - 0.65)) * 0.13;
const width = 0.105 + (1 - Math.abs(t - 0.65)) * 0.035;
leaf.userData.baseScale = new THREE.Vector3(length, 0.052, width);
leaf.userData.threshold = 0.18 + leafIndex * 0.18;
leaf.userData.phase = index * 0.8 + leafIndex;
leaf.userData.baseRotation = side * (0.45 + leafIndex * 0.08);
leaf.userData.basePosition = point.clone();
leaf.position.copy(point);
leaf.rotation.z = leaf.userData.baseRotation;
leaf.rotation.y = tangent.x * 0.4;
leaf.castShadow = true;
shootPivot.add(leaf);
leaves.push(leaf);
});
return {
group,
plant,
seed,
hilum,
root,
rootTip,
branches,
shoot,
shootTip,
shootPivot,
leaves,
moistureMeshes,
index
};
}
const plants = specimens.map(createCell);
const labelElements = specimens.map((spec, index) => {
const label = document.createElement("div");
label.className = "specimen-label";
label.innerHTML = `
<span class="number">Specimen 0${index + 1}</span>
<span class="name">${spec.name}</span>
`;
document.body.appendChild(label);
return label;
});
const gravityArrow = new THREE.Group();
gravityArrow.position.set(7.15, 0, 0);
world.add(gravityArrow);
const gravityMaterial = new THREE.MeshStandardMaterial({
color: 0xa96444,
roughness: 0.55
});
const gravityShaft = new THREE.Mesh(
new THREE.CylinderGeometry(0.025, 0.025, 1.85, 12),
gravityMaterial
);
gravityShaft.position.y = 1.62;
gravityArrow.add(gravityShaft);
const gravityHead = new THREE.Mesh(
new THREE.ConeGeometry(0.13, 0.34, 16),
gravityMaterial
);
gravityHead.rotation.z = Math.PI;
gravityHead.position.y = 0.53;
gravityArrow.add(gravityHead);
const gravityPulse = new THREE.Mesh(
new THREE.SphereGeometry(0.052, 12, 8),
new THREE.MeshBasicMaterial({ color: 0xd89060 })
);
gravityArrow.add(gravityPulse);
const gravityLabel = document.createElement("div");
gravityLabel.className = "gravity-label";
gravityLabel.textContent = "g";
document.body.appendChild(gravityLabel);
const cameraState = {
theta: 0.17,
phi: 1.28,
userZoom: 0,
baseRadius: 16.5,
radius: 16.5,
target: new THREE.Vector3(0.2, -0.05, 0)
};
function updateCamera() {
const sinPhi = Math.sin(cameraState.phi);
cameraState.radius = THREE.MathUtils.clamp(
cameraState.baseRadius + cameraState.userZoom,
9,
42
);
camera.position.set(
cameraState.target.x +
cameraState.radius * sinPhi * Math.sin(cameraState.theta),
cameraState.target.y + cameraState.radius * Math.cos(cameraState.phi),
cameraState.target.z +
cameraState.radius * sinPhi * Math.cos(cameraState.theta)
);
camera.lookAt(cameraState.target);
}
function resetCamera() {
cameraState.theta = 0.17;
cameraState.phi = 1.28;
cameraState.userZoom = 0;
updateCamera();
}
let dragging = false;
let pointerX = 0;
let pointerY = 0;
renderer.domElement.addEventListener("pointerdown", (event) => {
if (event.button !== 0) return;
dragging = true;
pointerX = event.clientX;
pointerY = event.clientY;
renderer.domElement.classList.add("dragging");
renderer.domElement.setPointerCapture(event.pointerId);
});
renderer.domElement.addEventListener("pointermove", (event) => {
if (!dragging) return;
const dx = event.clientX - pointerX;
const dy = event.clientY - pointerY;
cameraState.theta -= dx * 0.006;
cameraState.phi = THREE.MathUtils.clamp(
cameraState.phi - dy * 0.005,
0.58,
1.52
);
pointerX = event.clientX;
pointerY = event.clientY;
updateCamera();
});
function endDrag(event) {
dragging = false;
renderer.domElement.classList.remove("dragging");
if (event.pointerId !== undefined) {
try {
renderer.domElement.releasePointerCapture(event.pointerId);
} catch (_) {}
}
}
renderer.domElement.addEventListener("pointerup", endDrag);
renderer.domElement.addEventListener("pointercancel", endDrag);
renderer.domElement.addEventListener(
"wheel",
(event) => {
event.preventDefault();
cameraState.userZoom += event.deltaY * 0.012;
updateCamera();
},
{ passive: false }
);
renderer.domElement.addEventListener("dblclick", resetCamera);
document.getElementById("resetCamera").addEventListener("click", resetCamera);
let progress = Number(timeline.value) / 1000;
let playing = false;
const playbackDuration = 18;
function setProgress(value) {
progress = THREE.MathUtils.clamp(value, 0, 1);
timeline.value = Math.round(progress * 1000);
document.documentElement.style.setProperty(
"--timeline-fill",
`${progress * 100}%`
);
}
function setPlaying(value) {
playing = value;
playIcon.textContent = playing ? "Ⅱ" : "▶";
playText.textContent = playing ? "Pause" : "Play";
playButton.setAttribute(
"aria-label",
playing ? "Pause timeline" : "Play timeline"
);
}
timeline.addEventListener("input", () => {
setPlaying(false);
setProgress(Number(timeline.value) / 1000);
});
playButton.addEventListener("click", () => {
if (!playing && progress >= 0.999) setProgress(0);
setPlaying(!playing);
});
document.querySelectorAll(".tick").forEach((tick) => {
tick.addEventListener("click", () => {
setPlaying(false);
setProgress(Number(tick.dataset.time) / 48);
});
});
window.addEventListener("keydown", (event) => {
if (event.code === "Space" && event.target !== timeline) {
event.preventDefault();
if (!playing && progress >= 0.999) setProgress(0);
setPlaying(!playing);
}
});
function clamp01(value) {
return Math.max(0, Math.min(1, value));
}
function smoothstep(min, max, value) {
const x = clamp01((value - min) / (max - min));
return x * x * (3 - 2 * x);
}
function updatePhase() {
const hours = progress * 48;
if (progress < 0.1) {
phaseTitle.textContent = "Imbibition";
phaseDetail.textContent =
"Water uptake swells the dormant seed while the embryo prepares to emerge.";
} else if (progress < 0.27) {
phaseTitle.textContent = "Radicle emergence";
phaseDetail.textContent =
"The embryonic root breaks through the seed and turns toward the downward pull.";
} else if (progress < 0.49) {
phaseTitle.textContent = "Root anchoring";
phaseDetail.textContent =
"Root caps sense gravity. Each root tip descends while the first rootlets branch outward.";
} else if (progress < 0.69) {
phaseTitle.textContent = "Shoot emergence";
phaseDetail.textContent =
"The shoot rises from the seed, initially following its own curvature before correcting upward.";
} else if (progress < 0.88) {
phaseTitle.textContent = "Shoot ascent";
phaseDetail.textContent =
"Root tips continue descending while shoots bend against gravity and establish vertical growth.";
} else {
phaseTitle.textContent = "Bilateral tropism";
phaseDetail.textContent =
"Roots remain positively gravitropic; shoots maintain negative gravitropism despite different profiles.";
}
timeValue.textContent = `${hours.toFixed(1)} h`;
}
function updatePlants(elapsed) {
plants.forEach((plant) => {
const rootProgress = clamp01(
(progress - 0.025 - plant.index * 0.018) / 0.71
);
const shootProgress = clamp01(
(progress - 0.255 - plant.index * 0.012) / 0.59
);
setReveal(plant.root.mesh, rootProgress);
setReveal(plant.shoot.mesh, shootProgress);
plant.branches.forEach((branch) => {
const branchProgress = clamp01(
(rootProgress - branch.delay) / (1 - branch.delay)
);
setReveal(branch.mesh, branchProgress);
});
const rootPoint = plant.root.curve.getPointAt(
Math.max(0.001, rootProgress)
);
plant.rootTip.position.copy(rootPoint);
plant.rootTip.visible = rootProgress > 0.008;
plant.rootTip.scale.setScalar(0.65 + rootProgress * 0.35);
const shootPoint = plant.shoot.curve.getPointAt(
Math.max(0.001, shootProgress)
);
plant.shootTip.position.copy(shootPoint);
plant.shootTip.visible = shootProgress > 0.008;
plant.shootTip.scale.setScalar(0.6 + shootProgress * 0.4);
plant.shootPivot.rotation.z =
Math.sin(elapsed * 0.72 + plant.index * 0.8) * 0.008;
plant.leaves.forEach((leaf) => {
const appear = smoothstep(
leaf.userData.threshold,
leaf.userData.threshold + 0.09,
shootProgress
);
const base = leaf.userData.baseScale;
leaf.scale.set(
base.x * appear,
base.y * appear,
base.z * appear
);
leaf.rotation.z =
leaf.userData.baseRotation +
Math.sin(elapsed * 0.85 + leaf.userData.phase) * 0.025;
leaf.visible = appear > 0.001;
});
const seedScale = 0.85 + smoothstep(0, 0.16, progress) * 0.15;
plant.seed.scale.set(1.18 * seedScale, 0.76 * seedScale, 0.88 * seedScale);
plant.moistureMeshes.forEach((mesh, moistureIndex) => {
const base = mesh.userData.baseScale;
const pulse =
1 + Math.sin(elapsed * 0.7 + plant.index + moistureIndex) * 0.025;
mesh.scale.set(base.x * pulse, base.y * pulse, base.z * pulse);
mesh.rotation.y = elapsed * 0.025 + moistureIndex;
});
});
}
function projectLabel(element, position) {
const projected = position.clone().project(camera);
const x = (projected.x * 0.5 + 0.5) * window.innerWidth;
const y = (-projected.y * 0.5 + 0.5) * window.innerHeight;
element.style.left = `${x}px`;
element.style.top = `${y}px`;
element.style.opacity = projected.z > 1 ? "0" : "1";
}
function updateLabels() {
plants.forEach((plant, index) => {
projectLabel(
labelElements[index],
new THREE.Vector3(plant.group.position.x, 3.53, 0)
);
});
projectLabel(
gravityLabel,
new THREE.Vector3(7.15, 2.95, 0)
);
}
function resize() {
const width = window.innerWidth;
const height = window.innerHeight;
const aspect = width / height;
camera.aspect = aspect;
camera.updateProjectionMatrix();
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.setSize(width, height);
cameraState.baseRadius = aspect < 0.8 ? 29 : aspect < 1.1 ? 20 : 16.5;
updateCamera();
}
window.addEventListener("resize", resize);
resize();
setProgress(progress);
updatePhase();
const clock = new THREE.Clock();
let firstFrame = true;
function animate() {
requestAnimationFrame(animate);
const delta = Math.min(clock.getDelta(), 0.05);
const elapsed = clock.elapsedTime;
if (playing) {
setProgress(progress + delta / playbackDuration);
if (progress >= 1) setPlaying(false);
}
updatePlants(elapsed);
updatePhase();
updateLabels();
gravityPulse.position.y = 2.48 - ((elapsed * 0.32) % 1) * 1.7;
gravityPulse.scale.setScalar(0.9 + Math.sin(elapsed * 4) * 0.1);
renderer.render(scene, camera);
if (firstFrame) {
firstFrame = false;
document.getElementById("loading").classList.add("hidden");
}
}
animate();
</script>
</body>
</html>
```