Prompt specification
Build or customize the Three.js 3D scene "Seasonal circulation pathway explorer" 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: Seasonal circulation pathway explorer
Category: Space & Earth · Style: Procedural Solid / Shader 3D
License: MIT · Reference: https://three3d.app/scene/seasonal-circulation-pathway-explorer-x1228
Scene Description Prompt:
Make a standalone HTML scene with Three.js from cdnjs that depicts monsoon circulation. Allow selection of two illustrative seasonal pressure patterns; trace air movement and moisture pathways over a bounded coast, clearly marking the model as qualitative. Low-poly.
Working Three.js Starter (seasonal-circulation-pathway-explorer-x1228):
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Monsoon Circulation — Qualitative Model</title>
<style>
:root {
--bg: #071820;
--panel: rgba(7, 25, 33, 0.88);
--panel-border: rgba(213, 233, 221, 0.18);
--text: #edf4ee;
--muted: #9fb5af;
--wind: #f1c27c;
--moisture: #54ddd4;
--high: #ff9b67;
--low: #79b9ff;
--accent: #f1c27c;
}
* {
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: var(--bg);
color: var(--text);
font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
"Segoe UI", sans-serif;
}
body[data-season="winter"] {
--accent: #79b9ff;
}
#scene {
position: fixed;
inset: 0;
}
#scene canvas {
display: block;
width: 100%;
height: 100%;
touch-action: none;
cursor: grab;
}
#scene canvas:active {
cursor: grabbing;
}
.glass {
background: var(--panel);
border: 1px solid var(--panel-border);
box-shadow: 0 18px 55px rgba(0, 0, 0, 0.25);
backdrop-filter: blur(16px);
-webkit-backdrop-filter: blur(16px);
}
header {
position: fixed;
z-index: 5;
top: 24px;
left: 24px;
width: min(420px, calc(100vw - 48px));
padding: 20px 22px 18px;
border-radius: 18px;
pointer-events: none;
}
.eyebrow {
margin-bottom: 8px;
color: var(--accent);
font-size: 10px;
font-weight: 800;
letter-spacing: 0.19em;
text-transform: uppercase;
}
h1 {
margin: 0;
font-size: clamp(26px, 3vw, 40px);
font-weight: 720;
line-height: 1;
letter-spacing: -0.045em;
}
.subtitle {
margin: 11px 0 16px;
color: var(--muted);
font-size: 13px;
line-height: 1.5;
}
.qualitative {
display: inline-flex;
align-items: center;
gap: 8px;
padding: 7px 10px;
border: 1px solid rgba(241, 194, 124, 0.35);
border-radius: 999px;
color: #ffd99f;
background: rgba(241, 194, 124, 0.08);
font-size: 9px;
font-weight: 800;
letter-spacing: 0.12em;
text-transform: uppercase;
}
.qualitative::before {
width: 6px;
height: 6px;
border-radius: 50%;
background: var(--accent);
box-shadow: 0 0 10px var(--accent);
content: "";
}
#season-panel {
position: fixed;
z-index: 6;
top: 24px;
right: 24px;
width: 320px;
padding: 18px;
border-radius: 18px;
}
.panel-label {
margin-bottom: 11px;
color: var(--muted);
font-size: 9px;
font-weight: 800;
letter-spacing: 0.16em;
text-transform: uppercase;
}
.season-options {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 8px;
}
.season-button {
min-height: 74px;
padding: 11px;
border: 1px solid rgba(222, 239, 229, 0.13);
border-radius: 12px;
color: var(--text);
background: rgba(255, 255, 255, 0.025);
cursor: pointer;
text-align: left;
transition: 180ms ease;
}
.season-button:hover {
border-color: rgba(222, 239, 229, 0.36);
background: rgba(255, 255, 255, 0.055);
}
.season-button.active {
border-color: var(--accent);
background: color-mix(in srgb, var(--accent) 11%, transparent);
box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 15%, transparent);
}
.season-button strong {
display: block;
margin-bottom: 7px;
color: var(--accent);
font-size: 10px;
letter-spacing: 0.12em;
text-transform: uppercase;
}
.season-button span {
display: block;
font-size: 12px;
line-height: 1.3;
}
.detail {
min-height: 112px;
margin-top: 13px;
padding-top: 13px;
border-top: 1px solid rgba(222, 239, 229, 0.12);
}
.pressure-summary {
display: flex;
align-items: center;
gap: 7px;
color: #d9e6df;
font-size: 11px;
font-weight: 700;
}
.pressure-symbol {
display: inline-grid;
width: 25px;
height: 25px;
place-items: center;
border: 1px solid currentColor;
border-radius: 50%;
font-size: 12px;
}
.pressure-symbol.high {
color: var(--high);
}
.pressure-symbol.low {
color: var(--low);
}
.flow-arrow {
color: var(--accent);
font-size: 18px;
}
.detail p {
margin: 10px 0 0;
color: var(--muted);
font-size: 12px;
line-height: 1.5;
}
.panel-actions {
display: flex;
gap: 8px;
margin-top: 13px;
}
.action {
flex: 1;
padding: 9px 10px;
border: 1px solid rgba(222, 239, 229, 0.15);
border-radius: 9px;
color: var(--text);
background: rgba(255, 255, 255, 0.035);
cursor: pointer;
font-size: 10px;
font-weight: 700;
letter-spacing: 0.04em;
}
.action:hover {
border-color: rgba(222, 239, 229, 0.38);
}
.legend {
position: fixed;
z-index: 5;
bottom: 24px;
left: 24px;
display: flex;
flex-wrap: wrap;
gap: 16px;
max-width: calc(100vw - 48px);
padding: 12px 15px;
border-radius: 14px;
pointer-events: none;
}
.legend-item {
display: flex;
align-items: center;
gap: 7px;
color: var(--muted);
font-size: 10px;
font-weight: 650;
letter-spacing: 0.025em;
}
.legend-line {
width: 27px;
height: 2px;
background: var(--wind);
box-shadow: 0 0 6px color-mix(in srgb, var(--wind) 60%, transparent);
}
.legend-line.moisture {
height: 4px;
border-radius: 4px;
background: var(--moisture);
}
.legend-arrow {
color: var(--wind);
font-size: 17px;
line-height: 1;
}
.legend-cloud {
color: #dce9e6;
font-size: 17px;
line-height: 1;
}
.hint {
position: fixed;
z-index: 5;
right: 27px;
bottom: 28px;
color: rgba(225, 239, 232, 0.6);
font-size: 10px;
letter-spacing: 0.04em;
pointer-events: none;
}
.compass {
position: fixed;
z-index: 5;
top: 250px;
left: 30px;
display: grid;
place-items: center;
width: 44px;
height: 58px;
color: rgba(237, 244, 238, 0.72);
pointer-events: none;
font-size: 10px;
font-weight: 800;
letter-spacing: 0.12em;
}
.compass::before {
position: absolute;
top: 19px;
width: 0;
height: 0;
border-right: 6px solid transparent;
border-bottom: 19px solid rgba(237, 244, 238, 0.78);
border-left: 6px solid transparent;
content: "";
}
#loading {
position: fixed;
z-index: 20;
inset: 0;
display: grid;
place-items: center;
color: var(--muted);
background: var(--bg);
font-size: 11px;
font-weight: 800;
letter-spacing: 0.16em;
text-transform: uppercase;
transition: opacity 350ms ease;
}
#loading.hidden {
opacity: 0;
pointer-events: none;
}
@media (max-width: 760px) {
header {
top: 12px;
left: 12px;
width: calc(100vw - 24px);
padding: 15px 17px;
}
.subtitle {
display: none;
}
.eyebrow {
margin-bottom: 5px;
}
#season-panel {
top: auto;
right: 12px;
bottom: 12px;
width: calc(100vw - 24px);
padding: 13px;
}
.season-button {
min-height: 58px;
padding: 9px;
}
.detail {
min-height: 0;
margin-top: 10px;
padding-top: 10px;
}
.detail p {
margin-top: 7px;
font-size: 11px;
}
.panel-actions {
margin-top: 10px;
}
.legend {
top: 132px;
bottom: auto;
left: 12px;
gap: 10px;
max-width: calc(100vw - 24px);
padding: 9px 11px;
}
.legend-item {
font-size: 9px;
}
.hint,
.compass {
display: none;
}
}
</style>
</head>
<body data-season="summer">
<div id="scene"></div>
<div id="loading">Building qualitative circulation model…</div>
<header class="glass">
<div class="eyebrow">Earth systems / seasonal flow study</div>
<h1>Monsoon circulation</h1>
<p class="subtitle">
An illustrative coastal model connecting seasonal pressure,
moist onshore flow, cloud formation, and dry offshore flow.
</p>
<div class="qualitative">Qualitative model · not to scale</div>
</header>
<section id="season-panel" class="glass" aria-label="Seasonal pressure pattern">
<div class="panel-label">Select an illustrative pattern</div>
<div class="season-options">
<button
class="season-button active"
type="button"
data-season="summer"
aria-pressed="true"
>
<strong>01 / Summer</strong>
<span>Moist onshore flow</span>
</button>
<button
class="season-button"
type="button"
data-season="winter"
aria-pressed="false"
>
<strong>02 / Winter</strong>
<span>Dry offshore flow</span>
</button>
</div>
<div class="detail">
<div class="pressure-summary">
<span id="pressure-a" class="pressure-symbol high">H</span>
<span id="pressure-a-text">warm ocean</span>
<span class="flow-arrow">→</span>
<span id="pressure-b" class="pressure-symbol low">L</span>
<span id="pressure-b-text">heated land</span>
</div>
<p id="detail-copy">
Moist air crosses the coast, rises over warm land, and supports
clouds and rain.
</p>
</div>
<div class="panel-actions">
<button id="pause" class="action" type="button" aria-pressed="false">
Pause flow
</button>
<button id="reset-view" class="action" type="button">Reset view</button>
</div>
</section>
<div class="legend glass" aria-label="Scene legend">
<div class="legend-item">
<span class="legend-arrow">➜</span>
<span>Air movement</span>
</div>
<div class="legend-item">
<span class="legend-line moisture"></span>
<span>Moisture pathway</span>
</div>
<div class="legend-item">
<span class="legend-cloud">☁</span>
<span>Cloud / rain</span>
</div>
<div class="legend-item">
<span class="pressure-symbol high">H</span>
<span>High pressure</span>
</div>
<div class="legend-item">
<span class="pressure-symbol low">L</span>
<span>Low pressure</span>
</div>
</div>
<div class="compass">N</div>
<div class="hint">Drag to orbit · wheel / pinch to zoom · space to pause</div>
<script type="module">
import * as THREE from
"https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
const sceneHost = document.querySelector("#scene");
const loading = document.querySelector("#loading");
const scene = new THREE.Scene();
scene.background = new THREE.Color(0x071820);
scene.fog = new THREE.FogExp2(0x071820, 0.0065);
const camera = new THREE.PerspectiveCamera(
42,
innerWidth / innerHeight,
0.1,
250
);
const renderer = new THREE.WebGLRenderer({
antialias: true,
powerPreference: "high-performance"
});
renderer.setSize(innerWidth, innerHeight);
renderer.setPixelRatio(Math.min(devicePixelRatio, 2));
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1.12;
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
sceneHost.appendChild(renderer.domElement);
// Lighting
scene.add(new THREE.HemisphereLight(0xb9e8e3, 0x1a2922, 2.15));
const sun = new THREE.DirectionalLight(0xffe1b0, 3.25);
sun.position.set(-24, 42, 26);
sun.castShadow = true;
sun.shadow.mapSize.set(2048, 2048);
sun.shadow.camera.left = -42;
sun.shadow.camera.right = 42;
sun.shadow.camera.top = 34;
sun.shadow.camera.bottom = -34;
sun.shadow.camera.near = 1;
sun.shadow.camera.far = 110;
sun.shadow.bias = -0.0007;
scene.add(sun);
const rim = new THREE.DirectionalLight(0x72b9d0, 1.15);
rim.position.set(30, 18, -28);
scene.add(rim);
// Deterministic pseudo-random helper
function mulberry32(seed) {
return function () {
let t = seed += 0x6D2B79F5;
t = Math.imul(t ^ (t >>> 15), t | 1);
t ^= t + Math.imul(t ^ (t >>> 7), t | 61);
return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
};
}
const random = mulberry32(1847);
const animatedFlows = [];
const animatedPressure = [];
const animatedClouds = [];
// Backdrop below the bounded model
const backdrop = new THREE.Mesh(
new THREE.PlaneGeometry(180, 180),
new THREE.MeshStandardMaterial({
color: 0x081b24,
roughness: 1
})
);
backdrop.rotation.x = -Math.PI / 2;
backdrop.position.y = -1.22;
backdrop.receiveShadow = true;
scene.add(backdrop);
// Base and ocean
const base = new THREE.Mesh(
new THREE.BoxGeometry(50.8, 0.85, 34.8),
new THREE.MeshStandardMaterial({
color: 0x132d36,
roughness: 0.9
})
);
base.position.y = -0.55;
base.receiveShadow = true;
scene.add(base);
const oceanGeometry = new THREE.PlaneGeometry(50, 34, 20, 14);
oceanGeometry.rotateX(-Math.PI / 2);
const oceanPositions = oceanGeometry.attributes.position;
const oceanColors = [];
const oceanColorA = new THREE.Color(0x176579);
const oceanColorB = new THREE.Color(0x268c98);
for (let i = 0; i < oceanPositions.count; i++) {
const x = oceanPositions.getX(i);
const z = oceanPositions.getZ(i);
const wave =
Math.sin(x * 0.27 + z * 0.18) * 0.025 +
Math.cos(z * 0.37 - x * 0.11) * 0.018;
oceanPositions.setY(i, 0.025 + wave + random() * 0.025);
const mix = THREE.MathUtils.clamp(
0.45 + Math.sin(x * 0.16 + z * 0.22) * 0.18 + random() * 0.22,
0,
1
);
const c = oceanColorA.clone().lerp(oceanColorB, mix);
oceanColors.push(c.r, c.g, c.b);
}
oceanGeometry.setAttribute(
"color",
new THREE.Float32BufferAttribute(oceanColors, 3)
);
oceanGeometry.computeVertexNormals();
const ocean = new THREE.Mesh(
oceanGeometry,
new THREE.MeshStandardMaterial({
vertexColors: true,
flatShading: true,
roughness: 0.82,
metalness: 0.02
})
);
ocean.receiveShadow = true;
scene.add(ocean);
// The coastline is deliberately schematic rather than geographic.
const coast = [
[-12, 17],
[-10, 12],
[-7, 8],
[-4, 5],
[-1, 3],
[1, 0],
[0, -4],
[3, -8],
[6, -12],
[9, -16]
];
const landShape = new THREE.Shape();
coast.forEach(([x, z], index) => {
if (index === 0) landShape.moveTo(x, -z);
else landShape.lineTo(x, -z);
});
landShape.lineTo(25, 17);
landShape.lineTo(25, -17);
landShape.closePath();
const landGeometry = new THREE.ExtrudeGeometry(landShape, {
depth: 0.76,
bevelEnabled: false,
curveSegments: 1
});
landGeometry.rotateX(-Math.PI / 2);
const land = new THREE.Mesh(
landGeometry,
new THREE.MeshStandardMaterial({
color: 0x5e805e,
flatShading: true,
roughness: 0.96
})
);
land.castShadow = true;
land.receiveShadow = true;
scene.add(land);
// Faceted color variation on the land surface
const landTop = new THREE.ShapeGeometry(landShape, 1);
landTop.rotateX(-Math.PI / 2);
const facetGeometry = landTop.toNonIndexed();
facetGeometry.translate(0, 0.775, 0);
const facetColors = [];
const facetPosition = facetGeometry.attributes.position;
for (let i = 0; i < facetPosition.count; i += 3) {
const c = new THREE.Color(0x78936a);
c.offsetHSL(
(random() - 0.5) * 0.025,
(random() - 0.5) * 0.08,
(random() - 0.5) * 0.1
);
for (let j = 0; j < 3; j++) {
facetColors.push(c.r, c.g, c.b);
}
}
facetGeometry.setAttribute(
"color",
new THREE.Float32BufferAttribute(facetColors, 3)
);
const landSurface = new THREE.Mesh(
facetGeometry,
new THREE.MeshStandardMaterial({
vertexColors: true,
flatShading: true,
roughness: 1
})
);
landSurface.receiveShadow = true;
scene.add(landSurface);
// Bright coastline edge
const coastLine = new THREE.Line(
new THREE.BufferGeometry().setFromPoints(
coast.map(([x, z]) => new THREE.Vector3(x, 0.82, z))
),
new THREE.LineBasicMaterial({
color: 0xe5d6af,
transparent: true,
opacity: 0.9
})
);
scene.add(coastLine);
// Low-poly mountain groups
const mountainPalette = [
0x667a63,
0x73856c,
0x5c715d,
0x7e8b70
];
const mountainLocations = [
[16, -8, 3.4, 3.0],
[20, -3, 2.7, 2.6],
[15, 1, 2.4, 2.1],
[10, -10, 2.5, 2.2],
[21, 5, 2.9, 2.4],
[8, -7, 1.8, 1.5]
];
mountainLocations.forEach(([x, z, radius, height]) => {
const mountain = new THREE.Mesh(
new THREE.ConeGeometry(radius, height, 5, 1),
new THREE.MeshStandardMaterial({
color:
mountainPalette[
Math.floor(random() * mountainPalette.length)
],
flatShading: true,
roughness: 1
})
);
mountain.position.set(x, 0.78 + height / 2, z);
mountain.rotation.y = random() * Math.PI;
mountain.castShadow = true;
mountain.receiveShadow = true;
scene.add(mountain);
});
// Bounded frame
const frameMaterial = new THREE.MeshStandardMaterial({
color: 0xd2c4a4,
roughness: 0.72,
metalness: 0.08
});
[
[0, -17.1, 50.7, 0.36],
[0, 17.1, 50.7, 0.36]
].forEach(([x, z, width, depth]) => {
const rail = new THREE.Mesh(
new THREE.BoxGeometry(width, 0.36, depth),
frameMaterial
);
rail.position.set(x, 0.28, z);
rail.castShadow = true;
scene.add(rail);
});
[-25.1, 25.1].forEach((x) => {
const rail = new THREE.Mesh(
new THREE.BoxGeometry(0.36, 0.36, 34),
frameMaterial
);
rail.position.set(x, 0.28, 0);
rail.castShadow = true;
scene.add(rail);
});
// Estimate the coast to keep decorative wave marks in the water.
const orderedCoast = coast.slice().sort((a, b) => a[1] - b[1]);
function coastX(z) {
if (z <= orderedCoast[0][1]) return orderedCoast[0][0];
if (z >= orderedCoast[orderedCoast.length - 1][1]) {
return orderedCoast[orderedCoast.length - 1][0];
}
for (let i = 0; i < orderedCoast.length - 1; i++) {
const a = orderedCoast[i];
const b = orderedCoast[i + 1];
if (z >= a[1] && z <= b[1]) {
const t = (z - a[1]) / (b[1] - a[1]);
return THREE.MathUtils.lerp(a[0], b[0], t);
}
}
return -5;
}
const wavePositions = [];
let waveAttempts = 0;
while (wavePositions.length < 72 && waveAttempts < 300) {
waveAttempts++;
const x = -24 + random() * 22;
const z = -15.5 + random() * 31;
const length = 0.7 + random() * 2.1;
if (x + length > coastX(z) - 0.8) continue;
wavePositions.push(
x, 0.15, z,
x + length, 0.15, z + (random() - 0.5) * 0.12
);
}
const waveGeometry = new THREE.BufferGeometry();
waveGeometry.setAttribute(
"position",
new THREE.Float32BufferAttribute(wavePositions, 3)
);
scene.add(
new THREE.LineSegments(
waveGeometry,
new THREE.LineBasicMaterial({
color: 0x9dd9d4,
transparent: true,
opacity: 0.3
})
)
);
// Canvas-based labels keep the scene asset-independent.
function pressureSprite(letter, color) {
const canvas = document.createElement("canvas");
canvas.width = 256;
canvas.height = 256;
const ctx = canvas.getContext("2d");
ctx.clearRect(0, 0, 256, 256);
ctx.beginPath();
ctx.arc(128, 128, 98, 0, Math.PI * 2);
ctx.fillStyle = "rgba(7, 25, 33, 0.92)";
ctx.fill();
ctx.lineWidth = 11;
ctx.strokeStyle = color;
ctx.stroke();
ctx.fillStyle = color;
ctx.font = "800 125px Arial";
ctx.textAlign = "center";
ctx.textBaseline = "middle";
ctx.fillText(letter, 128, 133);
const texture = new THREE.CanvasTexture(canvas);
texture.colorSpace = THREE.SRGBColorSpace;
const sprite = new THREE.Sprite(
new THREE.SpriteMaterial({
map: texture,
transparent: true,
depthTest: false,
depthWrite: false
})
);
sprite.scale.set(3.4, 3.4, 1);
sprite.renderOrder = 20;
return sprite;
}
function captionSprite(text, color = "#dce9e4") {
const canvas = document.createElement("canvas");
canvas.width = 768;
canvas.height = 128;
const ctx = canvas.getContext("2d");
ctx.clearRect(0, 0, 768, 128);
ctx.fillStyle = "rgba(7, 25, 33, 0.78)";
ctx.fillRect(8, 18, 752, 92);
ctx.strokeStyle = "rgba(230, 241, 234, 0.25)";
ctx.lineWidth = 3;
ctx.strokeRect(8, 18, 752, 92);
ctx.fillStyle = color;
ctx.font = "700 43px Arial";
ctx.textAlign = "center";
ctx.textBaseline = "middle";
ctx.fillText(text, 384, 65);
const texture = new THREE.CanvasTexture(canvas);
texture.colorSpace = THREE.SRGBColorSpace;
const sprite = new THREE.Sprite(
new THREE.SpriteMaterial({
map: texture,
transparent: true,
depthTest: false,
depthWrite: false
})
);
sprite.scale.set(9.2, 1.55, 1);
sprite.renderOrder = 19;
return sprite;
}
function tagSprite(text, color, background) {
const canvas = document.createElement("canvas");
canvas.width = 512;
canvas.height = 128;
const ctx = canvas.getContext("2d");
ctx.clearRect(0, 0, 512, 128);
ctx.fillStyle = background;
ctx.fillRect(10, 24, 492, 80);
ctx.strokeStyle = color;
ctx.lineWidth = 4;
ctx.strokeRect(10, 24, 492, 80);
ctx.fillStyle = color;
ctx.font = "800 39px Arial";
ctx.textAlign = "center";
ctx.textBaseline = "middle";
ctx.fillText(text, 256, 65);
const texture = new THREE.CanvasTexture(canvas);
texture.colorSpace = THREE.SRGBColorSpace;
const sprite = new THREE.Sprite(
new THREE.SpriteMaterial({
map: texture,
transparent: true,
depthTest: false,
depthWrite: false
})
);
sprite.scale.set(7.6, 1.9, 1);
sprite.renderOrder = 18;
return sprite;
}
function createPressure(
parent,
letter,
color,
x,
z,
baseY,
caption
) {
const marker = new THREE.Group();
marker.position.set(x, baseY, z);
const ring = new THREE.Mesh(
new THREE.TorusGeometry(1.9, 0.09, 6, 36),
new THREE.MeshBasicMaterial({
color,
transparent: true,
opacity: 0.8,
depthWrite: false
})
);
ring.rotation.x = Math.PI / 2;
marker.add(ring);
const disc = new THREE.Mesh(
new THREE.CylinderGeometry(1.72, 1.72, 0.045, 24),
new THREE.MeshBasicMaterial({
color,
transparent: true,
opacity: 0.12,
depthWrite: false
})
);
marker.add(disc);
const badge = pressureSprite(letter, color);
badge.position.y = 3.2;
marker.add(badge);
const captionLabel = captionSprite(caption, color);
captionLabel.position.y = 1.25;
marker.add(captionLabel);
marker.userData.ring = ring;
marker.userData.phase = random() * Math.PI * 2;
animatedPressure.push(marker);
parent.add(marker);
}
function createFlow(parent, points, type = "wind", speed = 0.055) {
const curve = new THREE.CatmullRomCurve3(
points.map((point) => new THREE.Vector3(...point)),
false,
"catmullrom",
0.28
);
const isMoisture = type === "moisture";
const color = isMoisture ? 0x54ddd4 : 0xf1c27c;
if (isMoisture) {
const tube = new THREE.Mesh(
new THREE.TubeGeometry(curve, 64, 0.105, 5, false),
new THREE.MeshBasicMaterial({
color,
transparent: true,
opacity: 0.62,
depthWrite: false
})
);
parent.add(tube);
} else {
const line = new THREE.Line(
new THREE.BufferGeometry().setFromPoints(curve.getPoints(100)),
new THREE.LineDashedMaterial({
color,
dashSize: 0.75,
gapSize: 0.48,
transparent: true,
opacity: 0.82
})
);
line.computeLineDistances();
parent.add(line);
}
const markerCount = isMoisture ? 6 : 4;
const markers = [];
for (let i = 0; i < markerCount; i++) {
const marker = isMoisture
? new THREE.Mesh(
new THREE.SphereGeometry(0.16, 7, 5),
new THREE.MeshBasicMaterial({ color })
)
: new THREE.Mesh(
new THREE.ConeGeometry(0.27, 0.78, 5),
new THREE.MeshBasicMaterial({ color })
);
marker.renderOrder = 8;
parent.add(marker);
markers.push(marker);
}
animatedFlows.push({
curve,
markers,
type,
speed,
offset: random()
});
}
function createCloud(parent, x, z, scale = 1, color = 0xd7e3df) {
const cloud = new THREE.Group();
cloud.position.set(x, 6.2, z);
cloud.userData.baseY = 6.2;
cloud.userData.phase = random() * Math.PI * 2;
const material = new THREE.MeshStandardMaterial({
color,
flatShading: true,
roughness: 1,
transparent: true,
opacity: 0.92
});
const pieces = [
[-1.05, 0, 0.1, 0.95],
[0, 0.2, 0, 1.18],
[1.1, -0.05, 0.15, 0.9],
[-0.35, -0.22, 0.25, 0.88],
[0.55, -0.2, -0.1, 0.85]
];
pieces.forEach(([px, py, pz, size]) => {
const puff = new THREE.Mesh(
new THREE.IcosahedronGeometry(size, 1),
material
);
puff.position.set(px, py, pz);
puff.scale.set(1.25, 0.72, 1);
puff.castShadow = true;
cloud.add(puff);
});
cloud.scale.setScalar(scale);
parent.add(cloud);
animatedClouds.push(cloud);
}
// Summer: warm ocean, low pressure over heated land, moist onshore flow.
const summerGroup = new THREE.Group();
scene.add(summerGroup);
createPressure(
summerGroup,
"H",
"#ff9b67",
-16,
13,
0.16,
"HIGH — WARM OCEAN"
);
createPressure(
summerGroup,
"L",
"#79b9ff",
12,
-2,
0.83,
"LOW — HEATED LAND"
);
createFlow(
summerGroup,
[
[-23, 1.2, 12],
[-17, 1.7, 10],
[-9, 2.3, 7],
[-1, 3.0, 3],
[9, 4.0, -1],
[18, 4.5, -6]
],
"wind",
0.055
);
createFlow(
summerGroup,
[
[-11, 1.1, 16],
[-6, 1.6, 12],
[1, 2.4, 8],
[8, 3.5, 3],
[12, 4.2, -1]
],
"wind",
0.048
);
createFlow(
summerGroup,
[
[-22, 1.3, 5],
[-16, 1.8, 3],
[-10, 2.4, 4],
[-3, 3.0, 6],
[4, 3.7, 8]
],
"wind",
0.043
);
createFlow(
summerGroup,
[
[-20, 0.78, 13],
[-14, 0.95, 10],
[-8, 1.25, 8],
[-1, 1.65, 4],
[6, 2.7, 0],
[12, 4.2, -2]
],
"moisture",
0.035
);
createFlow(
summerGroup,
[
[-8, 0.8, 15],
[-3, 1.0, 12],
[2, 1.4, 8],
[7, 2.4, 4],
[12, 4.2, -2]
],
"moisture",
0.031
);
createCloud(summerGroup, 10, -2, 1.25);
createCloud(summerGroup, 15, 1, 0.95, 0xcbd9d5);
createCloud(summerGroup, 7, -6, 0.82, 0xd3dfdb);
const summerMoistureTag = tagSprite(
"MOISTURE PATH",
"#54ddd4",
"rgba(9, 43, 49, 0.88)"
);
summerMoistureTag.position.set(-9, 2.4, 9.5);
summerGroup.add(summerMoistureTag);
const summerWindTag = tagSprite(
"ONSHORE WIND",
"#f1c27c",
"rgba(45, 34, 20, 0.88)"
);
summerWindTag.position.set(15.5, 5.1, -4.5);
summerGroup.add(summerWindTag);
// Rain streaks beneath the summer clouds.
const rainCount = 135;
const rainPositions = new Float32Array(rainCount * 6);
const rainDrops = [];
for (let i = 0; i < rainCount; i++) {
const drop = {
x: 4 + random() * 14,
y: 1.3 + random() * 6,
z: -8 + random() * 14,
speed: 4.5 + random() * 4,
length: 0.35 + random() * 0.4
};
rainDrops.push(drop);
}
const rainGeometry = new THREE.BufferGeometry();
rainGeometry.setAttribute(
"position",
new THREE.BufferAttribute(rainPositions, 3)
);
const rain = new THREE.LineSegments(
rainGeometry,
new THREE.LineBasicMaterial({
color: 0x9fd9dc,
transparent: true,
opacity: 0.46
})
);
summerGroup.add(rain);
// Winter: high pressure over cool land, dry wind toward the ocean.
const winterGroup = new THREE.Group();
winterGroup.visible = false;
scene.add(winterGroup);
createPressure(
winterGroup,
"H",
"#ff9b67",
12,
-2,
0.83,
"HIGH — COOL LAND"
);
createPressure(
winterGroup,
"L",
"#79b9ff",
-9,
13,
0.16,
"LOW — WARMER OCEAN"
);
createFlow(
winterGroup,
[
[20, 3.1, -6],
[14, 3.0, -1],
[6, 2.6, 4],
[-4, 2.1, 8],
[-15, 1.7, 11]
],
"wind",
0.05
);
createFlow(
winterGroup,
[
[17, 2.9, 0],
[11, 2.6, 3],
[4, 2.2, 6],
[-6, 1.9, 9],
[-15, 1.7, 12]
],
"wind",
0.043
);
createFlow(
winterGroup,
[
[20, 3.0, -9],
[13, 2.8, -5],
[7, 2.5, -1],
[1, 2.2, 3],
[-7, 1.8, 6]
],
"wind",
0.039
);
// Moisture remains largely over the sea and does not cross the coast.
createFlow(
winterGroup,
[
[-19, 0.78, 13],
[-15, 0.82, 11],
[-12, 0.86, 10],
[-10, 0.88, 9]
],
"moisture",
0.024
);
createCloud(winterGroup, -18, 8, 0.68, 0xb9c9c6);
createCloud(winterGroup, -14, 13, 0.55, 0xc5d2cf);
const winterMoistureTag = tagSprite(
"MOISTURE REMAINS OFFSHORE",
"#54ddd4",
"rgba(9, 43, 49, 0.88)"
);
winterMoistureTag.position.set(-15, 2.0, 11.5);
winterMoistureTag.scale.set(10.6, 1.9, 1);
winterGroup.add(winterMoistureTag);
const winterWindTag = tagSprite(
"OFFSHORE WIND",
"#f1c27c",
"rgba(45, 34, 20, 0.88)"
);
winterWindTag.position.set(-10, 2.7, 8);
winterGroup.add(winterWindTag);
// Manual camera controls, implemented without addons.
const cameraTarget = new THREE.Vector3(0, 0.6, 0);
const defaultCamera = {
radius: 67,
theta: 0.72,
phi: 0.83
};
let radius = defaultCamera.radius;
let theta = defaultCamera.theta;
let phi = defaultCamera.phi;
const pointers = new Map();
let pointerPrevious = null;
let previousPinchDistance = 0;
function updateCamera() {
const sinPhi = Math.sin(phi);
camera.position.set(
cameraTarget.x + radius * sinPhi * Math.sin(theta),
cameraTarget.y + radius * Math.cos(phi),
cameraTarget.z + radius * sinPhi * Math.cos(theta)
);
camera.lookAt(cameraTarget);
}
function resetCamera() {
radius = defaultCamera.radius;
theta = defaultCamera.theta;
phi = defaultCamera.phi;
}
renderer.domElement.addEventListener("pointerdown", (event) => {
renderer.domElement.setPointerCapture(event.pointerId);
pointers.set(event.pointerId, {
x: event.clientX,
y: event.clientY
});
pointerPrevious = {
x: event.clientX,
y: event.clientY
};
if (pointers.size === 2) {
const values = [...pointers.values()];
previousPinchDistance = Math.hypot(
values[0].x - values[1].x,
values[0].y - values[1].y
);
}
});
renderer.domElement.addEventListener("pointermove", (event) => {
if (!pointers.has(event.pointerId)) return;
pointers.set(event.pointerId, {
x: event.clientX,
y: event.clientY
});
if (pointers.size === 1 && pointerPrevious) {
const dx = event.clientX - pointerPrevious.x;
const dy = event.clientY - pointerPrevious.y;
theta -= dx * 0.006;
phi = THREE.MathUtils.clamp(phi + dy * 0.005, 0.35, 1.34);
pointerPrevious = {
x: event.clientX,
y: event.clientY
};
} else if (pointers.size === 2) {
const values = [...pointers.values()];
const distance = Math.hypot(
values[0].x - values[1].x,
values[0].y - values[1].y
);
if (previousPinchDistance > 0) {
radius = THREE.MathUtils.clamp(
radius * (previousPinchDistance / distance),
38,
98
);
}
previousPinchDistance = distance;
}
});
function releasePointer(event) {
pointers.delete(event.pointerId);
if (pointers.size === 1) {
const remaining = [...pointers.values()][0];
pointerPrevious = {
x: remaining.x,
y: remaining.y
};
} else {
pointerPrevious = null;
previousPinchDistance = 0;
}
}
renderer.domElement.addEventListener(
"pointerup",
releasePointer
);
renderer.domElement.addEventListener(
"pointercancel",
releasePointer
);
renderer.domElement.addEventListener(
"wheel",
(event) => {
event.preventDefault();
radius = THREE.MathUtils.clamp(
radius * Math.exp(event.deltaY * 0.001),
38,
98
);
},
{ passive: false }
);
renderer.domElement.addEventListener("dblclick", resetCamera);
// Seasonal UI
const seasonButtons = [...document.querySelectorAll(".season-button")];
const pressureA = document.querySelector("#pressure-a");
const pressureB = document.querySelector("#pressure-b");
const pressureAText = document.querySelector("#pressure-a-text");
const pressureBText = document.querySelector("#pressure-b-text");
const detailCopy = document.querySelector("#detail-copy");
const pauseButton = document.querySelector("#pause");
let season = "summer";
let paused = false;
let elapsed = 0;
function setSeason(nextSeason) {
season = nextSeason;
const isSummer = season === "summer";
summerGroup.visible = isSummer;
winterGroup.visible = !isSummer;
document.body.dataset.season = season;
seasonButtons.forEach((button) => {
const active = button.dataset.season === season;
button.classList.toggle("active", active);
button.setAttribute("aria-pressed", String(active));
});
if (isSummer) {
pressureA.textContent = "H";
pressureA.className = "pressure-symbol high";
pressureAText.textContent = "warm ocean";
pressureB.textContent = "L";
pressureB.className = "pressure-symbol low";
pressureBText.textContent = "heated land";
detailCopy.textContent =
"Moist air crosses the coast, rises over warm land, and supports clouds and rain.";
} else {
pressureA.textContent = "H";
pressureA.className = "pressure-symbol high";
pressureAText.textContent = "cool land";
pressureB.textContent = "L";
pressureB.className = "pressure-symbol low";
pressureBText.textContent = "warmer ocean";
detailCopy.textContent =
"Cool, stable air flows from land toward the ocean; moisture remains mostly offshore and rain is suppressed.";
}
}
seasonButtons.forEach((button) => {
button.addEventListener("click", () => {
setSeason(button.dataset.season);
});
});
function togglePause() {
paused = !paused;
pauseButton.textContent = paused ? "Resume flow" : "Pause flow";
pauseButton.setAttribute("aria-pressed", String(paused));
}
pauseButton.addEventListener("click", togglePause);
document.querySelector("#reset-view").addEventListener("click", resetCamera);
window.addEventListener("keydown", (event) => {
if (event.code === "Space") {
event.preventDefault();
togglePause();
}
if (event.key === "1") setSeason("summer");
if (event.key === "2") setSeason("winter");
if (event.key.toLowerCase() === "r") resetCamera();
});
// Animation
const up = new THREE.Vector3(0, 1, 0);
function updateFlows(time) {
animatedFlows.forEach((flow) => {
const { curve, markers, type, speed, offset } = flow;
markers.forEach((marker, index) => {
const t =
(time * speed + offset + index / markers.length) % 1;
const point = curve.getPointAt(t);
const tangent = curve.getTangentAt(t).normalize();
marker.position.copy(point);
if (type === "wind") {
marker.quaternion.setFromUnitVectors(up, tangent);
} else {
const pulse = 1 + Math.sin(time * 3.4 + index) * 0.18;
marker.scale.setScalar(pulse);
}
});
});
}
function updatePressure(time) {
animatedPressure.forEach((marker) => {
const pulse =
1 + Math.sin(time * 1.8 + marker.userData.phase) * 0.075;
marker.userData.ring.scale.setScalar(pulse);
});
}
function updateClouds(time) {
animatedClouds.forEach((cloud) => {
cloud.position.y =
cloud.userData.baseY +
Math.sin(time * 0.6 + cloud.userData.phase) * 0.15;
});
}
function updateRain(dt) {
const position = rainGeometry.attributes.position;
rainDrops.forEach((drop, index) => {
drop.y -= drop.speed * dt;
if (drop.y < 0.9) {
drop.y = 7 + random() * 1.5;
drop.x = 4 + random() * 14;
drop.z = -8 + random() * 14;
}
const offset = index * 6;
position.array[offset] = drop.x;
position.array[offset + 1] = drop.y;
position.array[offset + 2] = drop.z;
position.array[offset + 3] = drop.x + 0.05;
position.array[offset + 4] = drop.y + drop.length;
position.array[offset + 5] = drop.z;
});
position.needsUpdate = true;
}
window.addEventListener("resize", () => {
camera.aspect = innerWidth / innerHeight;
camera.updateProjectionMatrix();
renderer.setSize(innerWidth, innerHeight);
renderer.setPixelRatio(Math.min(devicePixelRatio, 2));
});
let previousTime = performance.now();
function animate(now) {
requestAnimationFrame(animate);
const dt = Math.min((now - previousTime) / 1000, 0.05);
previousTime = now;
if (!paused) {
elapsed += dt;
updateRain(dt);
}
updateFlows(elapsed);
updatePressure(elapsed);
updateClouds(elapsed);
updateCamera();
renderer.render(scene, camera);
}
setSeason("summer");
updateCamera();
requestAnimationFrame(animate);
requestAnimationFrame(() => {
loading.classList.add("hidden");
setTimeout(() => loading.remove(), 400);
});
</script>
</body>
</html>
```