Prompt specification
Build or customize the Three.js 3D scene "Frog development stage timeline" 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: Frog development stage timeline
Category: Biology & Nature · Style: Procedural Solid / Shader 3D
License: MIT · Reference: https://three3d.app/scene/frog-development-stage-timeline-x0690
Scene Description Prompt:
Make a low-poly Three.js scene in a self-contained HTML file using cdnjs: frog development stage timeline. Animate a sequence of distinct developmental models from tadpole to froglet; stage transitions highlight growing limbs and reducing tail while marking the timeline as condensed.
Working Three.js Starter (frog-development-stage-timeline-x0690):
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Frog Development — Condensed Timeline</title>
<style>
:root {
color-scheme: dark;
--ink: #f3f8e9;
--muted: #9eb5aa;
--lime: #b8dd6d;
--mint: #75d3b3;
--gold: #f2c969;
--panel: rgba(8, 25, 23, 0.78);
--line: rgba(218, 239, 218, 0.14);
}
* {
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: #071b19;
color: var(--ink);
font-family:
Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
"Segoe UI", sans-serif;
}
button,
input {
font: inherit;
}
#scene {
position: fixed;
inset: 0;
}
#scene canvas {
display: block;
width: 100%;
height: 100%;
touch-action: none;
outline: none;
}
.vignette {
position: fixed;
inset: 0;
z-index: 1;
pointer-events: none;
background:
radial-gradient(
circle at 50% 42%,
transparent 30%,
rgba(2, 12, 12, 0.12) 68%,
rgba(2, 10, 10, 0.58) 100%
);
}
.hud {
position: fixed;
inset: 0;
z-index: 2;
pointer-events: none;
}
.header {
position: absolute;
top: 28px;
left: 32px;
display: flex;
align-items: flex-start;
gap: 14px;
max-width: 560px;
}
.mark {
width: 42px;
height: 42px;
flex: 0 0 auto;
display: grid;
place-items: center;
border: 1px solid rgba(184, 221, 109, 0.35);
border-radius: 13px;
color: var(--lime);
background: rgba(11, 36, 32, 0.64);
box-shadow: inset 0 0 18px rgba(184, 221, 109, 0.06);
backdrop-filter: blur(10px);
}
.eyebrow {
margin: 0 0 6px;
color: var(--lime);
font-size: 10px;
font-weight: 800;
letter-spacing: 0.19em;
text-transform: uppercase;
}
h1 {
margin: 0;
font-size: clamp(28px, 4vw, 52px);
font-weight: 680;
line-height: 0.98;
letter-spacing: -0.045em;
text-shadow: 0 2px 18px rgba(0, 0, 0, 0.22);
}
.subtitle {
max-width: 430px;
margin: 11px 0 0;
color: var(--muted);
font-size: 13px;
line-height: 1.55;
}
.badges {
position: absolute;
top: 29px;
right: 30px;
display: flex;
align-items: center;
gap: 10px;
}
.badge {
display: inline-flex;
align-items: center;
gap: 8px;
min-height: 34px;
padding: 0 12px;
border: 1px solid var(--line);
border-radius: 999px;
background: rgba(7, 26, 24, 0.66);
color: #c9dbd1;
font-size: 10px;
font-weight: 750;
letter-spacing: 0.12em;
text-transform: uppercase;
backdrop-filter: blur(12px);
}
.badge-dot {
width: 7px;
height: 7px;
border-radius: 50%;
background: var(--gold);
box-shadow: 0 0 12px rgba(242, 201, 105, 0.75);
}
.specimen-card {
position: absolute;
top: 174px;
left: 32px;
width: 260px;
padding: 17px 18px;
border: 1px solid var(--line);
border-radius: 18px;
background: linear-gradient(
145deg,
rgba(11, 37, 33, 0.82),
rgba(7, 24, 23, 0.67)
);
box-shadow: 0 18px 48px rgba(0, 0, 0, 0.16);
backdrop-filter: blur(14px);
}
.card-top {
display: flex;
align-items: center;
justify-content: space-between;
gap: 10px;
}
#stage-kicker {
color: var(--mint);
font-size: 9px;
font-weight: 800;
letter-spacing: 0.16em;
text-transform: uppercase;
}
#stage-age {
padding: 4px 7px;
border-radius: 999px;
background: rgba(184, 221, 109, 0.1);
color: #d6e9b9;
font-size: 9px;
font-weight: 700;
letter-spacing: 0.08em;
text-transform: uppercase;
}
#stage-name {
margin: 10px 0 6px;
font-size: 22px;
font-weight: 690;
letter-spacing: -0.03em;
}
#stage-description {
min-height: 48px;
margin: 0;
color: var(--muted);
font-size: 11.5px;
line-height: 1.55;
}
.focus-row {
display: flex;
align-items: center;
gap: 9px;
margin-top: 14px;
padding-top: 13px;
border-top: 1px solid var(--line);
}
.focus-icon {
position: relative;
width: 18px;
height: 18px;
flex: 0 0 auto;
border: 1px solid rgba(242, 201, 105, 0.7);
border-radius: 50%;
}
.focus-icon::after {
content: "";
position: absolute;
inset: 4px;
border-radius: 50%;
background: var(--gold);
box-shadow: 0 0 8px rgba(242, 201, 105, 0.8);
}
#focus-text {
color: #d7e2d7;
font-size: 9.5px;
font-weight: 750;
letter-spacing: 0.1em;
line-height: 1.4;
text-transform: uppercase;
}
.annotation {
position: absolute;
z-index: 3;
min-width: 154px;
padding: 10px 12px;
border: 1px solid rgba(242, 201, 105, 0.35);
border-radius: 12px;
background: rgba(8, 27, 24, 0.88);
box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
backdrop-filter: blur(10px);
pointer-events: none;
transform: translate(0, -50%);
transition: opacity 180ms ease;
}
.annotation::before {
content: "";
position: absolute;
top: 50%;
right: 100%;
width: 30px;
height: 1px;
background: linear-gradient(to left, rgba(242, 201, 105, 0.8), transparent);
}
.annotation::after {
content: "";
position: absolute;
top: calc(50% - 3px);
right: calc(100% + 28px);
width: 6px;
height: 6px;
border-radius: 50%;
background: var(--gold);
box-shadow: 0 0 10px rgba(242, 201, 105, 0.9);
}
.annotation.left-side {
transform: translate(-100%, -50%);
}
.annotation.left-side::before {
right: auto;
left: 100%;
background: linear-gradient(to right, rgba(242, 201, 105, 0.8), transparent);
}
.annotation.left-side::after {
right: auto;
left: calc(100% + 28px);
}
#annotation-kicker {
color: var(--gold);
font-size: 8px;
font-weight: 850;
letter-spacing: 0.14em;
text-transform: uppercase;
}
#annotation-title {
margin-top: 3px;
color: #f1f4e8;
font-size: 11px;
font-weight: 700;
}
.timeline {
position: absolute;
right: 28px;
bottom: 25px;
left: 28px;
max-width: 1020px;
margin: auto;
padding: 15px 18px 13px;
border: 1px solid var(--line);
border-radius: 20px;
background: linear-gradient(
180deg,
rgba(9, 31, 28, 0.88),
rgba(6, 22, 21, 0.9)
);
box-shadow: 0 22px 65px rgba(0, 0, 0, 0.35);
backdrop-filter: blur(18px);
pointer-events: auto;
}
.timeline-head {
display: flex;
align-items: center;
justify-content: space-between;
gap: 18px;
margin-bottom: 12px;
}
.timeline-title {
display: flex;
align-items: center;
gap: 9px;
color: #dfe9de;
font-size: 10px;
font-weight: 800;
letter-spacing: 0.13em;
text-transform: uppercase;
}
.timeline-title::before {
content: "";
width: 7px;
height: 7px;
border-radius: 50%;
background: var(--lime);
box-shadow: 0 0 10px rgba(184, 221, 109, 0.65);
}
.timeline-note {
color: #819b90;
font-size: 9px;
font-weight: 650;
letter-spacing: 0.08em;
text-transform: uppercase;
}
.transport {
display: flex;
align-items: center;
gap: 12px;
}
#play {
width: 34px;
height: 34px;
flex: 0 0 auto;
display: grid;
place-items: center;
padding: 0;
border: 1px solid rgba(184, 221, 109, 0.32);
border-radius: 50%;
background: rgba(184, 221, 109, 0.1);
color: var(--lime);
cursor: pointer;
transition:
background 160ms ease,
transform 160ms ease;
}
#play:hover {
background: rgba(184, 221, 109, 0.2);
transform: scale(1.04);
}
#play svg {
width: 14px;
height: 14px;
fill: currentColor;
}
.scrubber {
position: relative;
flex: 1;
min-width: 120px;
}
#timeline-range {
--progress: 0%;
width: 100%;
height: 18px;
margin: 0;
appearance: none;
background: transparent;
cursor: pointer;
}
#timeline-range::-webkit-slider-runnable-track {
height: 3px;
border-radius: 999px;
background:
linear-gradient(
to right,
var(--lime) 0,
var(--lime) var(--progress),
rgba(220, 240, 222, 0.16) var(--progress),
rgba(220, 240, 222, 0.16) 100%
);
}
#timeline-range::-moz-range-track {
height: 3px;
border-radius: 999px;
background: rgba(220, 240, 222, 0.16);
}
#timeline-range::-moz-range-progress {
height: 3px;
border-radius: 999px;
background: var(--lime);
}
#timeline-range::-webkit-slider-thumb {
width: 13px;
height: 13px;
margin-top: -5px;
appearance: none;
border: 3px solid #173a2c;
border-radius: 50%;
background: var(--lime);
box-shadow: 0 0 0 1px rgba(184, 221, 109, 0.45);
}
#timeline-range::-moz-range-thumb {
width: 9px;
height: 9px;
border: 3px solid #173a2c;
border-radius: 50%;
background: var(--lime);
}
.stage-buttons {
display: grid;
grid-template-columns: repeat(5, 1fr);
gap: 8px;
margin-top: 5px;
}
.stage-button {
position: relative;
display: flex;
align-items: center;
gap: 8px;
min-width: 0;
padding: 7px 8px;
border: 0;
border-radius: 10px;
background: transparent;
color: #789187;
text-align: left;
cursor: pointer;
transition:
color 160ms ease,
background 160ms ease;
}
.stage-button:hover {
color: #cadacd;
background: rgba(255, 255, 255, 0.035);
}
.stage-button.active {
color: #edf6e4;
background: rgba(184, 221, 109, 0.09);
}
.stage-number {
color: #688178;
font-size: 8px;
font-weight: 800;
letter-spacing: 0.08em;
}
.stage-button.active .stage-number {
color: var(--lime);
}
.stage-copy {
min-width: 0;
}
.stage-label {
overflow: hidden;
font-size: 9.5px;
font-weight: 720;
letter-spacing: 0.035em;
text-overflow: ellipsis;
white-space: nowrap;
}
.stage-days {
margin-top: 2px;
color: #617b71;
font-size: 7.5px;
font-weight: 650;
letter-spacing: 0.06em;
text-transform: uppercase;
}
.orbit-hint {
position: absolute;
right: 31px;
bottom: 183px;
color: rgba(193, 215, 202, 0.62);
font-size: 9px;
font-weight: 650;
letter-spacing: 0.08em;
text-transform: uppercase;
}
@media (max-width: 760px) {
.header {
top: 18px;
left: 18px;
gap: 10px;
}
.mark {
width: 36px;
height: 36px;
}
.subtitle {
max-width: 270px;
font-size: 11px;
}
.badges {
top: 18px;
right: 18px;
}
.badges .badge:first-child {
display: none;
}
.specimen-card {
top: auto;
bottom: 177px;
left: 18px;
width: 218px;
padding: 12px 14px;
}
#stage-description {
display: none;
}
.focus-row {
margin-top: 9px;
padding-top: 9px;
}
.timeline {
right: 12px;
bottom: 12px;
left: 12px;
padding: 12px;
}
.timeline-note {
display: none;
}
.stage-buttons {
gap: 2px;
}
.stage-button {
justify-content: center;
padding: 6px 2px;
}
.stage-number,
.stage-days {
display: none;
}
.stage-label {
font-size: 8px;
}
.orbit-hint {
display: none;
}
}
@media (max-width: 480px) {
h1 {
font-size: 28px;
}
.subtitle {
display: none;
}
.specimen-card {
width: 196px;
}
#stage-name {
font-size: 18px;
}
.annotation {
min-width: 125px;
}
}
</style>
</head>
<body>
<div id="scene"></div>
<div class="vignette"></div>
<main class="hud">
<header class="header">
<div class="mark" aria-hidden="true">
<svg width="24" height="24" viewBox="0 0 24 24" fill="none">
<path
d="M5 8.5C5 5.46 8.13 3 12 3s7 2.46 7 5.5c0 2.2-1.77 4.07-4.26 4.88.18.68.72 1.68 1.63 2.38 1.47 1.13 2.63 1.46 2.63 2.74 0 1.38-1.18 2.5-2.63 2.5-2.3 0-4.43-2.1-4.63-4.23A8.3 8.3 0 0 1 12 17c-.57 0-1.12-.07-1.66-.21-.2 2.13-2.33 4.21-4.63 4.21-1.45 0-2.63-1.12-2.63-2.5 0-1.28 1.16-1.61 2.63-2.74.91-.7 1.45-1.7 1.63-2.38A5.68 5.68 0 0 1 5 8.5Z"
stroke="currentColor"
stroke-width="1.45"
stroke-linejoin="round"
/>
<circle cx="9.2" cy="8.4" r="1.1" fill="currentColor" />
<circle cx="14.8" cy="8.4" r="1.1" fill="currentColor" />
</svg>
</div>
<div>
<p class="eyebrow">Field study · Amphibian development</p>
<h1>From tail<br />to limbs.</h1>
<p class="subtitle">
A condensed visual timeline of a frog’s transformation from a
free-swimming tadpole to a four-legged froglet.
</p>
</div>
</header>
<div class="badges">
<div class="badge">
<span class="badge-dot"></span>
Condensed sequence
</div>
<div class="badge">05 stages</div>
</div>
<section class="specimen-card" aria-live="polite">
<div class="card-top">
<span id="stage-kicker">Specimen 01 · Larva</span>
<span id="stage-age">Days 0–3</span>
</div>
<h2 id="stage-name">Tadpole</h2>
<p id="stage-description">
A rounded, finned body and prominent tail support a fully aquatic
larval form.
</p>
<div class="focus-row">
<span class="focus-icon" aria-hidden="true"></span>
<span id="focus-text">Morphology · tail dominant</span>
</div>
</section>
<div class="annotation" id="annotation" aria-hidden="true">
<div id="annotation-kicker">Current morphology</div>
<div id="annotation-title">Fin-driven swimming</div>
</div>
<div class="orbit-hint">Drag to orbit · Scroll to zoom</div>
<section class="timeline" aria-label="Frog development timeline">
<div class="timeline-head">
<div class="timeline-title">Condensed development timeline</div>
<div class="timeline-note">
Representative morphology · timing compressed · not to scale
</div>
</div>
<div class="transport">
<button id="play" type="button" aria-label="Pause autoplay">
<svg id="play-icon" viewBox="0 0 16 16" aria-hidden="true">
<path d="M3 2h3.5v12H3zm6.5 0H13v12H9.5z" />
</svg>
</button>
<div class="scrubber">
<input
id="timeline-range"
type="range"
min="0"
max="400"
step="1"
value="0"
aria-label="Development stage"
/>
</div>
</div>
<div class="stage-buttons">
<button class="stage-button active" data-stage="0" type="button">
<span class="stage-number">01</span>
<span class="stage-copy">
<span class="stage-label">Tadpole</span>
<span class="stage-days">Days 0–3</span>
</span>
</button>
<button class="stage-button" data-stage="1" type="button">
<span class="stage-number">02</span>
<span class="stage-copy">
<span class="stage-label">Tail bud</span>
<span class="stage-days">Approx. day 4</span>
</span>
</button>
<button class="stage-button" data-stage="2" type="button">
<span class="stage-number">03</span>
<span class="stage-copy">
<span class="stage-label">Hindlimb</span>
<span class="stage-days">Approx. day 7</span>
</span>
</button>
<button class="stage-button" data-stage="3" type="button">
<span class="stage-number">04</span>
<span class="stage-copy">
<span class="stage-label">Four limbs</span>
<span class="stage-days">Approx. day 10</span>
</span>
</button>
<button class="stage-button" data-stage="4" type="button">
<span class="stage-number">05</span>
<span class="stage-copy">
<span class="stage-label">Froglet</span>
<span class="stage-days">Approx. days 12–14</span>
</span>
</button>
</div>
</section>
</main>
<script type="module">
import * as THREE from
"https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
const STAGES = [
{
name: "Tadpole",
kicker: "Specimen 01 · Larva",
age: "Days 0–3",
description:
"A rounded, finned body and prominent tail support a fully aquatic larval form.",
focus: "Morphology · tail dominant",
annotation: "Fin-driven swimming",
tail: 2.35
},
{
name: "Tail bud",
kicker: "Specimen 02 · Limb bud",
age: "Approx. day 4",
description:
"Small paired buds emerge near the tail base, anticipating the muscular hind legs.",
focus: "Transition · hind buds emerge",
annotation: "First hind-limb buds",
tail: 2.05
},
{
name: "Hindlimb stage",
kicker: "Specimen 03 · Metamorphosis",
age: "Approx. day 7",
description:
"Folded hind legs become functional while the larval tail continues to shorten.",
focus: "Transition · hind limbs grow",
annotation: "Muscular hind legs unfold",
tail: 1.65
},
{
name: "Four-limb stage",
kicker: "Specimen 04 · Metamorphosis",
age: "Approx. day 10",
description:
"Forelimbs join developed hind limbs, and the body increasingly resembles a small frog.",
focus: "Transition · forelimbs emerge",
annotation: "Forelimbs complete the quartet",
tail: 1.05
},
{
name: "Froglet",
kicker: "Specimen 05 · Froglet",
age: "Approx. days 12–14",
description:
"A compact frog body, four strong limbs, and only a residual tail mark the transition ashore.",
focus: "Morphology · limbs established",
annotation: "A residual tail remains",
tail: 0.38
}
];
const scene = new THREE.Scene();
scene.background = new THREE.Color(0x071c1a);
scene.fog = new THREE.FogExp2(0x071c1a, 0.035);
const camera = new THREE.PerspectiveCamera(
38,
window.innerWidth / window.innerHeight,
0.1,
100
);
const renderer = new THREE.WebGLRenderer({
antialias: true,
powerPreference: "high-performance"
});
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1.12;
renderer.domElement.setAttribute("aria-label", "Interactive 3D frog development scene");
renderer.domElement.tabIndex = 0;
document.getElementById("scene").appendChild(renderer.domElement);
const hemisphere = new THREE.HemisphereLight(0xd8f3d0, 0x163a35, 2.0);
scene.add(hemisphere);
const sun = new THREE.DirectionalLight(0xffedc7, 3.1);
sun.position.set(-5, 9, 6);
sun.castShadow = true;
sun.shadow.mapSize.set(2048, 2048);
sun.shadow.camera.left = -8;
sun.shadow.camera.right = 8;
sun.shadow.camera.top = 8;
sun.shadow.camera.bottom = -8;
sun.shadow.camera.near = 1;
sun.shadow.camera.far = 25;
sun.shadow.bias = -0.0007;
scene.add(sun);
const rim = new THREE.DirectionalLight(0x70d8c5, 1.5);
rim.position.set(6, 4, -5);
scene.add(rim);
const warmFill = new THREE.PointLight(0xf4c86f, 18, 11, 2);
warmFill.position.set(0, 4.5, 4);
scene.add(warmFill);
const world = new THREE.Group();
scene.add(world);
function standardMaterial(color, options = {}) {
return new THREE.MeshStandardMaterial({
color,
roughness: options.roughness ?? 0.78,
metalness: options.metalness ?? 0,
flatShading: true,
transparent: true,
emissive: options.emissive ?? 0x000000,
emissiveIntensity: options.emissiveIntensity ?? 0
});
}
function addMesh(parent, geometry, material, position = [0, 0, 0], scale = [1, 1, 1], rotation = [0, 0, 0]) {
const mesh = new THREE.Mesh(geometry, material);
mesh.position.set(...position);
mesh.scale.set(...scale);
mesh.rotation.set(...rotation);
mesh.castShadow = true;
mesh.receiveShadow = true;
parent.add(mesh);
return mesh;
}
function cylinderBetween(parent, material, a, b, radius, endRadius = radius) {
const start = new THREE.Vector3(...a);
const end = new THREE.Vector3(...b);
const direction = end.clone().sub(start);
const length = direction.length();
const geometry = new THREE.CylinderGeometry(
endRadius,
radius,
length,
5,
1,
false
);
const mesh = addMesh(parent, geometry, material);
mesh.position.copy(start.clone().add(end).multiplyScalar(0.5));
mesh.quaternion.setFromUnitVectors(
new THREE.Vector3(0, 1, 0),
direction.normalize()
);
return mesh;
}
// Low-poly pond diorama.
const groundMat = standardMaterial(0x173b32);
const ground = addMesh(
world,
new THREE.CircleGeometry(12, 32),
groundMat,
[0, -0.12, 0],
[1, 1, 1],
[-Math.PI / 2, 0, 0]
);
ground.receiveShadow = true;
const waterMat = new THREE.MeshPhysicalMaterial({
color: 0x2e7a73,
roughness: 0.28,
metalness: 0.04,
transmission: 0.06,
transparent: true,
opacity: 0.82,
flatShading: true
});
const water = addMesh(
world,
new THREE.CircleGeometry(4.75, 32),
waterMat,
[0, -0.055, 0],
[1, 1, 1],
[-Math.PI / 2, 0, 0]
);
water.receiveShadow = true;
const bankMat = standardMaterial(0x516e49);
const bank = addMesh(
world,
new THREE.CylinderGeometry(5.05, 5.35, 0.24, 24),
bankMat,
[0, -0.13, 0]
);
bank.receiveShadow = true;
const platformMat = standardMaterial(0xa9aa79, { roughness: 0.9 });
const platform = addMesh(
world,
new THREE.CylinderGeometry(2.03, 2.14, 0.25, 24),
platformMat,
[0, 0.09, 0]
);
platform.receiveShadow = true;
const platformTopMat = standardMaterial(0x89986c, { roughness: 0.94 });
const platformTop = addMesh(
world,
new THREE.CylinderGeometry(1.91, 1.95, 0.08, 24),
platformTopMat,
[0, 0.25, 0]
);
platformTop.receiveShadow = true;
const ringMat = new THREE.MeshBasicMaterial({
color: 0xb6d77b,
transparent: true,
opacity: 0.35
});
addMesh(
world,
new THREE.TorusGeometry(2.1, 0.018, 4, 48),
ringMat,
[0, 0.27, 0],
[1, 1, 1],
[Math.PI / 2, 0, 0]
);
const rippleMat = new THREE.MeshBasicMaterial({
color: 0x8ed9c6,
transparent: true,
opacity: 0.12
});
for (const radius of [2.9, 3.65, 4.35]) {
addMesh(
world,
new THREE.TorusGeometry(radius, 0.012, 3, 48),
rippleMat,
[0, -0.025, 0],
[1, 1, 1],
[Math.PI / 2, 0, 0]
);
}
const lilyMat = standardMaterial(0x4c8f54);
const lilyDarkMat = standardMaterial(0x2f6749);
const lilyPositions = [
[-3.05, -0.02, 1.6, 0.55],
[3.2, -0.025, -1.25, 0.67],
[-2.85, -0.025, -2.25, 0.44],
[2.9, -0.025, 2.05, 0.4]
];
for (const [x, y, z, scale] of lilyPositions) {
const pad = addMesh(
world,
new THREE.CircleGeometry(scale, 8),
lilyMat,
[x, y, z],
[1.25, 0.72, 1],
[-Math.PI / 2, 0, Math.random() * Math.PI]
);
pad.receiveShadow = true;
addMesh(
world,
new THREE.CylinderGeometry(scale * 0.18, scale * 0.22, 0.055, 7),
lilyDarkMat,
[x + scale * 0.08, y + 0.01, z]
);
}
const reedMat = standardMaterial(0x6a9650);
const reedTipMat = standardMaterial(0xb88b4e);
function addReed(x, z, height, lean) {
const reed = new THREE.Group();
reed.position.set(x, -0.08, z);
reed.rotation.z = lean;
world.add(reed);
addMesh(
reed,
new THREE.CylinderGeometry(0.025, 0.045, height, 5),
reedMat,
[0, height * 0.5, 0]
);
addMesh(
reed,
new THREE.CylinderGeometry(0.06, 0.075, 0.27, 6),
reedTipMat,
[0, height + 0.06, 0]
);
}
[
[-3.85, 0.2, 1.3, -0.12],
[-4.05, 0.42, 1.75, 0.08],
[-3.6, -0.2, 1.0, -0.2],
[3.8, -0.2, -0.7, 0.12],
[4.1, 0.18, -0.95, -0.08],
[3.55, 0.05, -0.5, 0.22]
].forEach((r) => addReed(...r));
const rockMat = standardMaterial(0x66756a, { roughness: 0.95 });
const rockPositions = [
[-3.45, 0.08, 2.35, 0.52],
[3.25, 0.08, 2.4, 0.45],
[-3.5, 0.06, -2.75, 0.36],
[3.65, 0.08, -2.55, 0.57]
];
for (const [x, y, z, s] of rockPositions) {
const rock = addMesh(
world,
new THREE.DodecahedronGeometry(s, 0),
rockMat,
[x, y, z],
[1.2, 0.75, 0.9],
[0.2, Math.random() * Math.PI, 0.1]
);
rock.receiveShadow = true;
}
// Small ambient fireflies.
const fireflies = [];
for (let i = 0; i < 14; i++) {
const material = new THREE.MeshBasicMaterial({
color: i % 3 === 0 ? 0xf3d170 : 0x9be7c1,
transparent: true,
opacity: 0.55
});
const firefly = addMesh(
world,
new THREE.IcosahedronGeometry(0.025 + Math.random() * 0.018, 0),
material
);
const angle = (i / 14) * Math.PI * 2;
const radius = 3 + Math.random() * 2.4;
firefly.position.set(
Math.cos(angle) * radius,
0.65 + Math.random() * 1.8,
Math.sin(angle) * radius
);
firefly.userData.phase = Math.random() * Math.PI * 2;
firefly.userData.baseY = firefly.position.y;
fireflies.push(firefly);
}
function makeTail(parent, length, radius, material) {
const tail = new THREE.Group();
parent.add(tail);
const count = length > 1.2 ? 4 : length > 0.6 ? 3 : 2;
const segmentLength = length / count;
let cursor = 0;
for (let i = 0; i < count; i++) {
const r = radius * (1 - i / (count + 0.7));
const x = -0.67 - cursor - segmentLength * 0.5;
addMesh(
tail,
new THREE.ConeGeometry(r, segmentLength * 1.03, 5),
material,
[x, 0, 0],
[1, 1, 0.82],
[0, 0, Math.PI / 2]
);
cursor += segmentLength * 0.94;
}
if (length > 1.2) {
addMesh(
tail,
new THREE.IcosahedronGeometry(1, 0),
material,
[-0.67 - length * 0.88, 0.01, 0],
[length * 0.14, radius * 0.95, 0.16]
);
}
tail.userData.tailGroup = true;
return tail;
}
function addEyes(parent, headPosition, headScale, size, bulge = false) {
const gold = standardMaterial(0xe8bd52, { roughness: 0.32 });
const black = standardMaterial(0x0a1513, { roughness: 0.22 });
const glint = standardMaterial(0xf7f1d3, { roughness: 0.15 });
for (const side of [-1, 1]) {
const eyeX = headPosition[0] + headScale[0] * 0.27;
const eyeY = headPosition[1] + headScale[1] * 0.47;
const surfaceZ = headScale[2] * 0.77;
if (bulge) {
addMesh(
parent,
new THREE.IcosahedronGeometry(size * 1.27, 1),
parent.userData.bodyMaterial,
[eyeX - size * 0.12, eyeY, side * surfaceZ * 0.89],
[1, 1, 0.88]
);
}
addMesh(
parent,
new THREE.IcosahedronGeometry(size, 1),
gold,
[eyeX, eyeY, side * (surfaceZ + size * 0.2)]
);
addMesh(
parent,
new THREE.IcosahedronGeometry(size * 0.48, 1),
black,
[eyeX + size * 0.18, eyeY - size * 0.02, side * (surfaceZ + size * 0.7)],
[0.82, 1.08, 0.58]
);
addMesh(
parent,
new THREE.IcosahedronGeometry(size * 0.12, 0),
glint,
[eyeX + size * 0.28, eyeY + size * 0.25, side * (surfaceZ + size * 0.91)]
);
}
}
function addMouth(parent, headPosition, headScale) {
const mouth = standardMaterial(0x294a36);
addMesh(
parent,
new THREE.BoxGeometry(0.035, 0.045, headScale[2] * 1.18),
mouth,
[
headPosition[0] + headScale[0] * 0.83,
headPosition[1] - headScale[1] * 0.34,
0
]
);
}
function addLimb(parent, type, side, scale = 1, bud = false) {
const limb = new THREE.Group();
limb.userData.limbType = type;
limb.userData.baseScale = 1;
parent.add(limb);
const material = type === "hind"
? parent.userData.hindMaterial
: parent.userData.frontMaterial;
if (bud) {
const budMesh = addMesh(
limb,
new THREE.IcosahedronGeometry(type === "hind" ? 0.18 : 0.13, 0),
material,
type === "hind"
? [-0.42, -0.23, side * 0.42]
: [0.55, -0.18, side * 0.38],
[1.1, 0.75, 0.9]
);
budMesh.rotation.z = side * 0.2;
return limb;
}
if (type === "hind") {
const hip = [-0.22, -0.1, side * 0.37];
const knee = [-0.62, -0.34, side * 0.57];
const ankle = [0.03, -0.47, side * 0.64];
const toe = [0.42, -0.5, side * 0.7];
cylinderBetween(limb, material, hip, knee, 0.15 * scale, 0.12 * scale);
cylinderBetween(limb, material, knee, ankle, 0.11 * scale, 0.08 * scale);
cylinderBetween(limb, material, ankle, toe, 0.075 * scale, 0.05 * scale);
addMesh(
limb,
new THREE.IcosahedronGeometry(0.13 * scale, 0),
material,
toe,
[1.55, 0.34, 0.72]
);
} else {
const shoulder = [0.45, -0.05, side * 0.37];
const elbow = [0.35, -0.27, side * 0.52];
const wrist = [0.7, -0.41, side * 0.58];
const toe = [1.0, -0.44, side * 0.65];
cylinderBetween(limb, material, shoulder, elbow, 0.12 * scale, 0.095 * scale);
cylinderBetween(limb, material, elbow, wrist, 0.09 * scale, 0.07 * scale);
cylinderBetween(limb, material, wrist, toe, 0.065 * scale, 0.045 * scale);
addMesh(
limb,
new THREE.IcosahedronGeometry(0.115 * scale, 0),
material,
toe,
[1.4, 0.3, 0.7]
);
}
return limb;
}
function createStage(index) {
const group = new THREE.Group();
group.name = `Stage ${index + 1}: ${STAGES[index].name}`;
const bodyMaterial = standardMaterial(0x668f45);
const bellyMaterial = standardMaterial(0xc0bd72);
const hindMaterial = standardMaterial(0x5d873f);
const frontMaterial = standardMaterial(0x6a9448);
const tailMaterial = standardMaterial(0x568149);
group.userData.bodyMaterial = bodyMaterial;
group.userData.hindMaterial = hindMaterial;
group.userData.frontMaterial = frontMaterial;
group.userData.tailMaterial = tailMaterial;
group.userData.limbs = [];
group.userData.materials = [];
group.userData.focusParts = new Set();
const bodySpecs = [
{
bodyPosition: [0, 0, 0],
bodyScale: [0.68, 0.5, 0.48],
headPosition: [0.47, 0.04, 0],
headScale: [0.55, 0.43, 0.46],
eyeSize: 0.12,
bulge: false
},
{
bodyPosition: [0, 0.01, 0],
bodyScale: [0.64, 0.47, 0.43],
headPosition: [0.46, 0.06, 0],
headScale: [0.55, 0.42, 0.44],
eyeSize: 0.13,
bulge: false
},
{
bodyPosition: [-0.03, 0, 0],
bodyScale: [0.69, 0.55, 0.51],
headPosition: [0.5, 0.08, 0],
headScale: [0.57, 0.45, 0.49],
eyeSize: 0.15,
bulge: false
},
{
bodyPosition: [-0.08, 0.01, 0],
bodyScale: [0.77, 0.64, 0.59],
headPosition: [0.56, 0.1, 0],
headScale: [0.59, 0.49, 0.55],
eyeSize: 0.18,
bulge: true
},
{
bodyPosition: [-0.1, 0.02, 0],
bodyScale: [0.73, 0.68, 0.62],
headPosition: [0.55, 0.12, 0],
headScale: [0.62, 0.52, 0.58],
eyeSize: 0.2,
bulge: true
}
];
const spec = bodySpecs[index];
addMesh(
group,
new THREE.IcosahedronGeometry(1, 1),
bodyMaterial,
spec.bodyPosition,
spec.bodyScale
);
addMesh(
group,
new THREE.IcosahedronGeometry(1, 1),
bodyMaterial,
spec.headPosition,
spec.headScale
);
addMesh(
group,
new THREE.IcosahedronGeometry(1, 1),
bellyMaterial,
[spec.bodyPosition[0] + 0.08, spec.bodyPosition[1] - spec.bodyScale[1] * 0.55, 0],
[spec.bodyScale[0] * 0.7, spec.bodyScale[1] * 0.24, spec.bodyScale[2] * 0.72]
);
addEyes(group, spec.headPosition, spec.headScale, spec.eyeSize, spec.bulge);
addMouth(group, spec.headPosition, spec.headScale);
const tail = makeTail(
group,
STAGES[index].tail,
index < 2 ? 0.28 : index === 2 ? 0.25 : 0.22,
tailMaterial
);
group.userData.tail = tail;
if (index === 1) {
for (const side of [-1, 1]) {
group.userData.limbs.push(addLimb(group, "hind", side, 0.55, true));
}
}
if (index === 2) {
for (const side of [-1, 1]) {
group.userData.limbs.push(addLimb(group, "hind", side, 0.72));
group.userData.limbs.push(addLimb(group, "front", side, 0.52, true));
}
}
if (index === 3) {
for (const side of [-1, 1]) {
group.userData.limbs.push(addLimb(group, "hind", side, 0.95));
group.userData.limbs.push(addLimb(group, "front", side, 0.78));
}
}
if (index === 4) {
for (const side of [-1, 1]) {
group.userData.limbs.push(addLimb(group, "hind", side, 1.14));
group.userData.limbs.push(addLimb(group, "front", side, 0.94));
}
}
const seen = new Set();
group.traverse((object) => {
if (object.isMesh && object.material && !seen.has(object.material)) {
seen.add(object.material);
group.userData.materials.push(object.material);
}
});
group.position.set(0, 1.08, 0);
group.rotation.y = -0.16;
group.scale.setScalar(1);
return group;
}
const models = STAGES.map((_, index) => {
const model = createStage(index);
model.visible = index === 0;
world.add(model);
return model;
});
// Gold focus rings used during developmental transitions.
const focusMaterial = new THREE.MeshBasicMaterial({
color: 0xf2c969,
transparent: true,
opacity: 0.75,
depthWrite: false
});
const focusRings = new THREE.Group();
focusRings.visible = false;
world.add(focusRings);
const ringA = addMesh(
focusRings,
new THREE.TorusGeometry(0.52, 0.018, 5, 48),
focusMaterial,
[0, 0, 0],
[1, 1, 1],
[Math.PI / 2, 0, 0]
);
ringA.castShadow = false;
const ringB = addMesh(
focusRings,
new THREE.TorusGeometry(0.36, 0.012, 5, 48),
focusMaterial,
[0, 0, 0]
);
ringB.castShadow = false;
const stageButtons = [...document.querySelectorAll(".stage-button")];
const range = document.getElementById("timeline-range");
const playButton = document.getElementById("play");
const playIcon = document.getElementById("play-icon");
const stageName = document.getElementById("stage-name");
const stageKicker = document.getElementById("stage-kicker");
const stageAge = document.getElementById("stage-age");
const stageDescription = document.getElementById("stage-description");
const focusText = document.getElementById("focus-text");
const annotation = document.getElementById("annotation");
const annotationKicker = document.getElementById("annotation-kicker");
const annotationTitle = document.getElementById("annotation-title");
let currentStage = 0;
let transition = null;
let playing = true;
let lastAdvance = performance.now() + 900;
let transitionDuration = 1.25;
const clock = new THREE.Clock();
function clamp01(v) {
return Math.max(0, Math.min(1, v));
}
function smoothstep(edge0, edge1, value) {
const x = clamp01((value - edge0) / (edge1 - edge0));
return x * x * (3 - 2 * x);
}
function easeOutBack(value) {
const c1 = 1.70158;
const c3 = c1 + 1;
return 1 + c3 * Math.pow(value - 1, 3) + c1 * Math.pow(value - 1, 2);
}
function setOpacity(model, opacity) {
model.visible = opacity > 0.001;
for (const material of model.userData.materials) {
material.opacity = opacity;
material.depthWrite = opacity > 0.88;
}
}
function resetHighlights(model) {
for (const material of model.userData.materials) {
material.emissiveIntensity = 0;
}
}
function setStableStage(index) {
models.forEach((model, modelIndex) => {
setOpacity(model, modelIndex === index ? 1 : 0);
model.scale.setScalar(1);
model.userData.tail.scale.set(1, 1, 1);
for (const limb of model.userData.limbs) {
limb.scale.set(1, 1, 1);
}
resetHighlights(model);
});
}
function updateStageUI(index, transitionTarget = null) {
const data = STAGES[index];
stageName.textContent = data.name;
stageKicker.textContent = data.kicker;
stageAge.textContent = data.age;
stageDescription.textContent = data.description;
stageButtons.forEach((button, buttonIndex) => {
button.classList.toggle("active", buttonIndex === index);
});
}
function setPlayIcon() {
if (playing) {
playIcon.innerHTML = '<path d="M3 2h3.5v12H3zm6.5 0H13v12H9.5z" />';
playButton.setAttribute("aria-label", "Pause autoplay");
} else {
playIcon.innerHTML = '<path d="M4 2.4v11.2L13 8z" />';
playButton.setAttribute("aria-label", "Play autoplay");
}
}
function requestStage(index) {
index = THREE.MathUtils.clamp(Math.round(index), 0, STAGES.length - 1);
if (index === currentStage || transition?.to === index) {
return;
}
transition = {
from: currentStage,
to: index,
t: 0,
duration: transitionDuration
};
updateStageUI(index);
lastAdvance = performance.now();
}
function restartSequence() {
transition = null;
currentStage = 0;
setStableStage(0);
updateStageUI(0);
playing = true;
lastAdvance = performance.now() + 500;
setPlayIcon();
}
playButton.addEventListener("click", () => {
if (currentStage === STAGES.length - 1 && !transition) {
restartSequence();
return;
}
playing = !playing;
if (playing) {
lastAdvance = performance.now();
}
setPlayIcon();
});
stageButtons.forEach((button) => {
button.addEventListener("click", () => {
requestStage(Number(button.dataset.stage));
});
});
range.addEventListener("input", () => {
const index = Math.round(Number(range.value) / 100);
requestStage(index);
});
window.addEventListener("keydown", (event) => {
if (event.target === range) {
return;
}
if (event.key === "ArrowRight") {
requestStage(currentStage + 1);
} else if (event.key === "ArrowLeft") {
requestStage(currentStage - 1);
} else if (event.code === "Space") {
event.preventDefault();
playButton.click();
}
});
function transitionFocus(toStage) {
if (toStage === 1) {
return {
title: "HIND-LIMB BUDS",
annotation: "First hind-limb buds",
localAnchor: [-0.42, 0.86, 0.48],
ringAnchor: [-0.38, 0.92, 0.4]
};
}
if (toStage === 2) {
return {
title: "HIND LIMBS GROW",
annotation: "Muscular hind legs unfold",
localAnchor: [-0.28, 0.82, 0.7],
ringAnchor: [-0.3, 0.82, 0.56]
};
}
if (toStage === 3) {
return {
title: "FORELIMBS EMERGE",
annotation: "Forelimbs complete the quartet",
localAnchor: [0.62, 0.86, 0.62],
ringAnchor: [0.55, 0.84, 0.5]
};
}
return {
title: "TAIL REDUCTION",
annotation: "The tail retreats toward the body",
localAnchor: [-1.05, 0.95, 0],
ringAnchor: [-0.95, 0.92, 0]
};
}
function updateTransition(delta) {
if (!transition) {
return;
}
transition.t = Math.min(1, transition.t + delta / transition.duration);
const t = transition.t;
const oldModel = models[transition.from];
const newModel = models[transition.to];
const oldOpacity = 1 - smoothstep(0.38, 0.87, t);
const newOpacity = smoothstep(0.14, 0.7, t);
setOpacity(oldModel, oldOpacity);
setOpacity(newModel, newOpacity);
newModel.scale.setScalar(0.88 + 0.12 * easeOutBack(smoothstep(0.04, 0.9, t)));
const oldTailLength = STAGES[transition.from].tail;
const newTailLength = STAGES[transition.to].tail;
const tailRatio = newTailLength / oldTailLength;
const tailReduction = smoothstep(0.02, 0.72, t);
oldModel.userData.tail.scale.x = THREE.MathUtils.lerp(1, tailRatio, tailReduction);
newModel.userData.tail.scale.x = 1;
const focus = transitionFocus(transition.to);
for (const material of oldModel.userData.materials) {
material.emissiveIntensity = 0;
}
for (const material of newModel.userData.materials) {
material.emissiveIntensity = 0;
}
const pulse = 0.5 + Math.sin(t * Math.PI * 8) * 0.22;
if (transition.to === 4) {
oldModel.userData.tailMaterial.emissive.setHex(0xf2c969);
oldModel.userData.tailMaterial.emissiveIntensity = pulse;
}
newModel.userData.limbs.forEach((limb, limbIndex) => {
const stagger = limbIndex % 2 === 0 ? 0 : 0.07;
const growth = 0.12 + 0.88 * easeOutBack(
smoothstep(0.12 + stagger, 0.88 + stagger, t)
);
limb.scale.setScalar(Math.max(0.05, growth));
const shouldHighlight =
transition.to <= 2
? limb.userData.limbType === "hind"
: transition.to === 3
? limb.userData.limbType === "front"
: true;
if (shouldHighlight) {
const material = limb.userData.limbType === "hind"
? newModel.userData.hindMaterial
: newModel.userData.frontMaterial;
material.emissive.setHex(0xf2c969);
material.emissiveIntensity = pulse * 0.85;
}
});
focusRings.visible = true;
const ringWorld = newModel.localToWorld(
new THREE.Vector3(...focus.ringAnchor)
);
focusRings.position.copy(ringWorld);
focusRings.scale.setScalar(0.92 + Math.sin(t * Math.PI) * 0.22);
focusRings.rotation.y += delta * 0.8;
focusMaterial.opacity = 0.48 + pulse * 0.25;
annotationKicker.textContent = focus.title;
annotationTitle.textContent = focus.annotation;
focusText.textContent = STAGES[transition.to].focus;
if (t >= 1) {
const finishedStage = transition.to;
currentStage = finishedStage;
transition = null;
setStableStage(currentStage);
updateStageUI(currentStage);
lastAdvance = performance.now();
if (currentStage === STAGES.length - 1) {
playing = false;
setPlayIcon();
}
}
}
const projected = new THREE.Vector3();
function positionAnnotation(localAnchor, isTransition) {
const model = models[transition ? transition.to : currentStage];
projected.copy(localAnchor);
model.localToWorld(projected);
projected.project(camera);
const x = (projected.x * 0.5 + 0.5) * window.innerWidth;
const y = (-projected.y * 0.5 + 0.5) * window.innerHeight;
const width = 190;
const leftSide = x > window.innerWidth * 0.65;
const clampedX = Math.max(
leftSide ? width + 18 : 18,
Math.min(
leftSide ? window.innerWidth - 20 : window.innerWidth - width - 18,
x + (leftSide ? -36 : 36)
)
);
const clampedY = Math.max(92, Math.min(window.innerHeight - 205, y - 18));
annotation.style.left = `${clampedX}px`;
annotation.style.top = `${clampedY}px`;
annotation.classList.toggle("left-side", leftSide);
annotation.style.opacity = projected.z < 1 ? "1" : "0";
if (!isTransition) {
annotationKicker.textContent = "Current morphology";
annotationTitle.textContent = STAGES[currentStage].annotation;
}
}
// Camera orbit and zoom implemented without external controls.
const cameraTarget = new THREE.Vector3(0, 0.95, 0);
let cameraRadius = 9.4;
let cameraTheta = 0.72;
let cameraPhi = 1.13;
let dragging = false;
let pointerX = 0;
let pointerY = 0;
function updateCamera() {
const sinPhi = Math.sin(cameraPhi);
camera.position.set(
cameraTarget.x + cameraRadius * sinPhi * Math.sin(cameraTheta),
cameraTarget.y + cameraRadius * Math.cos(cameraPhi),
cameraTarget.z + cameraRadius * sinPhi * Math.cos(cameraTheta)
);
camera.lookAt(cameraTarget);
}
renderer.domElement.addEventListener("pointerdown", (event) => {
dragging = true;
pointerX = event.clientX;
pointerY = event.clientY;
renderer.domElement.setPointerCapture(event.pointerId);
renderer.domElement.style.cursor = "grabbing";
});
renderer.domElement.addEventListener("pointermove", (event) => {
if (!dragging) {
return;
}
const dx = event.clientX - pointerX;
const dy = event.clientY - pointerY;
pointerX = event.clientX;
pointerY = event.clientY;
cameraTheta -= dx * 0.006;
cameraPhi = THREE.MathUtils.clamp(cameraPhi - dy * 0.005, 0.7, 1.42);
updateCamera();
});
function endDrag(event) {
dragging = false;
renderer.domElement.style.cursor = "grab";
if (renderer.domElement.hasPointerCapture(event.pointerId)) {
renderer.domElement.releasePointerCapture(event.pointerId);
}
}
renderer.domElement.addEventListener("pointerup", endDrag);
renderer.domElement.addEventListener("pointercancel", endDrag);
renderer.domElement.style.cursor = "grab";
renderer.domElement.addEventListener(
"wheel",
(event) => {
event.preventDefault();
cameraRadius = THREE.MathUtils.clamp(
cameraRadius + event.deltaY * 0.006,
6.1,
13.5
);
updateCamera();
},
{ passive: false }
);
function resize() {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
}
window.addEventListener("resize", resize);
updateCamera();
setStableStage(0);
updateStageUI(0);
setPlayIcon();
function animate() {
requestAnimationFrame(animate);
const delta = Math.min(clock.getDelta(), 0.05);
const elapsed = clock.elapsedTime;
const now = performance.now();
if (!transition && playing && currentStage < STAGES.length - 1) {
if (now - lastAdvance > 3200) {
requestStage(currentStage + 1);
}
}
updateTransition(delta);
models.forEach((model, index) => {
if (model.visible) {
model.position.y = 1.08 + Math.sin(elapsed * 1.55 + index * 0.4) * 0.018;
}
});
fireflies.forEach((firefly) => {
const phase = firefly.userData.phase;
firefly.position.y = firefly.userData.baseY + Math.sin(elapsed * 1.2 + phase) * 0.14;
firefly.material.opacity = 0.35 + (Math.sin(elapsed * 2.1 + phase) * 0.5 + 0.5) * 0.35;
});
if (!transition) {
focusRings.visible = false;
const model = models[currentStage];
positionAnnotation(
new THREE.Vector3(0.95, 0.42, 0.25),
false
);
} else {
const focus = transitionFocus(transition.to);
positionAnnotation(
new THREE.Vector3(...focus.localAnchor),
true
);
}
const progress = transition
? transition.from + transition.t
: currentStage;
const progressPercent = (progress / (STAGES.length - 1)) * 100;
range.style.setProperty("--progress", `${progressPercent}%`);
range.value = String(Math.round(progress * 100));
range.setAttribute(
"aria-valuetext",
`${STAGES[Math.round(progress)].name}, stage ${Math.round(progress) + 1} of 5`
);
renderer.render(scene, camera);
}
animate();
</script>
</body>
</html>
```