Prompt specification
Build or customize the Three.js 3D scene "Evolution evidence timeline gallery" 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: Evolution evidence timeline gallery
Category: Voxel Worlds · Style: Voxel 3D
License: MIT · Reference: https://three3d.app/scene/evolution-evidence-timeline-gallery-x0899
Scene Description Prompt:
Create a single self-contained HTML file using Three.js from cdnjs that shows evolutionary timescales. Compose fictional fossil samples, living populations, and branching ancestry panels with intentional gaps; show that surviving evidence is incomplete and that branches can end. Voxel style.
Working Three.js Starter (evolution-evidence-timeline-gallery-x0899):
```html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Archive of Missing Time — Voxel Evolution</title>
<style>
:root {
color-scheme: dark;
--ink: #eaf4ff;
--muted: #8ca0b7;
--panel: rgba(7, 14, 25, 0.82);
--line: rgba(151, 184, 218, 0.22);
--cyan: #79d9e8;
--green: #a7d66d;
--amber: #f2b45d;
--red: #e77968;
}
* { box-sizing: border-box; }
html, body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: #07101b;
font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
"Segoe UI", sans-serif;
color: var(--ink);
}
#viewport {
position: fixed;
inset: 0;
}
canvas {
display: block;
width: 100%;
height: 100%;
touch-action: none;
cursor: grab;
}
canvas:active { cursor: grabbing; }
.vignette {
position: fixed;
inset: 0;
pointer-events: none;
background:
radial-gradient(circle at 50% 44%, transparent 38%, rgba(1, 5, 12, 0.52) 100%),
linear-gradient(180deg, rgba(2, 7, 14, 0.18), transparent 35%, rgba(2, 6, 13, 0.3));
z-index: 2;
}
.grain {
position: fixed;
inset: 0;
pointer-events: none;
z-index: 3;
opacity: 0.16;
background-image:
repeating-linear-gradient(
0deg,
rgba(255,255,255,0.025) 0,
rgba(255,255,255,0.025) 1px,
transparent 1px,
transparent 3px
);
mix-blend-mode: overlay;
}
.hero {
position: fixed;
z-index: 5;
top: 28px;
left: 30px;
width: min(500px, calc(100vw - 60px));
pointer-events: none;
}
.eyebrow {
display: flex;
align-items: center;
gap: 10px;
color: var(--cyan);
font: 700 11px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
letter-spacing: 0.22em;
text-transform: uppercase;
}
.eyebrow::before {
content: "";
width: 26px;
height: 2px;
background: var(--cyan);
box-shadow: 8px 0 0 rgba(121, 217, 232, 0.32);
}
h1 {
margin: 12px 0 10px;
max-width: 460px;
font-size: clamp(31px, 4.2vw, 62px);
line-height: 0.96;
letter-spacing: -0.055em;
text-transform: uppercase;
text-shadow: 0 4px 30px rgba(0,0,0,0.35);
}
.hero p {
width: min(440px, 90vw);
margin: 0;
color: #a8b8ca;
font-size: 14px;
line-height: 1.55;
}
.readout {
position: fixed;
z-index: 5;
top: 28px;
right: 28px;
width: 258px;
padding: 16px;
border: 1px solid var(--line);
border-radius: 4px;
background: var(--panel);
backdrop-filter: blur(14px);
box-shadow: 0 18px 60px rgba(0,0,0,0.22);
pointer-events: none;
}
.readout-title {
display: flex;
justify-content: space-between;
padding-bottom: 11px;
border-bottom: 1px solid var(--line);
color: var(--muted);
font: 700 10px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
letter-spacing: 0.18em;
text-transform: uppercase;
}
.readout-title b {
color: var(--cyan);
font-weight: 700;
}
.horizon {
display: flex;
align-items: baseline;
gap: 8px;
padding: 15px 0 13px;
}
#horizon-value {
font: 700 34px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
letter-spacing: -0.06em;
}
.horizon span {
color: var(--muted);
font: 600 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
letter-spacing: 0.08em;
}
.metrics {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 8px;
}
.metric {
min-height: 54px;
padding: 9px;
border: 1px solid rgba(143, 172, 203, 0.13);
background: rgba(255,255,255,0.025);
}
.metric span {
display: block;
margin-bottom: 6px;
color: var(--muted);
font: 600 9px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
letter-spacing: 0.1em;
text-transform: uppercase;
}
.metric b {
font: 700 16px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
}
.legend {
display: grid;
gap: 8px;
margin-top: 13px;
padding-top: 13px;
border-top: 1px solid var(--line);
color: #a8b8ca;
font: 600 10px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
}
.legend div {
display: flex;
align-items: center;
gap: 8px;
}
.swatch {
width: 11px;
height: 11px;
border: 1px solid rgba(255,255,255,0.24);
box-shadow: inset 0 0 0 2px rgba(0,0,0,0.18);
}
.swatch.known { background: #d4b483; }
.swatch.inferred { background: transparent; border-color: var(--amber); }
.swatch.extinct { background: var(--red); }
.swatch.living { background: var(--green); }
.controls {
position: fixed;
z-index: 6;
left: 50%;
bottom: 24px;
transform: translateX(-50%);
width: min(880px, calc(100vw - 34px));
padding: 12px 14px;
display: grid;
grid-template-columns: auto 1fr auto;
align-items: center;
gap: 14px;
border: 1px solid var(--line);
border-radius: 5px;
background: rgba(6, 13, 23, 0.9);
backdrop-filter: blur(18px);
box-shadow: 0 20px 70px rgba(0,0,0,0.42);
}
button {
border: 1px solid rgba(128, 167, 204, 0.3);
border-radius: 3px;
background: rgba(121, 217, 232, 0.08);
color: var(--ink);
padding: 10px 12px;
font: 700 10px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
letter-spacing: 0.09em;
text-transform: uppercase;
cursor: pointer;
transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}
button:hover {
background: rgba(121, 217, 232, 0.16);
border-color: rgba(121, 217, 232, 0.62);
}
button:active { transform: translateY(1px); }
#play {
min-width: 94px;
color: #06101a;
border-color: var(--cyan);
background: var(--cyan);
}
#play:hover { background: #a3e7f1; }
.timeline-wrap {
position: relative;
min-width: 0;
}
.timeline-labels {
display: flex;
justify-content: space-between;
margin-bottom: 7px;
color: #70859b;
font: 600 9px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
letter-spacing: 0.08em;
}
input[type="range"] {
width: 100%;
height: 5px;
margin: 0;
appearance: none;
border-radius: 0;
background:
linear-gradient(90deg, rgba(121,217,232,0.22), rgba(121,217,232,0.22)) 0/100% 2px no-repeat,
rgba(255,255,255,0.12);
cursor: ew-resize;
}
input[type="range"]::-webkit-slider-thumb {
appearance: none;
width: 13px;
height: 18px;
border: 2px solid #07101b;
border-radius: 1px;
background: var(--cyan);
box-shadow: 0 0 0 1px var(--cyan), 0 0 18px rgba(121,217,232,0.5);
}
input[type="range"]::-moz-range-thumb {
width: 11px;
height: 16px;
border: 2px solid #07101b;
border-radius: 1px;
background: var(--cyan);
box-shadow: 0 0 0 1px var(--cyan);
}
.time-readout {
min-width: 75px;
text-align: right;
font: 700 15px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
color: var(--cyan);
}
.time-readout small {
display: block;
margin-top: 5px;
color: var(--muted);
font-size: 8px;
letter-spacing: 0.14em;
}
.hint {
position: fixed;
z-index: 5;
left: 28px;
bottom: 30px;
color: #667c92;
font: 600 9px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
letter-spacing: 0.08em;
text-transform: uppercase;
pointer-events: none;
}
@media (max-width: 820px) {
.hero { top: 20px; left: 20px; }
.hero p { display: none; }
.readout { top: auto; right: 16px; bottom: 102px; width: 214px; }
.legend { display: none; }
.metrics { grid-template-columns: repeat(4, 1fr); }
.metric { min-height: 48px; padding: 7px; }
.metric b { font-size: 13px; }
.hint { display: none; }
.controls { bottom: 14px; grid-template-columns: auto 1fr; }
.time-readout { display: none; }
}
@media (max-width: 520px) {
h1 { font-size: 32px; }
.readout { width: 190px; }
.metrics { grid-template-columns: 1fr 1fr; }
#play { min-width: 78px; }
}
</style>
</head>
<body>
<div id="viewport" aria-label="Interactive voxel evolution archive"></div>
<div class="vignette"></div>
<div class="grain"></div>
<header class="hero">
<div class="eyebrow">Fictional archive / sample 07</div>
<h1>The gaps remember</h1>
<p>
Evolution is not a complete film. Fossils arrive as fragments,
relationships are inferred across missing evidence, and entire
branches can disappear without descendants.
</p>
</header>
<aside class="readout">
<div class="readout-title">
<span>Observation record</span>
<b>INCOMPLETE</b>
</div>
<div class="horizon">
<strong id="horizon-value">42.0</strong>
<span>MA REVEALED</span>
</div>
<div class="metrics">
<div class="metric">
<span>Known samples</span>
<b id="known-count">3 / 3</b>
</div>
<div class="metric">
<span>Inferred links</span>
<b id="inferred-count">02</b>
</div>
<div class="metric">
<span>Dead branches</span>
<b id="extinct-count">02</b>
</div>
<div class="metric">
<span>Living clades</span>
<b id="living-count">03</b>
</div>
</div>
<div class="legend">
<div><i class="swatch known"></i> preserved fossil evidence</div>
<div><i class="swatch inferred"></i> reconstructed / missing interval</div>
<div><i class="swatch extinct"></i> terminal branch</div>
<div><i class="swatch living"></i> surviving population</div>
</div>
</aside>
<div class="controls">
<button id="play" type="button">▶ Replay</button>
<div class="timeline-wrap">
<div class="timeline-labels">
<span>42 MA</span>
<span>35</span>
<span>28</span>
<span>21</span>
<span>14</span>
<span>7</span>
<span>PRESENT</span>
</div>
<input
id="timeline"
type="range"
min="0"
max="42"
step="0.1"
value="42"
aria-label="Reveal evolutionary history from 42 million years ago to present"
/>
</div>
<div class="time-readout">
<span id="time-readout">42.0 Ma</span>
<small>DEEPER TIME →</small>
</div>
</div>
<div class="hint">Drag to orbit · scroll to zoom · space to replay</div>
<script type="module">
import * as THREE from "https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
// ------------------------------------------------------------
// Renderer, scene, and camera
// ------------------------------------------------------------
const viewport = document.getElementById("viewport");
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.12;
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
renderer.setClearColor(0x07101b, 1);
viewport.appendChild(renderer.domElement);
const scene = new THREE.Scene();
scene.fog = new THREE.Fog(0x07101b, 28, 58);
const camera = new THREE.PerspectiveCamera(
43,
window.innerWidth / window.innerHeight,
0.1,
100
);
const cameraRig = {
theta: 0.40,
phi: 1.03,
radius: 25.5,
target: new THREE.Vector3(0.1, 1.25, -0.5)
};
function updateCamera() {
const { theta, phi, radius, target } = cameraRig;
const sinPhi = Math.sin(phi);
camera.position.set(
target.x + radius * sinPhi * Math.sin(theta),
target.y + radius * Math.cos(phi),
target.z + radius * sinPhi * Math.cos(theta)
);
camera.lookAt(target);
}
updateCamera();
const hemisphere = new THREE.HemisphereLight(0x9ec9e8, 0x17100e, 1.8);
scene.add(hemisphere);
const keyLight = new THREE.DirectionalLight(0xffefd2, 3.3);
keyLight.position.set(8, 15, 12);
keyLight.castShadow = true;
keyLight.shadow.mapSize.set(2048, 2048);
keyLight.shadow.camera.left = -18;
keyLight.shadow.camera.right = 18;
keyLight.shadow.camera.top = 14;
keyLight.shadow.camera.bottom = -12;
keyLight.shadow.camera.near = 1;
keyLight.shadow.camera.far = 45;
keyLight.shadow.bias = -0.0003;
scene.add(keyLight);
const rimLight = new THREE.DirectionalLight(0x54c9e8, 1.6);
rimLight.position.set(-13, 6, -8);
scene.add(rimLight);
const fillLight = new THREE.PointLight(0xe48b59, 1.3, 22, 2);
fillLight.position.set(4, 2, 5);
scene.add(fillLight);
// ------------------------------------------------------------
// Shared utilities
// ------------------------------------------------------------
const palette = {
ink: 0xdce8f4,
cyan: 0x79d9e8,
green: 0xa7d66d,
amber: 0xf2b45d,
red: 0xe77968,
blue: 0x75aee8,
bone: 0xd3b789,
matrix: 0x65513b
};
const unitCube = new THREE.BoxGeometry(1, 1, 1);
function standardMaterial(color, options = {}) {
return new THREE.MeshStandardMaterial({
color,
roughness: 0.78,
metalness: 0.04,
...options
});
}
const materials = {
floor: standardMaterial(0x101a28),
panel: standardMaterial(0x111e2d),
frame: standardMaterial(0x27384a),
dark: standardMaterial(0x080d14),
stone: standardMaterial(0x425064),
bone: standardMaterial(palette.bone),
boneDark: standardMaterial(0x947b58),
matrix: standardMaterial(palette.matrix),
trunk: standardMaterial(0xb9c8d8, { transparent: true, opacity: 0.92 }),
upper: standardMaterial(palette.green, { transparent: true, opacity: 0.92 }),
middle: standardMaterial(palette.amber, { transparent: true, opacity: 0.92 }),
lower: standardMaterial(palette.red, { transparent: true, opacity: 0.92 })
};
function addBox(parent, size, position, material, castShadow = true) {
const mesh = new THREE.Mesh(unitCube, material);
mesh.scale.set(size[0], size[1], size[2]);
mesh.position.set(position[0], position[1], position[2]);
mesh.castShadow = castShadow;
mesh.receiveShadow = true;
parent.add(mesh);
return mesh;
}
function makeLabel(text, color = "#dce8f4", width = 4) {
const canvas = document.createElement("canvas");
canvas.width = 1024;
canvas.height = 192;
const context = canvas.getContext("2d");
context.clearRect(0, 0, canvas.width, canvas.height);
context.fillStyle = "rgba(5, 11, 20, 0.88)";
context.fillRect(0, 0, canvas.width, canvas.height);
context.strokeStyle = color;
context.globalAlpha = 0.58;
context.lineWidth = 5;
context.strokeRect(3, 3, canvas.width - 6, canvas.height - 6);
context.globalAlpha = 1;
context.fillStyle = color;
context.font = "700 54px ui-monospace, SFMono-Regular, Menlo, monospace";
context.textAlign = "center";
context.textBaseline = "middle";
context.fillText(text, canvas.width / 2, canvas.height / 2 + 2);
const texture = new THREE.CanvasTexture(canvas);
texture.colorSpace = THREE.SRGBColorSpace;
texture.minFilter = THREE.LinearFilter;
const sprite = new THREE.Sprite(
new THREE.SpriteMaterial({
map: texture,
transparent: true,
depthTest: false,
depthWrite: false
})
);
sprite.scale.set(width, width * 0.1875, 1);
sprite.renderOrder = 20;
return sprite;
}
function addLabel(parent, text, position, color = "#dce8f4", width = 4) {
const label = makeLabel(text, color, width);
label.position.set(position[0], position[1], position[2]);
parent.add(label);
return label;
}
function ageFromX(x) {
return THREE.MathUtils.clamp(42 - ((x + 9.2) / 18) * 42, 0, 42);
}
function smoothReveal(age, horizon, softness = 1.5) {
return THREE.MathUtils.clamp((horizon - age + softness) / softness, 0, 1);
}
function ghostBox(parent, size, position, color = 0xf2b45d) {
const geometry = new THREE.EdgesGeometry(new THREE.BoxGeometry(...size));
const material = new THREE.LineBasicMaterial({
color,
transparent: true,
opacity: 0.38
});
const box = new THREE.LineSegments(geometry, material);
box.position.set(...position);
parent.add(box);
return box;
}
// ------------------------------------------------------------
// Floor and architectural frame
// ------------------------------------------------------------
const architecture = new THREE.Group();
scene.add(architecture);
addBox(architecture, [29, 0.45, 14], [0, -3.05, 0], materials.floor, false);
const grid = new THREE.GridHelper(28, 28, 0x33475c, 0x1b2a3c);
grid.position.y = -2.815;
grid.material.transparent = true;
grid.material.opacity = 0.56;
architecture.add(grid);
addBox(architecture, [25.4, 10.1, 0.28], [0, 2.15, -4.65], materials.panel, false);
addBox(architecture, [25.8, 0.18, 0.42], [0, 7.2, -4.55], materials.frame, false);
addBox(architecture, [0.18, 10.2, 0.42], [-12.75, 2.15, -4.55], materials.frame, false);
addBox(architecture, [0.18, 10.2, 0.42], [12.75, 2.15, -4.55], materials.frame, false);
addBox(architecture, [25.8, 0.18, 0.42], [0, -2.85, -4.55], materials.frame, false);
for (let x = -11.5; x <= 11.5; x += 2.3) {
addBox(architecture, [0.035, 9.7, 0.035], [x, 2.15, -4.47], materials.frame, false);
}
addLabel(
architecture,
"ANCESTRY / RELATIONSHIPS ARE INFERRED",
[0, 6.45, -4.2],
"#79d9e8",
9.6
);
addLabel(
architecture,
"KNOWN ≠ CONTINUOUS",
[8.3, 5.65, -4.18],
"#8ca0b7",
4.2
);
// ------------------------------------------------------------
// Voxel ancestry paths
// ------------------------------------------------------------
const ancestry = new THREE.Group();
ancestry.position.z = -4.27;
scene.add(ancestry);
const branchRecords = {
trunk: { material: materials.trunk, voxels: [], endAge: 42 },
upper: { material: materials.upper, voxels: [], endAge: 0 },
middle: { material: materials.middle, voxels: [], endAge: ageFromX(4.0) },
lower: { material: materials.lower, voxels: [], endAge: ageFromX(1.4) }
};
function createVoxelSegment(branchName, from, to, spacing = 0.28) {
const record = branchRecords[branchName];
const start = new THREE.Vector2(from[0], from[1]);
const end = new THREE.Vector2(to[0], to[1]);
const distance = start.distanceTo(end);
const count = Math.max(1, Math.ceil(distance / spacing));
for (let i = 0; i <= count; i++) {
const t = i / count;
const x = THREE.MathUtils.lerp(start.x, end.x, t);
const y = THREE.MathUtils.lerp(start.y, end.y, t);
const voxel = new THREE.Mesh(unitCube, record.material);
voxel.position.set(x, y, 0);
voxel.scale.setScalar(0.19);
voxel.castShadow = true;
ancestry.add(voxel);
record.voxels.push({
mesh: voxel,
age: ageFromX(x)
});
}
}
// Common trunk.
createVoxelSegment("trunk", [-9.2, -0.5], [-6.5, -0.5]);
createVoxelSegment("trunk", [-6.5, -0.5], [-5.2, -0.2]);
// Surviving branch, interrupted by one interval of missing evidence.
createVoxelSegment("upper", [-5.2, -0.2], [-3.2, 0.8]);
createVoxelSegment("upper", [-3.2, 0.8], [-1.8, 1.4]);
createVoxelSegment("upper", [-0.1, 1.4], [1.8, 2.7]);
createVoxelSegment("upper", [1.8, 2.7], [4.0, 3.4]);
createVoxelSegment("upper", [4.0, 3.4], [8.8, 3.4]);
// Extinct branch, also interrupted.
createVoxelSegment("middle", [-5.2, -0.2], [-3.5, -0.2]);
createVoxelSegment("middle", [-3.5, -0.2], [-1.8, 0.1]);
createVoxelSegment("middle", [0.0, 0.1], [2.5, 0.5]);
createVoxelSegment("middle", [2.5, 0.5], [4.0, 0.5]);
// A second terminal branch.
createVoxelSegment("lower", [-5.2, -0.2], [-4.2, -1.5]);
createVoxelSegment("lower", [-4.2, -1.5], [-2.3, -1.3]);
createVoxelSegment("lower", [-0.7, -1.3], [0.6, -0.8]);
createVoxelSegment("lower", [0.6, -0.8], [1.4, -0.8]);
function createMissingInterval(from, to, text) {
const geometry = new THREE.BufferGeometry().setFromPoints([
new THREE.Vector3(from[0], from[1], 0.015),
new THREE.Vector3(to[0], to[1], 0.015)
]);
const line = new THREE.Line(
geometry,
new THREE.LineDashedMaterial({
color: palette.amber,
dashSize: 0.20,
gapSize: 0.16,
transparent: true,
opacity: 0.56
})
);
line.computeLineDistances();
ancestry.add(line);
const count = 3;
for (let i = 1; i <= count; i++) {
const t = i / (count + 1);
const x = THREE.MathUtils.lerp(from[0], to[0], t);
const y = THREE.MathUtils.lerp(from[1], to[1], t);
ghostBox(ancestry, [0.24, 0.24, 0.24], [x, y, 0], palette.amber);
}
addLabel(
ancestry,
text,
[(from[0] + to[0]) / 2, (from[1] + to[1]) / 2 + 0.48, 0.12],
"#f2b45d",
2.15
);
}
createMissingInterval([-1.8, 1.4], [-0.1, 1.4], "NO DATA");
createMissingInterval([-1.8, 0.1], [0.0, 0.1], "UNSAMPLED");
createMissingInterval([-2.3, -1.3], [-0.7, -1.3], "MISSING");
// Small root marker.
addBox(ancestry, [0.34, 0.34, 0.34], [-9.2, -0.5, 0], materials.cyan);
// ------------------------------------------------------------
// Extinct terminal markers
// ------------------------------------------------------------
function createVoxelSkull(color = 0xb68b62) {
const group = new THREE.Group();
const skullMat = standardMaterial(color, { transparent: true, opacity: 0.88 });
const socketMat = standardMaterial(0x211b18, { transparent: true, opacity: 0.88 });
addBox(group, [0.54, 0.48, 0.45], [0, 0, 0], skullMat);
addBox(group, [0.34, 0.23, 0.39], [-0.32, -0.04, 0], skullMat);
addBox(group, [0.38, 0.11, 0.32], [-0.28, -0.29, 0], skullMat);
addBox(group, [0.11, 0.11, 0.035], [-0.07, 0.06, 0.235], socketMat);
addBox(group, [0.11, 0.11, 0.035], [0.13, 0.06, 0.235], socketMat);
addBox(group, [0.08, 0.08, 0.08], [0.26, -0.13, 0.08], socketMat, false);
group.traverse((child) => {
if (child.isMesh) {
child.castShadow = true;
}
});
return group;
}
function makeTerminal(position, color, type) {
const group = new THREE.Group();
group.position.set(...position);
if (type === "skull") {
const skull = createVoxelSkull(color);
group.add(skull);
} else {
const terminalMat = standardMaterial(color, {
transparent: true,
opacity: 0.76
});
addBox(group, [0.14, 0.72, 0.14], [0, 0, 0], terminalMat);
addBox(group, [0.14, 0.14, 0.72], [0, 0, 0], terminalMat);
}
scene.add(group);
return group;
}
const middleTerminal = makeTerminal([4.45, 0.72, -4.04], 0xc08a54, "skull");
const lowerTerminal = makeTerminal([1.9, -0.72, -4.04], 0xb95d52, "cross");
addLabel(
scene,
"ENDED / NO DESCENDANTS",
[5.0, 1.55, -4.0],
"#f2b45d",
4.7
);
addLabel(
scene,
"ENDED / LINEAGE STOPS",
[1.8, -1.75, -4.0],
"#e77968",
4.5
);
addBox(ancestry, [0.33, 0.33, 0.33], [8.8, 3.4, 0], materials.green);
addLabel(ancestry, "LIVING CLADE", [9.8, 3.4, 0.12], "#a7d66d", 2.8);
// Dashed descent from the surviving branch toward the living specimens.
const descentGeometry = new THREE.BufferGeometry().setFromPoints([
new THREE.Vector3(8.8, 3.38, -4.16),
new THREE.Vector3(8.8, -0.8, -3.7),
new THREE.Vector3(8.1, -2.15, -1.6)
]);
const descent = new THREE.Line(
descentGeometry,
new THREE.LineDashedMaterial({
color: palette.green,
dashSize: 0.22,
gapSize: 0.16,
transparent: true,
opacity: 0.5
})
);
descent.computeLineDistances();
scene.add(descent);
// ------------------------------------------------------------
// Fossil archive
// ------------------------------------------------------------
const fossilArchive = new THREE.Group();
scene.add(fossilArchive);
addLabel(
fossilArchive,
"FOSSIL SAMPLES / FRAGMENTS ONLY",
[-5.2, -0.78, 3.25],
"#d3b789",
7.2
);
const fossilRecords = [];
function makeMatrixTile(parent, position, variation = 0) {
const colors = [0x6b563f, 0x594a38, 0x796249, 0x4f4233];
const material = standardMaterial(colors[variation % colors.length]);
const size = 0.13 + (variation % 3) * 0.025;
addBox(parent, [size, 0.08, size], position, material, false);
}
function createFossilStation(x, z, age, kind, labelText) {
const station = new THREE.Group();
station.position.set(x, -2.3, z);
addBox(station, [3.2, 0.24, 2.25], [0, 0, 0], materials.stone, false);
addBox(station, [2.85, 0.08, 1.95], [0, 0.16, 0], materials.matrix, false);
for (let i = 0; i < 24; i++) {
const px = -1.3 + (i % 8) * 0.37;
const pz = -0.8 + Math.floor(i / 8) * 0.8;
makeMatrixTile(station, [px, 0.22, pz], i);
}
if (kind === "cranium") {
const skull = createVoxelSkull(0xd3b789);
skull.position.set(-0.42, 0.52, 0.02);
skull.scale.setScalar(0.88);
station.add(skull);
for (let i = 0; i < 5; i++) {
addBox(
station,
[0.19, 0.18, 0.18],
[0.35 + i * 0.25, 0.37, 0.02],
materials.bone
);
}
ghostBox(station, [0.55, 0.13, 0.37], [-0.79, 0.22, 0.02], palette.amber);
ghostBox(station, [0.18, 0.18, 0.18], [0.02, 0.37, 0.02], palette.amber);
}
if (kind === "ribs") {
for (let i = 0; i < 7; i++) {
addBox(
station,
[0.18, 0.17, 0.17],
[-0.85 + i * 0.28, 0.42, 0],
materials.bone
);
if (i < 5) {
addBox(
station,
[0.12, 0.48, 0.13],
[-0.72 + i * 0.28, 0.22, 0.28],
materials.boneDark
);
addBox(
station,
[0.12, 0.44, 0.13],
[-0.72 + i * 0.28, 0.23, -0.28],
materials.boneDark
);
}
}
ghostBox(station, [0.16, 0.54, 0.16], [0.97, 0.22, 0.28], palette.amber);
ghostBox(station, [0.5, 0.18, 0.48], [-1.2, 0.44, 0], palette.amber);
}
if (kind === "limb") {
addBox(station, [1.08, 0.2, 0.2], [0, 0.52, 0], materials.bone);
addBox(station, [0.2, 0.72, 0.2], [-0.42, 0.28, 0], materials.bone);
addBox(station, [0.2, 0.63, 0.2], [0.38, 0.3, 0], materials.boneDark);
addBox(station, [0.35, 0.16, 0.32], [-0.63, 0.03, 0], materials.bone);
ghostBox(station, [0.18, 0.52, 0.18], [0.75, 0.3, 0], palette.amber);
ghostBox(station, [0.45, 0.17, 0.35], [-0.94, 0.52, 0], palette.amber);
}
addLabel(
station,
labelText,
[0, -0.04, 1.35],
"#d3b789",
2.8
);
fossilArchive.add(station);
fossilRecords.push({ group: station, age });
}
createFossilStation(-8.0, 1.35, 39, "cranium", "F-01 / 39 MA / CRANIUM");
createFossilStation(-5.35, 1.75, 27, "ribs", "F-02 / 27 MA / RIBS");
createFossilStation(-2.65, 1.95, 14, "limb", "F-03 / 14 MA / LIMB");
// ------------------------------------------------------------
// Living populations
// ------------------------------------------------------------
const livingRoot = new THREE.Group();
scene.add(livingRoot);
addBox(livingRoot, [7.3, 0.22, 5.0], [7.35, -2.36, 1.45], materials.stone, false);
addBox(livingRoot, [6.9, 0.08, 4.6], [7.35, -2.20, 1.45], standardMaterial(0x273d38), false);
addLabel(
livingRoot,
"LIVING POPULATIONS / PRESENT",
[7.3, -0.75, 3.95],
"#a7d66d",
7.1
);
const creatures = [];
function createCreature(bodyColor, accentColor, position, rotation = 0, scale = 1) {
const creature = new THREE.Group();
creature.position.set(...position);
creature.rotation.y = rotation;
creature.scale.setScalar(scale);
creature.userData.baseY = position[1];
creature.userData.phase = Math.random() * Math.PI * 2;
const bodyMat = standardMaterial(bodyColor);
const accentMat = standardMaterial(accentColor);
const eyeMat = standardMaterial(0x080b0d);
addBox(creature, [0.78, 0.55, 1.08], [0, 0.62, 0], bodyMat);
addBox(creature, [0.62, 0.58, 0.57], [0, 0.93, 0.58], accentMat);
addBox(creature, [0.38, 0.24, 0.28], [0, 0.79, 0.98], bodyMat);
addBox(creature, [0.12, 0.12, 0.045], [-0.18, 1.02, 0.885], eyeMat, false);
addBox(creature, [0.12, 0.12, 0.045], [0.18, 1.02, 0.885], eyeMat, false);
const legPositions = [
[-0.27, 0.25, 0.38],
[0.27, 0.25, 0.38],
[-0.27, 0.25, -0.38],
[0.27, 0.25, -0.38]
];
legPositions.forEach(([x, y, z]) => {
addBox(creature, [0.18, 0.48, 0.18], [x, y, z], bodyMat);
});
addBox(creature, [0.28, 0.25, 0.42], [0, 0.58, -0.67], accentMat);
addBox(creature, [0.2, 0.19, 0.34], [0, 0.6, -0.98], bodyMat);
addBox(creature, [0.12, 0.14, 0.26], [0, 0.63, -1.23], accentMat);
addBox(creature, [0.13, 0.38, 0.42], [-0.39, 1.08, -0.08], accentMat);
addBox(creature, [0.13, 0.38, 0.42], [0.39, 1.08, -0.08], accentMat);
livingRoot.add(creature);
creatures.push(creature);
return creature;
}
const populationCenters = [
{ x: 5.25, z: 0.35, body: 0x668d58, accent: 0xb9d67e, label: "MOSS-BACKS / 128" },
{ x: 9.2, z: 1.65, body: 0xb16f48, accent: 0xf0b36b, label: "EMBER-ANTS / 064" },
{ x: 6.25, z: 2.95, body: 0x4f7f9e, accent: 0x83c6d7, label: "GLASS-FISH / 091" }
];
populationCenters.forEach((population, populationIndex) => {
for (let i = 0; i < 5; i++) {
const angle = (i / 5) * Math.PI * 2 + populationIndex;
const radius = 0.55 + (i % 2) * 0.25;
const x = population.x + Math.cos(angle) * radius;
const z = population.z + Math.sin(angle) * radius * 0.65;
const scale = 0.67 + (i % 3) * 0.055;
createCreature(
population.body,
population.accent,
[x, -2.13, z],
-angle + Math.PI * 0.5,
scale
);
}
addLabel(
livingRoot,
population.label,
[population.x, -1.62, population.z - 0.92],
populationIndex === 0 ? "#b9d67e" : populationIndex === 1 ? "#f0b36b" : "#83c6d7",
2.55
);
});
// Low voxel boundary posts around the living area.
const postMaterial = standardMaterial(0x415267);
[
[4.15, -1.65, -0.45],
[4.15, -1.65, 3.25],
[10.65, -1.65, -0.45],
[10.65, -1.65, 3.25]
].forEach((position) => {
addBox(livingRoot, [0.16, 1.25, 0.16], position, postMaterial);
addBox(livingRoot, [0.25, 0.16, 0.25], [position[0], -0.96, position[2]], materials.cyan, false);
});
// ------------------------------------------------------------
// Ground timeline and temporal cursor
// ------------------------------------------------------------
const timelineGroup = new THREE.Group();
scene.add(timelineGroup);
addBox(timelineGroup, [21.2, 0.12, 0.28], [0, -2.55, 4.72], materials.frame, false);
const timelineTicks = [42, 36, 30, 24, 18, 12, 6, 0];
timelineTicks.forEach((age) => {
const x = -9.2 + (age / 42) * 18;
const major = age % 12 === 0 || age === 0;
addBox(
timelineGroup,
[0.07, major ? 0.42 : 0.24, 0.13],
[x, -2.42, 4.72],
major ? materials.cyan : materials.frame,
false
);
if (major) {
addLabel(
timelineGroup,
age === 0 ? "0 MA" : `${age} MA`,
[x, -2.05, 4.75],
age === 0 ? "#79d9e8" : "#8ca0b7",
1.18
);
}
});
const cursorGroup = new THREE.Group();
scene.add(cursorGroup);
const cursorMaterial = new THREE.MeshBasicMaterial({
color: palette.cyan,
transparent: true,
opacity: 0.72,
depthWrite: false
});
const cursorBeam = addBox(
cursorGroup,
[0.055, 9.6, 0.055],
[0, 2.15, -4.35],
cursorMaterial,
false
);
const cursorFoot = addBox(
cursorGroup,
[0.12, 0.38, 0.12],
[0, -2.3, 4.72],
cursorMaterial,
false
);
addLabel(cursorGroup, "NOW", [0, 6.98, -4.25], "#79d9e8", 1.2);
// ------------------------------------------------------------
// Decorative voxel sediment
// ------------------------------------------------------------
const sediment = new THREE.Group();
scene.add(sediment);
for (let i = 0; i < 34; i++) {
const x = -13 + (i * 2.37) % 26;
const z = -3.5 + ((i * 1.73) % 9.5);
const size = 0.12 + (i % 4) * 0.045;
const material = standardMaterial(i % 3 === 0 ? 0x3d4d5b : 0x293847);
addBox(
sediment,
[size, size * 0.65, size],
[x, -2.64, z],
material,
false
);
}
// ------------------------------------------------------------
// Timeline state and animation
// ------------------------------------------------------------
const state = {
targetHorizon: 42,
displayedHorizon: 42,
playing: false
};
const playButton = document.getElementById("play");
const timeline = document.getElementById("timeline");
const horizonValue = document.getElementById("horizon-value");
const timeReadout = document.getElementById("time-readout");
const knownCount = document.getElementById("known-count");
const extinctCount = document.getElementById("extinct-count");
const livingCount = document.getElementById("living-count");
function setPlaying(playing) {
state.playing = playing;
playButton.textContent = playing ? "Ⅱ Pause" : "▶ Replay";
}
playButton.addEventListener("click", () => {
if (!state.playing && state.targetHorizon >= 41.9) {
state.targetHorizon = 0;
}
setPlaying(!state.playing);
});
timeline.addEventListener("input", (event) => {
state.targetHorizon = Number(event.target.value);
setPlaying(false);
});
function updateTerminalAppearance(group, age, horizon) {
const reveal = smoothReveal(age, horizon, 2.0);
group.scale.setScalar(reveal);
group.visible = reveal > 0.001;
group.traverse((child) => {
if (!child.isMesh || !child.material) return;
if (!child.userData.originalOpacity) {
child.userData.originalOpacity = child.material.opacity ?? 1;
}
child.material.transparent = true;
child.material.opacity = child.userData.originalOpacity * (0.42 + reveal * 0.58);
});
}
function updateScene(horizon, elapsed) {
// Reveal ancestry voxel by voxel.
for (const record of Object.values(branchRecords)) {
for (const entry of record.voxels) {
const reveal = smoothReveal(entry.age, horizon, 1.5);
entry.mesh.scale.setScalar(Math.max(0.001, reveal * 0.19));
entry.mesh.visible = reveal > 0.002;
}
}
// Faded extinct lineages become dimmer after their endpoint.
const middleFade = THREE.MathUtils.clamp(
(horizon - branchRecords.middle.endAge) / 4,
0,
1
);
const lowerFade = THREE.MathUtils.clamp(
(horizon - branchRecords.lower.endAge) / 4,
0,
1
);
materials.middle.opacity = THREE.MathUtils.lerp(0.92, 0.27, middleFade);
materials.lower.opacity = THREE.MathUtils.lerp(0.92, 0.27, lowerFade);
updateTerminalAppearance(
middleTerminal,
branchRecords.middle.endAge,
horizon
);
updateTerminalAppearance(
lowerTerminal,
branchRecords.lower.endAge,
horizon
);
// Fossils enter as their dates are reached.
for (const fossil of fossilRecords) {
const reveal = smoothReveal(fossil.age, horizon, 2.2);
fossil.group.scale.setScalar(Math.max(0.001, reveal));
fossil.group.visible = reveal > 0.002;
}
// Present-day populations appear only at the present horizon.
const livingReveal = smoothReveal(0, horizon, 2.0);
livingRoot.scale.setScalar(Math.max(0.001, livingReveal));
livingRoot.visible = livingReveal > 0.002;
// Gentle living motion.
for (const creature of creatures) {
creature.position.y =
creature.userData.baseY +
Math.sin(elapsed * 1.8 + creature.userData.phase) * 0.018;
}
// Temporal cursor.
const cursorX = -9.2 + (horizon / 42) * 18;
cursorBeam.position.x = cursorX;
cursorFoot.position.x = cursorX;
const cursorLabel = cursorGroup.children.find((child) => child.isSprite);
if (cursorLabel) cursorLabel.position.x = cursorX;
// UI readout.
const known = fossilRecords.filter((fossil) => fossil.age <= state.targetHorizon).length;
const extinct = [
branchRecords.middle.endAge,
branchRecords.lower.endAge
].filter((age) => age <= state.targetHorizon).length;
horizonValue.textContent = state.targetHorizon.toFixed(1);
timeReadout.textContent =
state.targetHorizon < 0.05 ? "Present" : `${state.targetHorizon.toFixed(1)} Ma`;
knownCount.textContent = `${known} / ${fossilRecords.length}`;
extinctCount.textContent = String(extinct).padStart(2, "0");
livingCount.textContent = state.targetHorizon >= 40 ? "03" : "00";
timeline.value = state.targetHorizon.toString();
}
// ------------------------------------------------------------
// Custom pointer orbit and zoom — no external controls addon
// ------------------------------------------------------------
let dragging = false;
let lastPointerX = 0;
let lastPointerY = 0;
let activePointerId = null;
renderer.domElement.addEventListener("pointerdown", (event) => {
dragging = true;
activePointerId = event.pointerId;
lastPointerX = event.clientX;
lastPointerY = event.clientY;
renderer.domElement.setPointerCapture(event.pointerId);
});
renderer.domElement.addEventListener("pointermove", (event) => {
if (!dragging || event.pointerId !== activePointerId) return;
const dx = event.clientX - lastPointerX;
const dy = event.clientY - lastPointerY;
lastPointerX = event.clientX;
lastPointerY = event.clientY;
cameraRig.theta -= dx * 0.005;
cameraRig.phi = THREE.MathUtils.clamp(
cameraRig.phi - dy * 0.004,
0.54,
1.42
);
updateCamera();
});
function stopDragging(event) {
if (activePointerId !== null && event.pointerId === activePointerId) {
dragging = false;
activePointerId = null;
}
}
renderer.domElement.addEventListener("pointerup", stopDragging);
renderer.domElement.addEventListener("pointercancel", stopDragging);
renderer.domElement.addEventListener(
"wheel",
(event) => {
event.preventDefault();
cameraRig.radius = THREE.MathUtils.clamp(
cameraRig.radius * Math.exp(event.deltaY * 0.001),
15,
39
);
updateCamera();
},
{ passive: false }
);
function resetCamera() {
cameraRig.theta = 0.40;
cameraRig.phi = 1.03;
cameraRig.radius = 25.5;
cameraRig.target.set(0.1, 1.25, -0.5);
updateCamera();
}
renderer.domElement.addEventListener("dblclick", resetCamera);
window.addEventListener("keydown", (event) => {
if (event.target === timeline) return;
if (event.code === "Space") {
event.preventDefault();
if (!state.playing && state.targetHorizon >= 41.9) {
state.targetHorizon = 0;
}
setPlaying(!state.playing);
}
if (event.key.toLowerCase() === "r") {
resetCamera();
}
});
window.addEventListener("resize", () => {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
});
// ------------------------------------------------------------
// Render loop
// ------------------------------------------------------------
const clock = new THREE.Clock();
function animate() {
requestAnimationFrame(animate);
const delta = Math.min(clock.getDelta(), 0.05);
const elapsed = clock.elapsedTime;
if (state.playing) {
state.targetHorizon += delta * 2.65;
if (state.targetHorizon >= 42) {
state.targetHorizon = 42;
setPlaying(false);
}
}
state.displayedHorizon = THREE.MathUtils.lerp(
state.displayedHorizon,
state.targetHorizon,
1 - Math.exp(-delta * 8)
);
updateScene(state.displayedHorizon, elapsed);
renderer.render(scene, camera);
}
animate();
</script>
</body>
</html>
```