Prompt specification
Build or customize the Three.js 3D scene "Landscape change timeline museum" 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: Landscape change timeline museum
Category: Voxel Worlds · Style: Voxel 3D
License: MIT · Reference: https://three3d.app/scene/landscape-change-timeline-museum-x1211
Scene Description Prompt:
Please create one self-contained HTML file with Three.js from cdnjs showing climate timescales. Compose linked panels of daily shadows, seasonal foliage, glacier change, and mountain uplift; identify each illustrative timescale without presenting fabricated dates as measured history. Voxel style.
Working Three.js Starter (landscape-change-timeline-museum-x1211):
```html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="color-scheme" content="dark">
<title>Climate Timescales — Voxel Atlas</title>
<style>
:root {
--bg: #080d17;
--panel-border: rgba(222, 235, 255, 0.22);
--text: #edf4ff;
--muted: #9caac0;
--accent: #f5c75b;
--accent-2: #78d8c8;
--shadow: rgba(0, 0, 0, 0.42);
}
* {
box-sizing: border-box;
}
html,
body {
margin: 0;
min-height: 100%;
background:
radial-gradient(circle at 12% 0%, rgba(57, 91, 132, 0.23), transparent 34rem),
radial-gradient(circle at 92% 12%, rgba(80, 122, 99, 0.16), transparent 32rem),
var(--bg);
color: var(--text);
font-family:
Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
"Segoe UI", sans-serif;
}
body {
padding: 28px;
}
button,
input {
font: inherit;
}
button {
color: inherit;
}
.shell {
width: min(1500px, 100%);
margin: 0 auto;
}
.masthead {
display: grid;
grid-template-columns: 1fr auto;
gap: 24px;
align-items: end;
margin-bottom: 22px;
}
.eyebrow,
.panel-kicker,
.control-label,
.scale-button span,
.micro-label {
font-size: 0.68rem;
font-weight: 800;
letter-spacing: 0.15em;
text-transform: uppercase;
}
.eyebrow {
color: var(--accent);
margin-bottom: 9px;
}
h1 {
margin: 0;
max-width: 900px;
font-size: clamp(2.1rem, 5vw, 4.8rem);
line-height: 0.95;
letter-spacing: -0.065em;
}
.intro {
max-width: 720px;
margin: 15px 0 0;
color: var(--muted);
font-size: 0.98rem;
line-height: 1.6;
}
.concept-note {
max-width: 285px;
padding: 14px 16px;
border: 1px solid rgba(245, 199, 91, 0.34);
border-radius: 14px;
background: rgba(245, 199, 91, 0.07);
color: #f7df9c;
font-size: 0.78rem;
line-height: 1.45;
}
.concept-note strong {
display: block;
margin-bottom: 4px;
color: #fff2c9;
letter-spacing: 0.08em;
text-transform: uppercase;
font-size: 0.67rem;
}
.control-deck {
display: grid;
grid-template-columns: auto minmax(260px, 1fr) auto;
gap: 22px;
align-items: center;
margin-bottom: 14px;
padding: 15px 17px;
border: 1px solid rgba(218, 231, 255, 0.14);
border-radius: 17px;
background: rgba(16, 24, 39, 0.8);
box-shadow: 0 18px 45px var(--shadow);
backdrop-filter: blur(14px);
}
.transport {
display: flex;
gap: 8px;
}
.control-button {
min-height: 40px;
padding: 0 15px;
border: 1px solid rgba(219, 232, 255, 0.19);
border-radius: 10px;
background: rgba(255, 255, 255, 0.055);
cursor: pointer;
transition: background 160ms ease, transform 160ms ease;
}
.control-button:hover {
background: rgba(255, 255, 255, 0.1);
}
.control-button:active {
transform: translateY(1px);
}
.control-button.primary {
min-width: 91px;
border-color: rgba(245, 199, 91, 0.55);
background: var(--accent);
color: #201a0d;
font-weight: 850;
}
.slider-block {
min-width: 0;
}
.slider-heading {
display: flex;
justify-content: space-between;
gap: 16px;
align-items: center;
margin-bottom: 8px;
}
.control-label {
color: #cdd8e8;
}
#phase-value {
color: var(--accent);
font-variant-numeric: tabular-nums;
}
input[type="range"] {
width: 100%;
height: 5px;
margin: 0;
border-radius: 999px;
outline: none;
background:
linear-gradient(
90deg,
var(--accent) 0 var(--fill, 18%),
rgba(255, 255, 255, 0.13) var(--fill, 18%) 100%
);
appearance: none;
cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
width: 18px;
height: 18px;
border: 3px solid #151b28;
border-radius: 50%;
background: #ffe39a;
box-shadow: 0 0 0 1px rgba(255, 227, 154, 0.45);
appearance: none;
}
input[type="range"]::-moz-range-thumb {
width: 14px;
height: 14px;
border: 3px solid #151b28;
border-radius: 50%;
background: #ffe39a;
box-shadow: 0 0 0 1px rgba(255, 227, 154, 0.45);
}
.linked-label {
max-width: 220px;
color: var(--muted);
font-size: 0.76rem;
line-height: 1.4;
text-align: right;
}
.scale-map {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 9px;
margin-bottom: 14px;
}
.scale-button {
display: flex;
justify-content: space-between;
align-items: center;
gap: 12px;
min-height: 49px;
padding: 10px 13px;
border: 1px solid rgba(218, 231, 255, 0.12);
border-radius: 11px;
background: rgba(14, 21, 34, 0.66);
text-align: left;
cursor: pointer;
transition: border-color 160ms ease, background 160ms ease;
}
.scale-button:hover {
border-color: rgba(245, 199, 91, 0.45);
background: rgba(245, 199, 91, 0.07);
}
.scale-button b {
display: block;
margin-bottom: 3px;
font-size: 0.82rem;
}
.scale-button span {
color: var(--muted);
font-size: 0.56rem;
}
.scale-index {
color: var(--accent);
font: 800 0.8rem/1 ui-monospace, SFMono-Regular, Menlo, monospace;
}
#stage {
position: relative;
width: 100%;
isolation: isolate;
touch-action: none;
cursor: grab;
}
#stage.dragging {
cursor: grabbing;
}
#webgl {
position: absolute;
inset: 0;
z-index: 0;
display: block;
width: 100%;
height: 100%;
border-radius: 20px;
}
.panel-grid {
position: relative;
z-index: 2;
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 16px;
pointer-events: none;
}
.scene-panel {
position: relative;
min-height: 350px;
overflow: hidden;
border: 1px solid var(--panel-border);
border-radius: 19px;
box-shadow:
inset 0 0 0 1px rgba(255, 255, 255, 0.025),
0 18px 42px rgba(0, 0, 0, 0.25);
}
.scene-panel::after {
content: "";
position: absolute;
inset: 0;
border-radius: inherit;
background:
linear-gradient(180deg, rgba(4, 9, 17, 0.48), transparent 31%),
linear-gradient(0deg, rgba(4, 9, 17, 0.63), transparent 32%);
pointer-events: none;
}
.panel-head,
.panel-foot {
position: absolute;
z-index: 2;
left: 16px;
right: 16px;
}
.panel-head {
top: 15px;
display: flex;
justify-content: space-between;
gap: 16px;
align-items: flex-start;
}
.panel-kicker {
margin-bottom: 5px;
color: rgba(255, 255, 255, 0.72);
font-size: 0.58rem;
}
.panel-head h2 {
margin: 0;
font-size: clamp(1.05rem, 2vw, 1.42rem);
letter-spacing: -0.035em;
text-shadow: 0 2px 15px rgba(0, 0, 0, 0.48);
}
.timescale-badge {
flex: none;
padding: 7px 9px;
border: 1px solid rgba(255, 255, 255, 0.19);
border-radius: 8px;
background: rgba(7, 13, 23, 0.63);
color: #fff0b6;
font: 750 0.62rem/1.15 ui-monospace, SFMono-Regular, Menlo, monospace;
text-align: right;
text-transform: uppercase;
}
.panel-copy {
position: absolute;
z-index: 2;
top: 78px;
left: 17px;
max-width: 230px;
margin: 0;
color: rgba(238, 245, 255, 0.76);
font-size: 0.72rem;
line-height: 1.45;
text-shadow: 0 2px 10px rgba(0, 0, 0, 0.65);
}
.panel-foot {
bottom: 14px;
display: grid;
grid-template-columns: 1fr auto;
gap: 12px;
align-items: end;
}
.panel-state {
display: block;
margin-bottom: 7px;
font-size: 0.74rem;
font-weight: 760;
text-shadow: 0 2px 10px rgba(0, 0, 0, 0.7);
}
.panel-progress {
width: 185px;
max-width: 34vw;
height: 3px;
overflow: hidden;
border-radius: 99px;
background: rgba(255, 255, 255, 0.17);
}
.panel-progress span {
display: block;
width: 0;
height: 100%;
background: #ffe294;
box-shadow: 0 0 9px rgba(255, 226, 148, 0.6);
}
.page-foot {
display: flex;
justify-content: space-between;
gap: 24px;
margin-top: 14px;
color: var(--muted);
font-size: 0.73rem;
line-height: 1.5;
}
.page-foot p {
margin: 0;
}
.instructions {
text-align: right;
}
@media (max-width: 900px) {
body {
padding: 17px;
}
.masthead {
grid-template-columns: 1fr;
}
.concept-note {
max-width: none;
}
.control-deck {
grid-template-columns: 1fr;
gap: 13px;
}
.linked-label {
max-width: none;
text-align: left;
}
.scale-map {
grid-template-columns: repeat(2, 1fr);
}
.panel-grid {
grid-template-columns: 1fr;
}
.scene-panel {
min-height: 330px;
}
.page-foot {
display: block;
}
.instructions {
margin-top: 7px !important;
text-align: left;
}
}
@media (max-width: 520px) {
.scale-map {
grid-template-columns: 1fr;
}
.scale-button {
min-height: 44px;
}
.panel-copy {
max-width: 190px;
}
.panel-head {
gap: 8px;
}
.timescale-badge {
max-width: 100px;
}
}
@media (prefers-reduced-motion: reduce) {
* {
scroll-behavior: auto !important;
transition: none !important;
}
}
</style>
</head>
<body>
<main class="shell">
<header class="masthead">
<div>
<div class="eyebrow">Voxel Atlas / Relative Climate Clocks</div>
<h1>One linked phase.<br>Four very different times.</h1>
<p class="intro">
Move the shared phase to compare daily light, an annual biological cycle,
glacier response, and mountain-building deep time. Each panel maps the
same normalized progress onto its own illustrative timescale.
</p>
</div>
<aside class="concept-note">
<strong>Conceptual, not historical</strong>
These voxel stages are explanatory models. They do not depict measured
reconstructions and do not imply calendar dates.
</aside>
</header>
<section class="control-deck" aria-label="Timeline controls">
<div class="transport">
<button class="control-button primary" id="play-button" type="button">
Pause
</button>
<button class="control-button" id="reset-button" type="button">
Reset views
</button>
</div>
<div class="slider-block">
<div class="slider-heading">
<label class="control-label" for="phase">
Linked illustrative phase
</label>
<span id="phase-value">18%</span>
</div>
<input
id="phase"
type="range"
min="0"
max="1"
step="0.001"
value="0.18"
aria-describedby="phase-description"
>
<span id="phase-description" hidden>
The normalized phase advances every panel, but each panel represents a
different conceptual timescale.
</span>
</div>
<div class="linked-label">
A full sweep is one daily, annual, long-response, or deep-time concept
in each panel—not one shared duration.
</div>
</section>
<nav class="scale-map" aria-label="Jump to illustrative phase">
<button class="scale-button" type="button" data-phase="0.12">
<span><b>Solar sweep</b><span>Daily light / low to high</span></span>
<span class="scale-index">01</span>
</button>
<button class="scale-button" type="button" data-phase="0.34">
<span><b>Canopy cycle</b><span>Seasonal growth and color</span></span>
<span class="scale-index">02</span>
</button>
<button class="scale-button" type="button" data-phase="0.68">
<span><b>Ice response</b><span>Conceptual thinning and retreat</span></span>
<span class="scale-index">03</span>
</button>
<button class="scale-button" type="button" data-phase="0.84">
<span><b>Deep time</b><span>Illustrative mountain uplift</span></span>
<span class="scale-index">04</span>
</button>
</nav>
<section id="stage" aria-label="Interactive voxel climate panels">
<canvas id="webgl" aria-hidden="true"></canvas>
<div class="panel-grid">
<article class="scene-panel" data-panel="0">
<div class="panel-head">
<div>
<div class="panel-kicker">Panel 01 / Illumination</div>
<h2>Daily shadows</h2>
</div>
<div class="timescale-badge">One solar day</div>
</div>
<p class="panel-copy">
A fixed block landscape under a moving light source. Shadow length
and direction illustrate the daily solar cycle.
</p>
<div class="panel-foot">
<div>
<span class="panel-state">Morning light</span>
<div class="panel-progress"><span></span></div>
</div>
</div>
</article>
<article class="scene-panel" data-panel="1">
<div class="panel-head">
<div>
<div class="panel-kicker">Panel 02 / Biology</div>
<h2>Seasonal foliage</h2>
</div>
<div class="timescale-badge">One annual cycle</div>
</div>
<p class="panel-copy">
Voxel trees progress through leaf emergence, full canopy, autumn
color, and a sparse winter state.
</p>
<div class="panel-foot">
<div>
<span class="panel-state">Early growth</span>
<div class="panel-progress"><span></span></div>
</div>
</div>
</article>
<article class="scene-panel" data-panel="2">
<div class="panel-head">
<div>
<div class="panel-kicker">Panel 03 / Cryosphere</div>
<h2>Glacier change</h2>
</div>
<div class="timescale-badge">Years → decades</div>
</div>
<p class="panel-copy">
A schematic ice reservoir thins and contracts while meltwater expands.
It is not a measured glacier or reconstruction.
</p>
<div class="panel-foot">
<div>
<span class="panel-state">Ice present</span>
<div class="panel-progress"><span></span></div>
</div>
</div>
</article>
<article class="scene-panel" data-panel="3">
<div class="panel-head">
<div>
<div class="panel-kicker">Panel 04 / Geology</div>
<h2>Mountain uplift</h2>
</div>
<div class="timescale-badge">Millions of years</div>
</div>
<p class="panel-copy">
Voxel columns gain relief to symbolize tectonic uplift over deep time.
Colors mark schematic elevation zones, not dated rock layers.
</p>
<div class="panel-foot">
<div>
<span class="panel-state">Low relief</span>
<div class="panel-progress"><span></span></div>
</div>
</div>
</article>
</div>
</section>
<footer class="page-foot">
<p>
Visual model only: no historical dates, measured extents, rates, or
site-specific observations are represented.
</p>
<p class="instructions">
Drag a panel to orbit · Scroll to zoom · Double-click a panel to reset it
</p>
</footer>
</main>
<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.querySelector("#stage");
const canvas = document.querySelector("#webgl");
const panelElements = [...document.querySelectorAll(".scene-panel")];
const phaseInput = document.querySelector("#phase");
const phaseValue = document.querySelector("#phase-value");
const playButton = document.querySelector("#play-button");
const resetButton = document.querySelector("#reset-button");
const scaleButtons = [...document.querySelectorAll(".scale-button")];
const renderer = new THREE.WebGLRenderer({
canvas,
antialias: true,
alpha: false,
powerPreference: "high-performance"
});
renderer.setPixelRatio(Math.min(window.devicePixelRatio || 1, 2));
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1.08;
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
const cubeGeometry = new THREE.BoxGeometry(1, 1, 1);
const reducedMotion = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
let phase = 0.18;
let playing = !reducedMotion;
let drag = null;
let previousTime = performance.now();
const clamp = THREE.MathUtils.clamp;
const lerp = THREE.MathUtils.lerp;
function standardMaterial(color, options = {}) {
return new THREE.MeshStandardMaterial({
color,
roughness: 0.88,
metalness: 0,
...options
});
}
function addBox(parent, sx, sy, sz, x, y, z, material, shadows = true) {
const mesh = new THREE.Mesh(cubeGeometry, material);
mesh.scale.set(sx, sy, sz);
mesh.position.set(x, y, z);
mesh.castShadow = shadows;
mesh.receiveShadow = shadows;
parent.add(mesh);
return mesh;
}
function addLights(scene, lightColor = 0xfff1d2) {
const hemisphere = new THREE.HemisphereLight(0xe9f3ff, 0x4f5946, 1.55);
scene.add(hemisphere);
const key = new THREE.DirectionalLight(lightColor, 2.35);
key.position.set(5, 9, 6);
key.castShadow = true;
key.shadow.mapSize.set(1024, 1024);
key.shadow.camera.left = -10;
key.shadow.camera.right = 10;
key.shadow.camera.top = 10;
key.shadow.camera.bottom = -10;
key.shadow.camera.near = 0.5;
key.shadow.camera.far = 35;
key.shadow.bias = -0.0004;
key.shadow.normalBias = 0.025;
scene.add(key);
scene.add(key.target);
return key;
}
function makeCamera(target, distance, yaw, pitch) {
const camera = new THREE.PerspectiveCamera(39, 1, 0.1, 80);
const state = {
camera,
target: new THREE.Vector3(...target),
distance,
yaw,
pitch,
defaultDistance: distance,
defaultYaw: yaw,
defaultPitch: pitch
};
applyCamera(state);
return state;
}
function applyCamera(state) {
const { camera, target, distance, yaw, pitch } = state;
const horizontal = Math.cos(pitch);
camera.position.set(
target.x + distance * horizontal * Math.sin(yaw),
target.y + distance * Math.sin(pitch),
target.z + distance * horizontal * Math.cos(yaw)
);
camera.lookAt(target);
}
function resetCamera(state) {
state.distance = state.defaultDistance;
state.yaw = state.defaultYaw;
state.pitch = state.defaultPitch;
applyCamera(state);
}
/* ------------------------------------------------------------------
Panel 1: daily shadows
------------------------------------------------------------------ */
function createDailyPanel() {
const scene = new THREE.Scene();
scene.background = new THREE.Color(0x9fbdd0);
scene.fog = new THREE.Fog(0x9fbdd0, 18, 34);
const camera = makeCamera([0, 1.8, 0], 15.2, 0.58, 0.38);
const sunLight = addLights(scene, 0xffe1a5);
const grass = standardMaterial(0x6e8b63);
const stone = standardMaterial(0x8a8172);
const wall = standardMaterial(0xd6c4a4);
const roof = standardMaterial(0x66504a);
const trunk = standardMaterial(0x59483b);
const leaves = standardMaterial(0x4d754e);
const pathMaterial = standardMaterial(0xb4a88d);
addBox(scene, 14, 0.55, 10, 0, -0.275, 0, grass);
addBox(scene, 3.2, 0.06, 8.5, 0.5, 0.025, 0.2, pathMaterial, false);
addBox(scene, 2.4, 0.55, 2.2, -4.8, 0.275, -2.4, stone);
addBox(scene, 2.4, 0.55, 2.2, -4.8, 0.825, -2.4, stone);
addBox(scene, 2.1, 0.35, 1.9, 4.7, 0.175, -2.7, stone);
addBox(scene, 2.05, 1.8, 1.8, 0, 0.9, -0.6, wall);
addBox(scene, 2.35, 0.34, 2.1, 0, 1.95, -0.6, roof);
addBox(scene, 0.55, 0.9, 0.08, 0, 0.45, 0.33, roof);
addBox(scene, 0.55, 0.55, 0.08, -0.62, 1.16, 0.33, roof);
const treeLocations = [
[-2.9, 1.8, 0.9],
[3.0, 1.4, 1.1],
[2.8, -2.7, 0.75],
[-5.2, 0.2, 0.85]
];
for (const [x, z, s] of treeLocations) {
addBox(scene, 0.3 * s, 1.25 * s, 0.3 * s, x, 0.625 * s, z, trunk);
addBox(scene, 1.15 * s, 1.0 * s, 1.15 * s, x, 1.55 * s, z, leaves);
addBox(scene, 0.78 * s, 0.78 * s, 0.78 * s, x + 0.35 * s, 2.22 * s, z, leaves);
}
const arcMaterial = standardMaterial(0xf7e6ae, {
transparent: true,
opacity: 0.34,
depthWrite: false
});
for (let i = 0; i <= 18; i++) {
const t = i / 18;
const x = lerp(-6.5, 6.5, t);
const y = 1 + Math.sin(Math.PI * t) * 7;
addBox(scene, 0.07, 0.07, 0.07, x, y, -4.35, arcMaterial, false);
}
const sunMaterial = standardMaterial(0xffd05b, {
emissive: 0xff8b20,
emissiveIntensity: 1.4,
roughness: 0.3
});
const sun = addBox(scene, 0.72, 0.72, 0.72, -5, 3, -4.35, sunMaterial, false);
return {
scene,
camera,
sun,
sunLight,
update(p) {
const x = lerp(-6.5, 6.5, p);
const y = 1 + Math.sin(Math.PI * p) * 7;
sun.position.set(x, y, -4.35);
sunLight.position.set(x, y, -4.35);
sunLight.intensity = 0.65 + Math.sin(Math.PI * p) * 2.0;
}
};
}
/* ------------------------------------------------------------------
Panel 2: seasonal foliage
------------------------------------------------------------------ */
function createSeasonalPanel() {
const scene = new THREE.Scene();
scene.background = new THREE.Color(0xc6d3c5);
scene.fog = new THREE.Fog(0xc6d3c5, 17, 32);
const camera = makeCamera([0, 1.45, 0], 13.4, 0.62, 0.42);
addLights(scene, 0xfff0d1);
const groundMaterial = standardMaterial(0x789268);
const trunkMaterial = standardMaterial(0x604737);
const leafMaterial = standardMaterial(0x4d8a47);
const stoneMaterial = standardMaterial(0x9a9587);
addBox(scene, 14, 0.55, 10, 0, -0.275, 0, groundMaterial);
addBox(scene, 14.2, 0.16, 0.5, 0, -0.04, 4.0, stoneMaterial);
const leafRecords = [];
function addTree(x, z, scale = 1) {
addBox(
scene,
0.32 * scale,
1.45 * scale,
0.32 * scale,
x,
0.725 * scale,
z,
trunkMaterial
);
const parts = [
addBox(scene, 1.55 * scale, 1.25 * scale, 1.55 * scale, x, 1.85 * scale, z, leafMaterial),
addBox(scene, 0.95 * scale, 0.95 * scale, 0.95 * scale, x + 0.48 * scale, 2.68 * scale, z, leafMaterial),
addBox(scene, 0.78 * scale, 0.78 * scale, 0.78 * scale, x - 0.48 * scale, 2.47 * scale, z + 0.18, leafMaterial)
];
for (const mesh of parts) {
leafRecords.push({
mesh,
baseScale: mesh.scale.clone()
});
}
}
addTree(-4.3, -1.9, 1.05);
addTree(-1.8, 1.8, 0.9);
addTree(0.3, -0.7, 1.15);
addTree(3.8, 1.4, 0.95);
addTree(4.3, -2.4, 0.8);
for (const [x, z, s] of [[-2.8, 2.9, 0.55], [2.2, -3.0, 0.62]]) {
const shrub = addBox(scene, s, s * 0.7, s, x, s * 0.35, z, leafMaterial);
leafRecords.push({ mesh: shrub, baseScale: shrub.scale.clone() });
}
const spring = new THREE.Color(0xa4ca69);
const summer = new THREE.Color(0x3f7d44);
const late = new THREE.Color(0xd1c65e);
const autumn = new THREE.Color(0xc96c39);
const winter = new THREE.Color(0x71685c);
const groundGreen = new THREE.Color(0x789268);
const groundBrown = new THREE.Color(0x91836b);
const workingColor = new THREE.Color();
return {
scene,
camera,
update(p) {
if (p < 0.3) {
workingColor.lerpColors(spring, summer, p / 0.3);
} else if (p < 0.58) {
workingColor.lerpColors(summer, late, (p - 0.3) / 0.28);
} else if (p < 0.78) {
workingColor.lerpColors(late, autumn, (p - 0.58) / 0.2);
} else {
workingColor.lerpColors(autumn, winter, (p - 0.78) / 0.22);
}
leafMaterial.color.copy(workingColor);
const winterLoss = THREE.MathUtils.smoothstep(p, 0.72, 0.99);
const leafScale = lerp(1, 0.09, winterLoss);
for (const record of leafRecords) {
record.mesh.scale.copy(record.baseScale).multiplyScalar(leafScale);
}
groundMaterial.color.lerpColors(
groundGreen,
groundBrown,
THREE.MathUtils.smoothstep(p, 0.65, 1)
);
}
};
}
/* ------------------------------------------------------------------
Panel 3: glacier change
------------------------------------------------------------------ */
function createGlacierPanel() {
const scene = new THREE.Scene();
scene.background = new THREE.Color(0xb8d2dc);
scene.fog = new THREE.Fog(0xb8d2dc, 18, 34);
const camera = makeCamera([0, 1.0, 0], 14.3, 0.56, 0.47);
addLights(scene, 0xe9f6ff);
const bedMaterial = standardMaterial(0x77766d);
const iceMaterial = standardMaterial(0xd7f1f1, {
roughness: 0.48,
metalness: 0.02
});
const iceEdgeMaterial = standardMaterial(0x9fd5df);
const waterMaterial = standardMaterial(0x4ca7bc, {
transparent: true,
opacity: 0.46,
depthWrite: false,
roughness: 0.22
});
addBox(scene, 14, 0.55, 10, 0, -0.275, 0, bedMaterial);
addBox(scene, 8.4, 0.18, 6.6, 0, 0.09, -0.2, standardMaterial(0x8a877b));
const iceRecords = [];
for (let row = 0; row < 6; row++) {
for (let col = 0; col < 9; col++) {
const x = (col - 4) * 0.82;
const z = (row - 2.5) * 0.82;
const centerFactor = 1 - Math.abs(col - 4) / 7;
const height = 0.8 + centerFactor * 1.2 + Math.sin(col * 1.7 + row) * 0.13;
const width = 0.76;
const depth = 0.76;
const material = (row + col) % 4 === 0 ? iceEdgeMaterial : iceMaterial;
const mesh = addBox(
scene,
width,
height,
depth,
x,
0.18 + height / 2,
z,
material
);
iceRecords.push({
mesh,
basePosition: mesh.position.clone(),
baseScale: mesh.scale.clone(),
row
});
}
}
const meltwater = addBox(
scene,
2.6,
0.025,
0.65,
0,
0.055,
3.05,
waterMaterial,
false
);
for (const [x, z, s] of [[-5.4, 2.8, 0.45], [-4.6, 3.2, 0.32], [5.2, 2.6, 0.5]]) {
addBox(scene, s, s * 0.7, s, x, s * 0.35, z, standardMaterial(0x8b8c81));
}
return {
scene,
camera,
update(p) {
const response = THREE.MathUtils.smoothstep(p, 0.12, 0.94);
const remaining = 1 - response * 0.78;
for (const record of iceRecords) {
const width = record.baseScale.x * (0.68 + remaining * 0.32);
const height = Math.max(0.08, record.baseScale.y * remaining);
const depth = record.baseScale.z * (0.48 + remaining * 0.52);
record.mesh.scale.set(width, height, depth);
record.mesh.position.x = record.basePosition.x * (0.7 + remaining * 0.3);
record.mesh.position.z = record.basePosition.z * (0.56 + remaining * 0.44);
record.mesh.position.y = 0.18 + height / 2;
}
meltwater.scale.set(
2.4 + response * 4.0,
0.025,
0.5 + response * 1.5
);
meltwater.position.z = 2.85 + response * 0.35;
waterMaterial.opacity = 0.32 + response * 0.28;
}
};
}
/* ------------------------------------------------------------------
Panel 4: mountain uplift
------------------------------------------------------------------ */
function createMountainPanel() {
const scene = new THREE.Scene();
scene.background = new THREE.Color(0xc8bda9);
scene.fog = new THREE.Fog(0xc8bda9, 18, 35);
const camera = makeCamera([0, 2.15, 0], 16.2, 0.61, 0.46);
addLights(scene, 0xffe7c0);
const baseMaterial = standardMaterial(0x797966);
addBox(scene, 14, 0.55, 10, 0, -0.275, 0, baseMaterial);
const lowColor = new THREE.Color(0x727b59);
const earthColor = new THREE.Color(0x8a735d);
const rockColor = new THREE.Color(0x9b8c77);
const highColor = new THREE.Color(0xc4b7a4);
const snowColor = new THREE.Color(0xeaf0ed);
const workingColor = new THREE.Color();
const records = [];
for (let ix = 0; ix < 11; ix++) {
for (let iz = 0; iz < 11; iz++) {
const nx = (ix - 5) / 5;
const nz = (iz - 5) / 5;
const distance = Math.sqrt(nx * nx + nz * nz);
const profile = Math.max(0, 1 - distance);
const ridge = Math.max(0, 1 - Math.abs(nx * 0.55 + nz * 0.35));
const baseHeight = 0.2 + profile * 0.9 + ridge * 0.28;
const height = baseHeight;
const x = (ix - 5) * 0.87;
const z = (iz - 5) * 0.87;
const material = standardMaterial(earthColor);
const mesh = addBox(scene, 0.83, height, 0.83, x, height / 2, z, material);
records.push({
mesh,
material,
baseHeight,
profile,
x,
z
});
}
}
return {
scene,
camera,
update(p) {
const uplift = THREE.MathUtils.smoothstep(p, 0, 1) * 3.8;
for (const record of records) {
const height = record.baseHeight + uplift * record.profile;
const width = 0.83;
record.mesh.scale.set(width, height, width);
record.mesh.position.set(
record.x,
height / 2,
record.z
);
if (height > 4.25) {
workingColor.copy(snowColor);
} else if (height > 3.35) {
workingColor.lerpColors(highColor, snowColor, (height - 3.35) / 0.9);
} else if (height > 2.25) {
workingColor.lerpColors(rockColor, highColor, (height - 2.25) / 1.1);
} else if (height > 1.35) {
workingColor.lerpColors(earthColor, rockColor, (height - 1.35) / 0.9);
} else {
workingColor.lerpColors(lowColor, earthColor, height / 1.35);
}
record.material.color.copy(workingColor);
}
}
};
}
const panelDefinitions = [
createDailyPanel(),
createSeasonalPanel(),
createGlacierPanel(),
createMountainPanel()
];
const panels = panelDefinitions.map((definition, index) => ({
...definition,
element: panelElements[index],
stateElement: panelElements[index].querySelector(".panel-state"),
progressElement: panelElements[index].querySelector(".panel-progress span")
}));
const dailyState = (p) => {
if (p < 0.18) return "Low-angle dawn light";
if (p < 0.4) return "Morning shadows";
if (p < 0.58) return "High-sun illumination";
if (p < 0.82) return "Afternoon shadows";
return "Long dusk shadows";
};
const seasonalState = (p) => {
if (p < 0.2) return "Early leaf growth";
if (p < 0.48) return "Full summer canopy";
if (p < 0.7) return "Foliage color shifts";
if (p < 0.84) return "Autumn canopy";
return "Sparse winter canopy";
};
const glacierState = (p) => {
if (p < 0.28) return "Ice reservoir present";
if (p < 0.58) return "Conceptual thinning";
if (p < 0.82) return "Contracting ice cover";
return "Reduced ice and expanded meltwater";
};
const mountainState = (p) => {
if (p < 0.25) return "Low initial relief";
if (p < 0.58) return "Uplift raises central columns";
if (p < 0.82) return "Higher relief and exposed zones";
return "High-relief schematic mountain";
};
function updateAll() {
dailyPanel.update(phase);
seasonalPanel.update(phase);
glacierPanel.update(phase);
mountainPanel.update(phase);
panels[0].stateElement.textContent = dailyState(phase);
panels[1].stateElement.textContent = seasonalState(phase);
panels[2].stateElement.textContent = glacierState(phase);
panels[3].stateElement.textContent = mountainState(phase);
for (const panel of panels) {
panel.progressElement.style.width = `${phase * 100}%`;
}
phaseInput.value = phase.toFixed(3);
phaseInput.style.setProperty("--fill", `${phase * 100}%`);
phaseValue.textContent = `${Math.round(phase * 100)}%`;
phaseInput.setAttribute("aria-valuetext", `${Math.round(phase * 100)} percent illustrative phase`);
}
const dailyPanel = panels[0];
const seasonalPanel = panels[1];
const glacierPanel = panels[2];
const mountainPanel = panels[3];
function resizeRenderer() {
const width = Math.max(1, Math.floor(stage.clientWidth));
const height = Math.max(1, Math.floor(stage.clientHeight));
renderer.setSize(width, height, false);
}
const resizeObserver = new ResizeObserver(resizeRenderer);
resizeObserver.observe(stage);
resizeRenderer();
function renderPanelViews() {
const stageRect = stage.getBoundingClientRect();
renderer.setScissorTest(false);
renderer.setClearColor(0x080d17, 1);
renderer.clear();
renderer.setScissorTest(true);
for (const panel of panels) {
const rect = panel.element.getBoundingClientRect();
const x = Math.round(rect.left - stageRect.left);
const y = Math.round(stageRect.bottom - rect.bottom);
const width = Math.max(1, Math.round(rect.width));
const height = Math.max(1, Math.round(rect.height));
if (panel.camera.camera.aspect !== width / height) {
panel.camera.camera.aspect = width / height;
panel.camera.camera.updateProjectionMatrix();
}
renderer.setViewport(x, y, width, height);
renderer.setScissor(x, y, width, height);
renderer.setClearColor(panel.scene.background, 1);
renderer.clear(true, true, true);
renderer.render(panel.scene, panel.camera.camera);
}
renderer.setScissorTest(false);
}
function panelAt(clientX, clientY) {
for (let i = 0; i < panelElements.length; i++) {
const rect = panelElements[i].getBoundingClientRect();
if (
clientX >= rect.left &&
clientX <= rect.right &&
clientY >= rect.top &&
clientY <= rect.bottom
) {
return i;
}
}
return -1;
}
stage.addEventListener("pointerdown", (event) => {
const index = panelAt(event.clientX, event.clientY);
if (index < 0) return;
drag = {
index,
pointerId: event.pointerId,
lastX: event.clientX,
lastY: event.clientY
};
stage.setPointerCapture(event.pointerId);
stage.classList.add("dragging");
});
stage.addEventListener("pointermove", (event) => {
if (!drag || drag.pointerId !== event.pointerId) return;
const dx = event.clientX - drag.lastX;
const dy = event.clientY - drag.lastY;
const state = panels[drag.index].camera;
state.yaw -= dx * 0.006;
state.pitch = clamp(state.pitch + dy * 0.0045, 0.12, 1.08);
drag.lastX = event.clientX;
drag.lastY = event.clientY;
applyCamera(state);
});
function endDrag(event) {
if (!drag || drag.pointerId !== event.pointerId) return;
drag = null;
stage.classList.remove("dragging");
}
stage.addEventListener("pointerup", endDrag);
stage.addEventListener("pointercancel", endDrag);
stage.addEventListener(
"wheel",
(event) => {
const index = panelAt(event.clientX, event.clientY);
if (index < 0) return;
event.preventDefault();
const state = panels[index].camera;
state.distance = clamp(
state.distance + event.deltaY * 0.012,
state.defaultDistance * 0.58,
state.defaultDistance * 1.55
);
applyCamera(state);
},
{ passive: false }
);
stage.addEventListener("dblclick", (event) => {
const index = panelAt(event.clientX, event.clientY);
if (index >= 0) resetCamera(panels[index].camera);
});
function syncPlayButton() {
playButton.textContent = playing ? "Pause" : "Play";
playButton.setAttribute("aria-pressed", String(playing));
}
playButton.addEventListener("click", () => {
playing = !playing;
syncPlayButton();
});
resetButton.addEventListener("click", () => {
for (const panel of panels) resetCamera(panel.camera);
});
phaseInput.addEventListener("input", () => {
phase = Number(phaseInput.value);
playing = false;
syncPlayButton();
updateAll();
});
for (const button of scaleButtons) {
button.addEventListener("click", () => {
phase = Number(button.dataset.phase);
playing = false;
syncPlayButton();
updateAll();
});
}
function animate(now) {
const dt = Math.min(0.05, (now - previousTime) / 1000);
previousTime = now;
if (playing) {
phase = (phase + dt * 0.035) % 1;
}
updateAll();
renderPanelViews();
requestAnimationFrame(animate);
}
syncPlayButton();
updateAll();
requestAnimationFrame(animate);
</script>
</body>
</html>
```