Prompt specification
Build or customize the Three.js 3D scene "Timescale filtering climate exhibit" 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: Timescale filtering climate exhibit
Category: Space & Earth · Style: Procedural Solid / Shader 3D
License: MIT · Reference: https://three3d.app/scene/timescale-filtering-climate-exhibit-x1212
Scene Description Prompt:
Make a standalone HTML scene with Three.js from cdnjs that depicts climate timescales. Let viewers smooth a synthetic environmental signal over different windows; connect the plots to a small landscape and explain which variations become hidden or retained. Low-poly.
Working Three.js Starter (timescale-filtering-climate-exhibit-x1212):
```html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Climate Timescale Lab</title>
<style>
:root {
color-scheme: dark;
--bg: #081313;
--panel: rgba(15, 30, 30, 0.92);
--panel-2: rgba(20, 39, 38, 0.82);
--line: rgba(190, 221, 209, 0.13);
--line-strong: rgba(190, 221, 209, 0.25);
--text: #edf5ef;
--muted: #93aaa2;
--green: #72d1a4;
--green-2: #3e9b78;
--orange: #f3a65a;
--red: #ec7f70;
--blue: #78b9ca;
--radius: 18px;
}
* {
box-sizing: border-box;
}
html,
body {
width: 100%;
min-height: 100%;
margin: 0;
}
body {
overflow: hidden;
background:
radial-gradient(circle at 72% 8%, rgba(64, 123, 103, 0.18), transparent 34%),
radial-gradient(circle at 10% 90%, rgba(216, 145, 81, 0.08), transparent 30%),
var(--bg);
color: var(--text);
font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
"Segoe UI", sans-serif;
-webkit-font-smoothing: antialiased;
}
button,
input {
font: inherit;
}
button {
color: inherit;
}
.app {
height: 100vh;
display: flex;
flex-direction: column;
}
.topbar {
min-height: 96px;
padding: 20px 24px 14px;
display: flex;
align-items: center;
justify-content: space-between;
gap: 24px;
}
.brand {
display: flex;
align-items: center;
gap: 14px;
min-width: 0;
}
.brand-mark {
width: 44px;
height: 44px;
flex: 0 0 auto;
border: 1px solid var(--line-strong);
border-radius: 13px;
display: flex;
align-items: flex-end;
justify-content: center;
gap: 4px;
padding: 10px;
background: linear-gradient(145deg, rgba(114, 209, 164, 0.12), rgba(114, 209, 164, 0.02));
}
.brand-mark i {
display: block;
width: 4px;
border-radius: 3px 3px 1px 1px;
background: var(--green);
}
.brand-mark i:nth-child(1) {
height: 10px;
opacity: 0.45;
}
.brand-mark i:nth-child(2) {
height: 22px;
}
.brand-mark i:nth-child(3) {
height: 15px;
opacity: 0.7;
}
.eyebrow {
color: var(--green);
font-size: 10px;
font-weight: 750;
letter-spacing: 0.16em;
text-transform: uppercase;
}
h1 {
margin: 4px 0 3px;
font-size: clamp(21px, 2vw, 31px);
line-height: 1.08;
font-weight: 630;
letter-spacing: -0.035em;
}
.subtitle {
margin: 0;
color: var(--muted);
font-size: 12px;
line-height: 1.4;
}
.top-meta {
display: flex;
align-items: center;
gap: 9px;
flex: 0 0 auto;
}
.chip {
display: inline-flex;
align-items: center;
gap: 8px;
min-height: 31px;
padding: 0 11px;
border: 1px solid var(--line);
border-radius: 999px;
background: rgba(255, 255, 255, 0.025);
color: #c8d8d0;
font-size: 10px;
font-weight: 700;
letter-spacing: 0.1em;
text-transform: uppercase;
}
.chip-dot {
width: 6px;
height: 6px;
border-radius: 50%;
background: var(--green);
box-shadow: 0 0 0 4px rgba(114, 209, 164, 0.1);
}
.workspace {
min-height: 0;
flex: 1;
display: grid;
grid-template-columns: 270px minmax(460px, 1fr) 305px;
gap: 14px;
padding: 0 18px 18px;
}
.panel {
min-height: 0;
border: 1px solid var(--line);
border-radius: var(--radius);
background: var(--panel);
box-shadow: 0 18px 50px rgba(0, 0, 0, 0.18);
backdrop-filter: blur(16px);
}
.controls,
.insights {
overflow: auto;
scrollbar-width: thin;
scrollbar-color: rgba(114, 209, 164, 0.25) transparent;
}
.controls {
padding: 19px;
}
.section-title {
margin: 0 0 12px;
color: var(--muted);
font-size: 10px;
font-weight: 760;
letter-spacing: 0.15em;
text-transform: uppercase;
}
.window-readout {
display: flex;
align-items: baseline;
gap: 7px;
margin-top: 12px;
}
.window-readout output {
color: var(--green);
font-size: 35px;
font-weight: 650;
letter-spacing: -0.045em;
}
.window-readout span {
color: var(--muted);
font-size: 13px;
}
input[type="range"] {
width: 100%;
height: 5px;
margin: 19px 0 9px;
border-radius: 99px;
appearance: none;
background: linear-gradient(
90deg,
var(--green) 0%,
var(--green) 16.66%,
rgba(255, 255, 255, 0.11) 16.66%,
rgba(255, 255, 255, 0.11) 100%
);
cursor: pointer;
accent-color: var(--green);
}
input[type="range"]::-webkit-slider-thumb {
width: 17px;
height: 17px;
border: 3px solid #102522;
border-radius: 50%;
appearance: none;
background: #b9f2d7;
box-shadow: 0 0 0 1px rgba(114, 209, 164, 0.6);
}
input[type="range"]::-moz-range-thumb {
width: 13px;
height: 13px;
border: 3px solid #102522;
border-radius: 50%;
background: #b9f2d7;
box-shadow: 0 0 0 1px rgba(114, 209, 164, 0.6);
}
#yearRange {
background: linear-gradient(
90deg,
var(--orange) 0%,
var(--orange) 39%,
rgba(255, 255, 255, 0.11) 39%,
rgba(255, 255, 255, 0.11) 100%
);
}
#yearRange::-webkit-slider-thumb {
background: #ffd6aa;
box-shadow: 0 0 0 1px rgba(243, 166, 90, 0.65);
}
.range-ends {
display: flex;
justify-content: space-between;
color: #728a82;
font-size: 9px;
font-variant-numeric: tabular-nums;
}
.preset-row {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 6px;
margin-top: 15px;
}
.preset,
.quiet-button {
border: 1px solid var(--line);
border-radius: 10px;
background: rgba(255, 255, 255, 0.025);
color: #aec2ba;
cursor: pointer;
transition: 160ms ease;
}
.preset {
min-height: 34px;
font-size: 10px;
font-weight: 700;
}
.preset:hover,
.quiet-button:hover {
border-color: rgba(114, 209, 164, 0.38);
color: var(--text);
background: rgba(114, 209, 164, 0.07);
}
.preset.active {
border-color: rgba(114, 209, 164, 0.42);
color: var(--green);
background: rgba(114, 209, 164, 0.1);
}
.help {
margin: 11px 0 0;
color: #7f978f;
font-size: 10px;
line-height: 1.55;
}
.divider {
height: 1px;
margin: 19px 0;
background: var(--line);
}
.year-row {
display: flex;
align-items: baseline;
justify-content: space-between;
}
.year-row strong {
color: #ffd5a6;
font-size: 21px;
font-weight: 620;
font-variant-numeric: tabular-nums;
}
.signal-card {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 8px;
margin-top: 16px;
}
.signal-stat {
min-width: 0;
padding: 12px;
border: 1px solid var(--line);
border-radius: 12px;
background: rgba(255, 255, 255, 0.025);
}
.signal-stat span {
display: block;
margin-bottom: 5px;
color: #799087;
font-size: 9px;
font-weight: 750;
letter-spacing: 0.12em;
}
.signal-stat strong {
font-size: 19px;
font-weight: 620;
font-variant-numeric: tabular-nums;
}
.signal-stat.raw strong {
color: #b9c9c2;
}
.signal-stat.smooth strong {
color: var(--green);
}
.gap-row {
display: flex;
justify-content: space-between;
margin-top: 9px;
padding: 9px 11px;
border-radius: 9px;
background: rgba(243, 166, 90, 0.07);
color: #afbdb7;
font-size: 10px;
}
.gap-row b {
color: var(--orange);
font-variant-numeric: tabular-nums;
}
.quiet-button {
width: 100%;
min-height: 36px;
margin-top: 12px;
font-size: 10px;
font-weight: 700;
}
.method-note {
margin-top: 16px;
padding: 12px;
border-left: 2px solid rgba(114, 209, 164, 0.4);
background: rgba(114, 209, 164, 0.035);
color: #91a69e;
font-size: 10px;
line-height: 1.55;
}
.scene-column {
min-width: 0;
min-height: 0;
display: grid;
grid-template-rows: minmax(285px, 1fr) 220px;
gap: 14px;
}
.viewport {
position: relative;
min-height: 0;
overflow: hidden;
border: 1px solid rgba(210, 234, 225, 0.22);
border-radius: var(--radius);
background: #dbe8e2;
box-shadow: 0 18px 50px rgba(0, 0, 0, 0.2);
}
#threeRoot {
position: absolute;
inset: 0;
}
#threeRoot canvas {
display: block;
width: 100%;
height: 100%;
cursor: grab;
touch-action: none;
}
#threeRoot canvas:active {
cursor: grabbing;
}
.scene-heading {
position: absolute;
z-index: 2;
top: 15px;
left: 15px;
right: 15px;
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 12px;
pointer-events: none;
}
.scene-label {
padding: 10px 12px;
border: 1px solid rgba(24, 52, 47, 0.12);
border-radius: 11px;
background: rgba(241, 247, 242, 0.78);
color: #28463d;
backdrop-filter: blur(9px);
box-shadow: 0 8px 24px rgba(36, 67, 58, 0.08);
}
.scene-label small {
display: block;
margin-bottom: 3px;
color: #6d8179;
font-size: 8px;
font-weight: 800;
letter-spacing: 0.13em;
}
.scene-label strong {
display: block;
font-size: 12px;
font-weight: 750;
}
.scene-badge {
display: inline-flex;
align-items: center;
gap: 6px;
margin-top: 7px;
padding: 5px 7px;
border-radius: 999px;
background: rgba(36, 89, 70, 0.09);
color: #376c58;
font-size: 8px;
font-weight: 800;
letter-spacing: 0.08em;
}
.scene-badge.warm {
background: rgba(188, 105, 47, 0.12);
color: #9a5c2f;
}
.scene-badge.cool {
background: rgba(70, 124, 145, 0.12);
color: #416f80;
}
.scene-caption {
position: absolute;
z-index: 2;
left: 16px;
bottom: 15px;
max-width: min(410px, calc(100% - 32px));
padding: 10px 12px;
border-radius: 10px;
background: rgba(18, 41, 35, 0.78);
color: #d7e7df;
backdrop-filter: blur(8px);
pointer-events: none;
font-size: 10px;
line-height: 1.45;
}
.scene-caption b {
color: #aee8ca;
}
.orbit-hint {
position: absolute;
z-index: 2;
right: 15px;
bottom: 16px;
color: rgba(40, 70, 61, 0.68);
font-size: 8px;
font-weight: 800;
letter-spacing: 0.08em;
pointer-events: none;
}
.chart-panel {
padding: 13px 15px 9px;
overflow: hidden;
}
.chart-header {
min-height: 38px;
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 14px;
}
.chart-title {
display: flex;
align-items: baseline;
gap: 10px;
}
.chart-title .section-title {
margin: 0;
}
.chart-hint {
color: #6e857d;
font-size: 9px;
}
.legend {
display: flex;
align-items: center;
gap: 12px;
color: #9fb2aa;
font-size: 9px;
}
.legend-item {
display: flex;
align-items: center;
gap: 5px;
}
.legend-line {
width: 16px;
height: 2px;
background: #8da098;
}
.legend-line.smooth {
height: 3px;
background: var(--green);
}
.legend input {
width: 12px;
height: 12px;
margin: 0;
accent-color: var(--green);
}
#signalChart {
display: block;
width: 100%;
height: 163px;
overflow: visible;
cursor: crosshair;
touch-action: none;
}
#signalChart text {
font-family: inherit;
}
.chart-value {
color: var(--green);
font-weight: 700;
font-variant-numeric: tabular-nums;
}
.insights {
padding: 19px;
}
.scale-intro {
margin: -2px 0 13px;
color: #8ea49b;
font-size: 10px;
line-height: 1.5;
}
.retention-row {
padding: 11px 0 12px;
border-bottom: 1px solid var(--line);
}
.retention-top {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 8px;
}
.retention-top strong {
display: block;
color: #dce8e1;
font-size: 11px;
font-weight: 650;
}
.retention-top small {
display: block;
margin-top: 3px;
color: #728981;
font-size: 8px;
}
.retention-score {
flex: 0 0 auto;
text-align: right;
}
.retention-score b {
display: block;
color: #dbe7e0;
font-size: 12px;
font-variant-numeric: tabular-nums;
}
.retention-status {
display: block;
margin-top: 2px;
color: var(--green);
font-size: 7px;
font-weight: 850;
letter-spacing: 0.1em;
}
.retention-status.is-hidden {
color: var(--red);
}
.retention-status.is-softened {
color: var(--orange);
}
.retention-status.is-spread {
color: #ba9bd7;
}
.bar-track {
height: 3px;
margin-top: 9px;
overflow: hidden;
border-radius: 99px;
background: rgba(255, 255, 255, 0.07);
}
.bar-fill {
width: 100%;
height: 100%;
border-radius: inherit;
background: linear-gradient(90deg, var(--green-2), var(--green));
transition: width 220ms ease;
}
.bar-fill.is-hidden {
background: var(--red);
}
.bar-fill.is-softened {
background: linear-gradient(90deg, #b56c36, var(--orange));
}
.bar-fill.is-spread {
background: linear-gradient(90deg, #755797, #ba9bd7);
}
.verdict {
margin-top: 17px;
padding: 14px;
border: 1px solid rgba(114, 209, 164, 0.18);
border-radius: 13px;
background: linear-gradient(145deg, rgba(114, 209, 164, 0.09), rgba(114, 209, 164, 0.025));
}
.verdict h3 {
margin: 8px 0 7px;
font-size: 16px;
line-height: 1.25;
font-weight: 630;
letter-spacing: -0.02em;
}
.verdict p {
margin: 0;
color: #98aca4;
font-size: 10px;
line-height: 1.58;
}
.reading {
margin-top: 17px;
}
.reading p {
margin: 7px 0 0;
color: #91a69d;
font-size: 10px;
line-height: 1.55;
}
.reading b {
color: #d7e6de;
font-weight: 650;
}
.caveat {
margin: 16px 0 0;
padding-top: 13px;
border-top: 1px solid var(--line);
color: #70877f;
font-size: 9px;
line-height: 1.55;
}
@media (max-width: 1180px) {
body {
overflow: auto;
}
.app {
height: auto;
min-height: 100vh;
}
.workspace {
grid-template-columns: 255px minmax(0, 1fr);
align-items: stretch;
}
.scene-column {
min-height: 760px;
}
.insights {
grid-column: 1 / -1;
display: grid;
grid-template-columns: 1fr 1fr;
gap: 0 28px;
}
.insights > .section-title,
.insights > .scale-intro,
.insights > .caveat {
grid-column: 1 / -1;
}
}
@media (max-width: 760px) {
.topbar {
align-items: flex-start;
padding: 17px 14px 12px;
}
.brand-mark {
width: 38px;
height: 38px;
}
.subtitle,
.top-meta {
display: none;
}
.workspace {
display: flex;
flex-direction: column;
padding: 0 10px 12px;
}
.controls,
.scene-column,
.insights {
width: 100%;
}
.scene-column {
min-height: 740px;
}
.insights {
display: block;
}
.chart-hint,
.orbit-hint {
display: none;
}
.legend {
gap: 7px;
}
.scene-caption {
right: 12px;
max-width: none;
}
}
</style>
</head>
<body>
<div class="app">
<header class="topbar">
<div class="brand">
<div class="brand-mark" aria-hidden="true">
<i></i><i></i><i></i>
</div>
<div>
<div class="eyebrow">Climate / Signal Lab</div>
<h1>What does a longer window forget?</h1>
<p class="subtitle">
Smooth one synthetic climate record and watch its scales emerge or disappear.
</p>
</div>
</div>
<div class="top-meta">
<span class="chip">
<span class="chip-dot"></span>
Synthetic record · 1900–2100
</span>
</div>
</header>
<main class="workspace">
<aside class="panel controls">
<div class="section-title">01 / Smoothing window</div>
<div class="window-readout">
<output id="windowLabel" for="windowRange">±10</output>
<span>years</span>
</div>
<input
id="windowRange"
type="range"
min="0"
max="60"
value="10"
step="1"
aria-label="Smoothing window radius in years"
>
<div class="range-ends">
<span>RAW</span>
<span>15</span>
<span>30</span>
<span>45</span>
<span>60 Y</span>
</div>
<div class="preset-row" aria-label="Smoothing presets">
<button class="preset" type="button" data-window="0">Raw</button>
<button class="preset active" type="button" data-window="10">±10 y</button>
<button class="preset" type="button" data-window="50">±50 y</button>
</div>
<p class="help" id="windowSamples">
A 21-year centered box mean, calculated from 241 monthly samples.
</p>
<div class="divider"></div>
<div class="section-title">02 / Inspect a year</div>
<div class="year-row">
<strong id="yearValue">1978</strong>
<span class="eyebrow">Selected</span>
</div>
<input
id="yearRange"
type="range"
min="1900"
max="2100"
value="1978"
step="1"
aria-label="Selected year"
>
<div class="range-ends">
<span>1900</span>
<span>1950</span>
<span>2000</span>
<span>2050</span>
<span>2100</span>
</div>
<div class="signal-card">
<div class="signal-stat raw">
<span>RAW INDEX</span>
<strong id="rawNow">+0.00</strong>
</div>
<div class="signal-stat smooth">
<span>SMOOTHED</span>
<strong id="smoothNow">+0.00</strong>
</div>
</div>
<div class="gap-row">
<span>Mean minus point value</span>
<b id="gapNow">+0.00</b>
</div>
<button id="resetCamera" class="quiet-button" type="button">
Reset landscape camera
</button>
<div class="method-note">
<strong>Method.</strong> The moving mean changes emphasis, not the underlying
record. The chart and landscape use the same selected year and the same
filtered value.
</div>
</aside>
<section class="scene-column">
<div class="viewport" id="viewport">
<div id="threeRoot"></div>
<div class="scene-heading">
<div class="scene-label">
<small>03 / Local landscape response</small>
<strong>Filtered climate state</strong>
<span class="scene-badge" id="climateState">
<span>●</span>
<span id="climateStateText">BALANCED</span>
</span>
</div>
<div class="scene-label">
<small>Selected signal</small>
<strong id="climateBadge">+0.00 index</strong>
</div>
</div>
<div class="scene-caption">
<b id="landscapeEffect">Near-baseline moisture and vegetation.</b><br>
Conceptual terrain response · not a forecast
</div>
<div class="orbit-hint">DRAG TO ORBIT · SCROLL TO ZOOM</div>
</div>
<div class="panel chart-panel">
<div class="chart-header">
<div>
<div class="chart-title">
<div class="section-title">Signal timeline</div>
<span class="chart-hint">Click or drag to scrub</span>
</div>
<div class="chart-hint">Shaded region = selected smoothing window</div>
</div>
<div class="legend">
<label class="legend-item">
<input id="rawToggle" type="checkbox" checked>
<span>Raw</span>
</label>
<span class="legend-item">
<span class="legend-line"></span>
Raw
</span>
<span class="legend-item">
<span class="legend-line smooth"></span>
Smoothed
</span>
<span class="chart-value" id="chartSmoothValue">+0.00</span>
</div>
</div>
<svg
id="signalChart"
viewBox="0 0 900 190"
role="img"
aria-label="Raw and smoothed synthetic climate signal from 1900 to 2100"
>
<defs>
<linearGradient id="smoothAreaGradient" x1="0" y1="0" x2="0" y2="1">
<stop offset="0%" stop-color="#72d1a4" stop-opacity="0.22"></stop>
<stop offset="100%" stop-color="#72d1a4" stop-opacity="0"></stop>
</linearGradient>
<clipPath id="plotClip">
<rect x="38" y="8" width="846" height="148"></rect>
</clipPath>
</defs>
<g id="gridLayer"></g>
<rect
id="windowBand"
x="0"
y="8"
width="0"
height="148"
rx="5"
fill="#72d1a4"
fill-opacity="0.09"
stroke="#72d1a4"
stroke-opacity="0.24"
></rect>
<path
id="smoothArea"
fill="url(#smoothAreaGradient)"
clip-path="url(#plotClip)"
></path>
<path
id="rawPath"
fill="none"
stroke="#8da098"
stroke-opacity="0.5"
stroke-width="1"
vector-effect="non-scaling-stroke"
clip-path="url(#plotClip)"
></path>
<path
id="smoothPath"
fill="none"
stroke="#72d1a4"
stroke-width="2.5"
vector-effect="non-scaling-stroke"
clip-path="url(#plotClip)"
></path>
<line
id="yearLine"
x1="0"
x2="0"
y1="8"
y2="156"
stroke="#f3a65a"
stroke-width="1"
stroke-dasharray="4 4"
vector-effect="non-scaling-stroke"
></line>
<circle
id="rawDot"
cx="0"
cy="0"
r="3.5"
fill="#aab8b2"
stroke="#162a26"
stroke-width="2"
vector-effect="non-scaling-stroke"
></circle>
<circle
id="smoothDot"
cx="0"
cy="0"
r="4.5"
fill="#72d1a4"
stroke="#10251f"
stroke-width="2"
vector-effect="non-scaling-stroke"
></circle>
<text
id="bandLabel"
x="0"
y="24"
text-anchor="middle"
fill="#9acdb5"
font-size="9"
font-weight="700"
></text>
</svg>
</div>
</section>
<aside class="panel insights">
<div class="section-title">04 / What survives?</div>
<p class="scale-intro">
Estimated amplitude retained by the centered mean. A band can be flattened,
spread across time, or retained as a distinct shape.
</p>
<div class="retention-row">
<div class="retention-top">
<div>
<strong>Annual cycle</strong>
<small>1 year · raw amplitude ±0.28</small>
</div>
<div class="retention-score">
<b id="annualGain">100%</b>
<span class="retention-status" id="annualStatus">RETAINED</span>
</div>
</div>
<div class="bar-track"><div class="bar-fill" id="annualBar"></div></div>
</div>
<div class="retention-row">
<div class="retention-top">
<div>
<strong>Decadal variation</strong>
<small>18 years · raw amplitude ±0.22</small>
</div>
<div class="retention-score">
<b id="decadalGain">100%</b>
<span class="retention-status" id="decadalStatus">RETAINED</span>
</div>
</div>
<div class="bar-track"><div class="bar-fill" id="decadalBar"></div></div>
</div>
<div class="retention-row">
<div class="retention-top">
<div>
<strong>Centennial cycle</strong>
<small>80 years · raw amplitude ±0.16</small>
</div>
<div class="retention-score">
<b id="centuryGain">100%</b>
<span class="retention-status" id="centuryStatus">RETAINED</span>
</div>
</div>
<div class="bar-track"><div class="bar-fill" id="centuryBar"></div></div>
</div>
<div class="retention-row">
<div class="retention-top">
<div>
<strong>Abrupt event</strong>
<small>4–6 year pulse · peak 0.38</small>
</div>
<div class="retention-score">
<b id="pulseGain">100%</b>
<span class="retention-status" id="pulseStatus">RETAINED</span>
</div>
</div>
<div class="bar-track"><div class="bar-fill" id="pulseBar"></div></div>
</div>
<div class="retention-row">
<div class="retention-top">
<div>
<strong>Secular trend</strong>
<small>200-year linear drift · direction</small>
</div>
<div class="retention-score">
<b id="trendGain">100%</b>
<span class="retention-status" id="trendStatus">RETAINED</span>
</div>
</div>
<div class="bar-track"><div class="bar-fill" id="trendBar"></div></div>
</div>
<div class="verdict" aria-live="polite">
<div class="eyebrow">Window verdict</div>
<h3 id="verdictTitle">Short events are being flattened.</h3>
<p id="verdictCopy"></p>
</div>
<div class="reading">
<div class="section-title">Reading the landscape</div>
<p>
<b>Warmer filtered values</b> raise the conceptual water level, dry the
low vegetation, and retreat high-elevation snow.
</p>
<p>
<b>Cooler values</b> lower the water, deepen the green canopy, and extend
pale snow across the peaks.
</p>
</div>
<p class="caveat">
Hidden does not mean absent. Smoothing redistributes variation across the
window. The underlying synthetic observations remain unchanged.
</p>
</aside>
</main>
</div>
<script type="module">
import * as THREE from "https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
const $ = (selector) => document.querySelector(selector);
const clamp = (value, min, max) => Math.min(max, Math.max(min, value));
const lerp = (a, b, t) => a + (b - a) * t;
const smoothstep = (edge0, edge1, value) => {
const t = clamp((value - edge0) / (edge1 - edge0), 0, 1);
return t * t * (3 - 2 * t);
};
const signed = (value) => {
const v = Math.abs(value) < 0.005 ? 0 : value;
return `${v >= 0 ? "+" : ""}${v.toFixed(2)}`;
};
const TAU = Math.PI * 2;
const START_YEAR = 1900;
const END_YEAR = 2100;
const MONTHS_PER_YEAR = 12;
const SAMPLE_COUNT = (END_YEAR - START_YEAR) * MONTHS_PER_YEAR + 1;
// Synthetic climate record. Monthly sampling prevents the one-year cycle
// from aliasing against yearly samples.
const sampleTimes = new Float64Array(SAMPLE_COUNT);
const rawValues = new Float64Array(SAMPLE_COUNT);
function syntheticSignal(year) {
const trend = 0.22 * ((year - START_YEAR) / 200) - 0.08;
const annual = 0.28 * Math.sin(TAU * year + 0.65);
const decadal = 0.22 * Math.sin(TAU * ((year - 1918) / 18) + 0.7);
const centennial = 0.16 * Math.sin(TAU * ((year - 1910) / 80) - 0.5);
const pulseA = 0.38 * Math.exp(-Math.pow((year - 1978) / 4.5, 2));
const pulseB = 0.25 * Math.exp(-Math.pow((year - 2038) / 5.8, 2));
return trend + annual + decadal + centennial + pulseA + pulseB;
}
for (let i = 0; i < SAMPLE_COUNT; i++) {
const year = START_YEAR + i / MONTHS_PER_YEAR;
sampleTimes[i] = year;
rawValues[i] = syntheticSignal(year);
}
function movingAverage(values, radiusSamples) {
if (radiusSamples === 0) return values.slice();
const output = new Float64Array(values.length);
const prefix = new Float64Array(values.length + 1);
for (let i = 0; i < values.length; i++) {
prefix[i + 1] = prefix[i] + values[i];
}
for (let i = 0; i < values.length; i++) {
const left = Math.max(0, i - radiusSamples);
const right = Math.min(values.length - 1, i + radiusSamples);
output[i] = (prefix[right + 1] - prefix[left]) / (right - left + 1);
}
return output;
}
let currentRadius = 10;
let currentYear = 1978;
let smoothedValues = movingAverage(rawValues, currentRadius * MONTHS_PER_YEAR);
let currentSmoothed = 0;
let currentRaw = 0;
// ---------------------------------------------------------------------
// Chart
// ---------------------------------------------------------------------
const chart = {
svg: $("#signalChart"),
width: 900,
height: 190,
left: 38,
right: 846,
top: 8,
bottom: 156,
minY: -1.1,
maxY: 1.1
};
const chartX = (year) =>
chart.left +
((year - START_YEAR) / (END_YEAR - START_YEAR)) * (chart.right - chart.left);
const chartY = (value) =>
chart.bottom -
((value - chart.minY) / (chart.maxY - chart.minY)) * (chart.bottom - chart.top);
function buildChartGrid() {
const yTicks = [-1, 0, 1];
const xTicks = [1900, 1950, 2000, 2050, 2100];
let markup = "";
for (const tick of yTicks) {
const y = chartY(tick);
markup += `
<line
x1="${chart.left}" x2="${chart.right}" y1="${y}" y2="${y}"
stroke="${tick === 0 ? "rgba(190,221,209,0.18)" : "rgba(190,221,209,0.09)"}"
stroke-width="1"
vector-effect="non-scaling-stroke"
/>
<text x="${chart.left - 8}" y="${y + 3}" text-anchor="end"
fill="#738981" font-size="9">${tick > 0 ? "+" : ""}${tick}</text>
`;
}
for (const tick of xTicks) {
const x = chartX(tick);
markup += `
<line
x1="${x}" x2="${x}" y1="${chart.top}" y2="${chart.bottom}"
stroke="rgba(190,221,209,0.055)"
vector-effect="non-scaling-stroke"
/>
<text x="${x}" y="178" text-anchor="middle"
fill="#738981" font-size="9">${tick}</text>
`;
}
$("#gridLayer").innerHTML = markup;
}
function pathFor(values) {
let path = "";
for (let i = 0; i < values.length; i++) {
const x = chartX(sampleTimes[i]);
const y = chartY(values[i]);
path += `${i === 0 ? "M" : "L"}${x.toFixed(2)},${y.toFixed(2)} `;
}
return path.trim();
}
function updateChart() {
const rawPath = pathFor(rawValues);
const smoothPath = pathFor(smoothedValues);
$("#rawPath").setAttribute("d", rawPath);
$("#smoothPath").setAttribute("d", smoothPath);
const zeroY = chartY(0);
let areaPath = `M${chartX(START_YEAR)},${zeroY} `;
for (let i = 0; i < smoothedValues.length; i++) {
areaPath += `L${chartX(sampleTimes[i]).toFixed(2)},${chartY(smoothedValues[i]).toFixed(2)} `;
}
areaPath += `L${chartX(END_YEAR)},${zeroY} Z`;
$("#smoothArea").setAttribute("d", areaPath);
const selectedX = chartX(currentYear);
const selectedIndex = Math.round(
(currentYear - START_YEAR) * MONTHS_PER_YEAR
);
currentRaw = rawValues[selectedIndex];
currentSmoothed = smoothedValues[selectedIndex];
$("#yearLine").setAttribute("x1", selectedX);
$("#yearLine").setAttribute("x2", selectedX);
$("#rawDot").setAttribute("cx", selectedX);
$("#rawDot").setAttribute("cy", chartY(currentRaw));
$("#smoothDot").setAttribute("cx", selectedX);
$("#smoothDot").setAttribute("cy", chartY(currentSmoothed));
const bandStart = chartX(Math.max(START_YEAR, currentYear - currentRadius));
const bandEnd = chartX(Math.min(END_YEAR, currentYear + currentRadius));
const band = $("#windowBand");
band.setAttribute("x", bandStart);
band.setAttribute("width", Math.max(0, bandEnd - bandStart));
const bandLabel = $("#bandLabel");
bandLabel.setAttribute(
"x",
clamp((bandStart + bandEnd) / 2, chart.left + 22, chart.right - 22)
);
bandLabel.textContent = currentRadius === 0 ? "point value" : `±${currentRadius} y`;
$("#rawNow").textContent = signed(currentRaw);
$("#smoothNow").textContent = signed(currentSmoothed);
$("#gapNow").textContent = signed(currentSmoothed - currentRaw);
$("#chartSmoothValue").textContent = signed(currentSmoothed);
$("#climateBadge").textContent = `${signed(currentSmoothed)} index`;
}
buildChartGrid();
// ---------------------------------------------------------------------
// Scale-retention analysis
// ---------------------------------------------------------------------
function sincGain(period, radius) {
if (radius === 0) return 1;
const x = (Math.PI * radius) / period;
return Math.abs(Math.sin(x) / x);
}
function erfApproximation(x) {
const sign = x < 0 ? -1 : 1;
const a = Math.abs(x);
const p = 0.3275911;
const a1 = 0.254829592;
const a2 = -0.284496736;
const a3 = 1.421413741;
const a4 = -1.453152027;
const a5 = 1.061405429;
const t = 1 / (1 + p * a);
const y =
1 -
(((((a5 * t + a4) * t + a3) * t + a2) * t + a1) * t) * Math.exp(-a * a);
return sign * y;
}
function pulsePeakGain(radius) {
if (radius === 0) return 1;
const sigma = 4.5;
const erf = erfApproximation(radius / (sigma * Math.SQRT2));
return clamp(
(erf * sigma * Math.sqrt(TAU)) / (2 * radius),
0,
1
);
}
function updateRetentionRow(id, gain, forcedStatus = null) {
const percent = Math.round(gain * 100);
const gainElement = $(`#${id}Gain`);
const statusElement = $(`#${id}Status`);
const barElement = $(`#${id}Bar`);
gainElement.textContent = `${percent}%`;
let status = forcedStatus;
if (!status) {
if (gain < 0.05) status = "HIDDEN";
else if (gain < 0.65) status = "SOFTENED";
else status = "RETAINED";
}
statusElement.textContent = status;
statusElement.className = "retention-status";
barElement.className = "bar-fill";
if (status === "HIDDEN") {
statusElement.classList.add("is-hidden");
barElement.classList.add("is-hidden");
} else if (status === "SOFTENED") {
statusElement.classList.add("is-softened");
barElement.classList.add("is-softened");
} else if (status === "SPREAD") {
statusElement.classList.add("is-spread");
barElement.classList.add("is-spread");
}
barElement.style.width = `${clamp(gain * 100, 0, 100)}%`;
}
function updateRetentionAndVerdict() {
const annual = sincGain(1, currentRadius);
const decadal = sincGain(18, currentRadius);
const century = sincGain(80, currentRadius);
const pulse = pulsePeakGain(currentRadius);
const trend = 1;
updateRetentionRow(
"annual",
annual,
currentRadius === 0 ? "RETAINED" : "HIDDEN"
);
updateRetentionRow("decadal", decadal);
updateRetentionRow("century", century);
updateRetentionRow(
"pulse",
pulse,
currentRadius === 0 ? "RETAINED" : currentRadius < 3 ? "SOFTENED" : "SPREAD"
);
updateRetentionRow("trend", trend, "RETAINED");
const retained = [];
const softened = [];
const lost = [];
if (annual >= 0.65) retained.push("the annual cycle");
else lost.push("the annual cycle");
if (decadal >= 0.65) retained.push("the decadal cycle");
else if (decadal >= 0.05) softened.push("the decadal cycle");
else lost.push("the decadal cycle");
if (century >= 0.65) retained.push("the centennial cycle");
else if (century >= 0.05) softened.push("the centennial cycle");
else lost.push("the centennial cycle");
if (currentRadius < 3) retained.push("the event shape");
else softened.push("the event, now spread across the window");
retained.push("the secular direction");
let title;
let explanation;
if (currentRadius === 0) {
title = "Every scale is present.";
explanation =
"Nothing is filtered. Annual oscillations, short events, decadal swings, " +
"the centennial cycle, and the long-term direction can all be inspected.";
} else if (currentRadius === 1) {
title = "The annual beat disappears.";
explanation =
"A centered ±1-year mean cancels the one-year cycle almost perfectly. " +
"The landscape now responds to the slower envelope rather than each yearly fluctuation.";
} else if (currentRadius <= 8) {
title = "Short events are being flattened.";
explanation =
"The annual cycle is gone and abrupt pulses are broadened. The decadal, " +
"centennial, and secular structures remain clearly readable.";
} else if (currentRadius <= 20) {
title = "The fast climate signal is mostly hidden.";
explanation =
"Annual variation is removed, the event loses its peak, and the decadal " +
"cycle is softened. Century-scale structure and the long-term trend dominate.";
} else if (currentRadius <= 40) {
title = "Decadal variation is losing its shape.";
explanation =
"Multi-year swings are strongly attenuated. The centennial envelope and " +
"secular direction increasingly determine what the filtered landscape shows.";
} else {
title = "Only broad climate structure remains.";
explanation =
"Local variability has been averaged into a broad envelope. The centennial " +
"cycle and secular trend remain, but short-lived events are no longer recognizable.";
}
$("#verdictTitle").textContent = title;
$("#verdictCopy").textContent =
`${explanation} Retained: ${retained.join(", ")}. ` +
(softened.length ? `Attenuated or spread: ${softened.join(", ")}. ` : "") +
(lost.length ? `Lost as distinct shapes: ${lost.join(", ")}.` : "");
}
// ---------------------------------------------------------------------
// Three.js low-poly landscape
// ---------------------------------------------------------------------
const viewport = $("#viewport");
const scene = new THREE.Scene();
scene.background = new THREE.Color(0xdbe8e2);
scene.fog = new THREE.Fog(0xdbe8e2, 34, 65);
const camera = new THREE.PerspectiveCamera(36, 1, 0.1, 100);
const renderer = new THREE.WebGLRenderer({
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.05;
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
renderer.domElement.setAttribute("role", "img");
renderer.domElement.setAttribute(
"aria-label",
"Interactive low-poly landscape responding to the selected smoothed climate signal"
);
$("#threeRoot").appendChild(renderer.domElement);
const hemisphere = new THREE.HemisphereLight(0xf4fbf7, 0x4d614e, 2.2);
scene.add(hemisphere);
const sun = new THREE.DirectionalLight(0xffe0aa, 3.1);
sun.position.set(-8, 14, 8);
sun.castShadow = true;
sun.shadow.mapSize.set(1024, 1024);
sun.shadow.camera.left = -18;
sun.shadow.camera.right = 18;
sun.shadow.camera.top = 14;
sun.shadow.camera.bottom = -14;
sun.shadow.camera.near = 1;
sun.shadow.camera.far = 40;
sun.shadow.bias = -0.0008;
scene.add(sun);
const diorama = new THREE.Group();
diorama.rotation.y = -0.08;
scene.add(diorama);
const base = new THREE.Mesh(
new THREE.BoxGeometry(24.8, 1.1, 16.8),
new THREE.MeshStandardMaterial({
color: 0x30443d,
roughness: 0.95,
flatShading: true
})
);
base.position.y = -0.78;
base.receiveShadow = true;
diorama.add(base);
const groundShadow = new THREE.Mesh(
new THREE.CircleGeometry(27, 48),
new THREE.ShadowMaterial({ color: 0x244b3c, opacity: 0.19 })
);
groundShadow.rotation.x = -Math.PI / 2;
groundShadow.position.y = -1.36;
groundShadow.receiveShadow = true;
scene.add(groundShadow);
function terrainHeight(x, z) {
const mountainA =
2.45 * Math.exp(-(Math.pow(x + 3.2, 2) / 10 + Math.pow(z + 1.0, 2) / 7));
const mountainB =
1.8 * Math.exp(-(Math.pow(x - 4.7, 2) / 7 + Math.pow(z - 2.8, 2) / 9));
const foothills = 0.48 * Math.sin(x * 0.48) * Math.cos(z * 0.38);
const ridge = 0.25 * Math.sin((x + z) * 0.62);
const facets = 0.12 * Math.sin(x * 1.37 + z * 0.73) * Math.cos(z * 0.91);
return 0.05 + foothills + ridge + facets + mountainA + mountainB;
}
const terrainColumns = 30;
const terrainRows = 20;
const terrainVertexCount = (terrainColumns + 1) * (terrainRows + 1);
const terrainPositions = new Float32Array(terrainVertexCount * 3);
const terrainColors = new Float32Array(terrainVertexCount * 3);
const terrainHeights = new Float32Array(terrainVertexCount);
const terrainIndices = [];
let terrainVertex = 0;
for (let iz = 0; iz <= terrainRows; iz++) {
for (let ix = 0; ix <= terrainColumns; ix++) {
const x = -12 + (ix / terrainColumns) * 24;
const z = -8 + (iz / terrainRows) * 16;
const y = terrainHeight(x, z);
terrainPositions[terrainVertex * 3] = x;
terrainPositions[terrainVertex * 3 + 1] = y;
terrainPositions[terrainVertex * 3 + 2] = z;
terrainHeights[terrainVertex] = y;
terrainVertex++;
}
}
for (let iz = 0; iz < terrainRows; iz++) {
for (let ix = 0; ix < terrainColumns; ix++) {
const a = iz * (terrainColumns + 1) + ix;
const b = a + 1;
const c = a + terrainColumns + 1;
const d = c + 1;
if ((ix + iz) % 2 === 0) {
terrainIndices.push(a, c, b, b, c, d);
} else {
terrainIndices.push(a, c, d, a, d, b);
}
}
}
const terrainGeometry = new THREE.BufferGeometry();
terrainGeometry.setAttribute(
"position",
new THREE.BufferAttribute(terrainPositions, 3)
);
terrainGeometry.setAttribute("color", new THREE.BufferAttribute(terrainColors, 3));
terrainGeometry.setIndex(terrainIndices);
terrainGeometry.computeVertexNormals();
const terrainMaterial = new THREE.MeshStandardMaterial({
vertexColors: true,
roughness: 0.96,
metalness: 0,
flatShading: true
});
const terrain = new THREE.Mesh(terrainGeometry, terrainMaterial);
terrain.castShadow = true;
terrain.receiveShadow = true;
diorama.add(terrain);
const terrainWire = new THREE.LineSegments(
new THREE.WireframeGeometry(terrainGeometry),
new THREE.LineBasicMaterial({
color: 0x294a3e,
transparent: true,
opacity: 0.075
})
);
diorama.add(terrainWire);
// Faceted water surface.
const waterColumns = 24;
const waterRows = 16;
const waterVertexCount = (waterColumns + 1) * (waterRows + 1);
const waterPositions = new Float32Array(waterVertexCount * 3);
const waterBase = new Float32Array(waterVertexCount * 2);
const waterIndices = [];
let waterVertex = 0;
for (let iz = 0; iz <= waterRows; iz++) {
for (let ix = 0; ix <= waterColumns; ix++) {
const x = -12.2 + (ix / waterColumns) * 24.4;
const z = -8.2 + (iz / waterRows) * 16.4;
waterBase[waterVertex * 2] = x;
waterBase[waterVertex * 2 + 1] = z;
waterPositions[waterVertex * 3] = x;
waterPositions[waterVertex * 3 + 1] = 0.12;
waterPositions[waterVertex * 3 + 2] = z;
waterVertex++;
}
}
for (let iz = 0; iz < waterRows; iz++) {
for (let ix = 0; ix < waterColumns; ix++) {
const a = iz * (waterColumns + 1) + ix;
const b = a + 1;
const c = a + waterColumns + 1;
const d = c + 1;
waterIndices.push(a, c, b, b, c, d);
}
}
const waterGeometry = new THREE.BufferGeometry();
waterGeometry.setAttribute(
"position",
new THREE.BufferAttribute(waterPositions, 3)
);
waterGeometry.setIndex(waterIndices);
waterGeometry.computeVertexNormals();
const waterMaterial = new THREE.MeshStandardMaterial({
color: 0x559b98,
roughness: 0.42,
metalness: 0.03,
flatShading: true,
side: THREE.DoubleSide
});
const water = new THREE.Mesh(waterGeometry, waterMaterial);
water.receiveShadow = true;
diorama.add(water);
// Low-poly trees.
const trunkMaterial = new THREE.MeshStandardMaterial({
color: 0x65513b,
roughness: 1,
flatShading: true
});
const foliageMaterial = new THREE.MeshStandardMaterial({
color: 0x3d7352,
roughness: 1,
flatShading: true
});
const trunkGeometry = new THREE.CylinderGeometry(0.065, 0.1, 0.42, 5);
const foliageGeometry = new THREE.ConeGeometry(0.31, 0.76, 5);
let randomSeed = 97231;
function random() {
randomSeed = (randomSeed * 1664525 + 1013904223) >>> 0;
return randomSeed / 4294967296;
}
let treesPlaced = 0;
for (let attempt = 0; attempt < 500 && treesPlaced < 28; attempt++) {
const x = (random() - 0.5) * 20.5;
const z = (random() - 0.5) * 12.5;
const y = terrainHeight(x, z);
if (y < 0.43 || y > 1.72) continue;
const tree = new THREE.Group();
const trunk = new THREE.Mesh(trunkGeometry, trunkMaterial);
trunk.position.y = 0.21;
trunk.castShadow = true;
const foliage = new THREE.Mesh(foliageGeometry, foliageMaterial);
foliage.position.y = 0.69;
foliage.castShadow = true;
const size = 0.76 + random() * 0.62;
tree.scale.set(size, size * (0.9 + random() * 0.3), size);
tree.position.set(x, y, z);
tree.rotation.y = random() * Math.PI;
diorama.add(tree);
treesPlaced++;
}
// Low-poly rocks.
const rockMaterial = new THREE.MeshStandardMaterial({
color: 0x77786d,
roughness: 1,
flatShading: true
});
const rockGeometry = new THREE.IcosahedronGeometry(0.34, 0);
for (let i = 0; i < 13; i++) {
const x = (random() - 0.5) * 19;
const z = (random() - 0.5) * 12;
const y = terrainHeight(x, z);
const rock = new THREE.Mesh(rockGeometry, rockMaterial);
rock.position.set(x, y + 0.12, z);
rock.scale.set(0.65 + random(), 0.45 + random() * 0.6, 0.65 + random());
rock.rotation.set(random(), random(), random());
rock.castShadow = true;
rock.receiveShadow = true;
diorama.add(rock);
}
// A few faceted clouds for depth.
const clouds = [];
const cloudMaterial = new THREE.MeshStandardMaterial({
color: 0xf4f5e9,
roughness: 1,
flatShading: true,
transparent: true,
opacity: 0.82
});
const cloudGeometry = new THREE.DodecahedronGeometry(0.62, 0);
for (let i = 0; i < 5; i++) {
const cloud = new THREE.Group();
for (let j = 0; j < 3; j++) {
const puff = new THREE.Mesh(cloudGeometry, cloudMaterial);
puff.position.set(j * 0.52 - 0.5, Math.sin(j * 2) * 0.1, 0);
puff.scale.set(1.2, 0.48, 0.75);
cloud.add(puff);
}
cloud.position.set(-8 + i * 4.1, 5.3 + (i % 2) * 0.5, -3 + (i % 3) * 2.2);
cloud.scale.setScalar(0.75 + random() * 0.45);
cloud.userData.baseX = cloud.position.x;
clouds.push(cloud);
scene.add(cloud);
}
const colorLowGreen = new THREE.Color(0x3e7350);
const colorDryGreen = new THREE.Color(0x9b7a45);
const colorRock = new THREE.Color(0x77776c);
const colorSnow = new THREE.Color(0xe3ebe4);
const colorWaterCool = new THREE.Color(0x4f9298);
const colorWaterWarm = new THREE.Color(0x6aa59a);
let currentWarmth = 0;
let currentSeaLevel = 0.12;
function updateLandscape() {
currentWarmth = clamp(currentSmoothed / 0.72, -1, 1);
currentSeaLevel =
0.12 + Math.max(0, currentWarmth) * 0.2 - Math.max(0, -currentWarmth) * 0.07;
const dryness = clamp(0.46 + currentWarmth * 0.45, 0, 1);
const altitude = terrainHeights;
for (let i = 0; i < terrainVertexCount; i++) {
const color = new THREE.Color();
const height = altitude[i];
const relativeHeight = clamp((height - currentSeaLevel) / 3.0, 0, 1);
if (height < currentSeaLevel) {
color.set(0x6d9184);
} else {
color.copy(colorLowGreen).lerp(colorDryGreen, dryness);
const rockAmount =
smoothstep(0.52, 0.96, relativeHeight) * (0.58 + dryness * 0.25);
color.lerp(colorRock, rockAmount);
const coldAmount = clamp((-currentWarmth + 0.08) * 1.12, 0, 1);
const snowAmount = smoothstep(0.62, 0.93, relativeHeight) * coldAmount;
color.lerp(colorSnow, snowAmount);
}
terrainColors[i * 3] = color.r;
terrainColors[i * 3 + 1] = color.g;
terrainColors[i * 3 + 2] = color.b;
}
terrainGeometry.attributes.color.needsUpdate = true;
const foliageColor = new THREE.Color()
.copy(colorLowGreen)
.lerp(colorDryGreen, dryness);
const plantSnow = clamp(-currentWarmth * 0.46, 0, 0.46);
foliageColor.lerp(colorSnow, plantSnow);
foliageMaterial.color.copy(foliageColor);
waterMaterial.color
.copy(colorWaterCool)
.lerp(colorWaterWarm, clamp(currentWarmth * 0.65, 0, 1));
const state = $("#climateState");
const stateText = $("#climateStateText");
state.className = "scene-badge";
if (currentWarmth > 0.22) {
state.classList.add("warm");
stateText.textContent = "WARM";
$("#landscapeEffect").textContent =
"Higher water, drier canopy, and retreating high-elevation snow.";
} else if (currentWarmth < -0.22) {
state.classList.add("cool");
stateText.textContent = "COOL";
$("#landscapeEffect").textContent =
"Lower water, greener vegetation, and snow spreading across the peaks.";
} else {
stateText.textContent = "BALANCED";
$("#landscapeEffect").textContent =
"Near-baseline moisture, moderate vegetation, and limited snow change.";
}
}
// ---------------------------------------------------------------------
// Camera controls implemented directly, without addons.
// ---------------------------------------------------------------------
const cameraTarget = new THREE.Vector3(0, 0.75, 0);
const defaultCamera = {
yaw: -0.56,
pitch: 0.63,
distance: 27.5
};
let cameraYaw = defaultCamera.yaw;
let cameraPitch = defaultCamera.pitch;
let cameraDistance = defaultCamera.distance;
let targetYaw = defaultCamera.yaw;
let targetPitch = defaultCamera.pitch;
let targetDistance = defaultCamera.distance;
function updateCamera() {
cameraYaw += (targetYaw - cameraYaw) * 0.09;
cameraPitch += (targetPitch - cameraPitch) * 0.09;
cameraDistance += (targetDistance - cameraDistance) * 0.09;
const horizontal = cameraDistance * Math.cos(cameraPitch);
camera.position.set(
cameraTarget.x + Math.sin(cameraYaw) * horizontal,
cameraTarget.y + Math.sin(cameraPitch) * cameraDistance,
cameraTarget.z + Math.cos(cameraYaw) * horizontal
);
camera.lookAt(cameraTarget);
}
let dragging = false;
let pointerX = 0;
let pointerY = 0;
renderer.domElement.addEventListener("pointerdown", (event) => {
dragging = true;
pointerX = event.clientX;
pointerY = event.clientY;
renderer.domElement.setPointerCapture(event.pointerId);
});
renderer.domElement.addEventListener("pointermove", (event) => {
if (!dragging) return;
const dx = event.clientX - pointerX;
const dy = event.clientY - pointerY;
pointerX = event.clientX;
pointerY = event.clientY;
targetYaw -= dx * 0.006;
targetPitch = clamp(targetPitch + dy * 0.0045, 0.3, 1.22);
});
function stopDragging(event) {
dragging = false;
if (event.pointerId !== undefined && renderer.domElement.hasPointerCapture(event.pointerId)) {
renderer.domElement.releasePointerCapture(event.pointerId);
}
}
renderer.domElement.addEventListener("pointerup", stopDragging);
renderer.domElement.addEventListener("pointercancel", stopDragging);
renderer.domElement.addEventListener("contextmenu", (event) => event.preventDefault());
renderer.domElement.addEventListener(
"wheel",
(event) => {
event.preventDefault();
targetDistance = clamp(
targetDistance + event.deltaY * 0.018,
15,
39
);
},
{ passive: false }
);
$("#resetCamera").addEventListener("click", () => {
targetYaw = defaultCamera.yaw;
targetPitch = defaultCamera.pitch;
targetDistance = defaultCamera.distance;
});
function resizeRenderer() {
const width = Math.max(1, viewport.clientWidth);
const height = Math.max(1, viewport.clientHeight);
renderer.setSize(width, height, false);
camera.aspect = width / height;
camera.updateProjectionMatrix();
}
new ResizeObserver(resizeRenderer).observe(viewport);
resizeRenderer();
// ---------------------------------------------------------------------
// UI interactions
// ---------------------------------------------------------------------
function updateRangeFill(range) {
const min = Number(range.min);
const max = Number(range.max);
const value = Number(range.value);
const percent = ((value - min) / (max - min)) * 100;
if (range.id === "windowRange") {
range.style.background = `linear-gradient(
90deg,
var(--green) 0%,
var(--green) ${percent}%,
rgba(255,255,255,.11) ${percent}%,
rgba(255,255,255,.11) 100%
)`;
} else {
range.style.background = `linear-gradient(
90deg,
var(--orange) 0%,
var(--orange) ${percent}%,
rgba(255,255,255,.11) ${percent}%,
rgba(255,255,255,.11) 100%
)`;
}
}
function updateWindow() {
currentRadius = Number($("#windowRange").value);
smoothedValues = movingAverage(
rawValues,
currentRadius * MONTHS_PER_YEAR
);
$("#windowLabel").textContent = `±${currentRadius}`;
$("#windowSamples").textContent =
currentRadius === 0
? "Point values: no smoothing. Every monthly fluctuation remains visible."
: `A ${currentRadius * 2 + 1}-year centered box mean, calculated from ` +
`${currentRadius * 24 + 1} monthly samples.`;
document.querySelectorAll(".preset").forEach((button) => {
button.classList.toggle(
"active",
Number(button.dataset.window) === currentRadius
);
});
updateRangeFill($("#windowRange"));
updateChart();
updateRetentionAndVerdict();
updateLandscape();
}
function updateYear() {
currentYear = Number($("#yearRange").value);
$("#yearValue").textContent = currentYear;
updateRangeFill($("#yearRange"));
updateChart();
updateLandscape();
}
$("#windowRange").addEventListener("input", updateWindow);
$("#yearRange").addEventListener("input", updateYear);
document.querySelectorAll(".preset").forEach((button) => {
button.addEventListener("click", () => {
$("#windowRange").value = button.dataset.window;
updateWindow();
});
});
$("#rawToggle").addEventListener("change", (event) => {
const visible = event.target.checked ? "" : "none";
$("#rawPath").style.display = visible;
$("#rawDot").style.display = visible;
});
// Click or drag the timeline to scrub the landscape.
let chartDragging = false;
function scrubChart(event) {
const svg = chart.svg;
const point = svg.createSVGPoint();
point.x = event.clientX;
point.y = event.clientY;
const matrix = svg.getScreenCTM();
if (!matrix) return;
const local = point.matrixTransform(matrix.inverse());
const fraction = clamp(
(local.x - chart.left) / (chart.right - chart.left),
0,
1
);
const year = Math.round(
START_YEAR + fraction * (END_YEAR - START_YEAR)
);
$("#yearRange").value = year;
updateYear();
}
chart.svg.addEventListener("pointerdown", (event) => {
chartDragging = true;
chart.svg.setPointerCapture(event.pointerId);
scrubChart(event);
});
chart.svg.addEventListener("pointermove", (event) => {
if (chartDragging) scrubChart(event);
});
chart.svg.addEventListener("pointerup", (event) => {
chartDragging = false;
if (chart.svg.hasPointerCapture(event.pointerId)) {
chart.svg.releasePointerCapture(event.pointerId);
}
});
// ---------------------------------------------------------------------
// Animation
// ---------------------------------------------------------------------
const clock = new THREE.Clock();
function animate() {
requestAnimationFrame(animate);
const elapsed = clock.getElapsedTime();
const position = waterGeometry.attributes.position;
for (let i = 0; i < waterVertexCount; i++) {
const x = waterBase[i * 2];
const z = waterBase[i * 2 + 1];
const wave =
Math.sin(x * 0.92 + elapsed * 0.9) * 0.026 +
Math.sin(z * 1.27 - elapsed * 0.7) * 0.019 +
Math.sin((x + z) * 0.68 + elapsed * 0.45) * 0.012;
position.array[i * 3 + 1] = currentSeaLevel + wave;
}
position.needsUpdate = true;
waterGeometry.computeVertexNormals();
for (let i = 0; i < clouds.length; i++) {
const cloud = clouds[i];
cloud.position.x =
cloud.userData.baseX + Math.sin(elapsed * 0.08 + i * 1.7) * 0.7;
cloud.position.y += Math.sin(elapsed * 0.35 + i) * 0.00025;
}
updateCamera();
renderer.render(scene, camera);
}
updateWindow();
updateYear();
updateCamera();
animate();
</script>
</body>
</html>
```