Prompt specification
Build or customize the Three.js 3D scene "Three Symbols and Their Legend Tiles" 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: Three Symbols and Their Legend Tiles
Category: Art & Culture · Style: Procedural Solid / Shader 3D
License: MIT · Reference: https://three3d.app/scene/three-symbols-and-their-legend-tiles-x3417
Scene Description Prompt:
Three stylized abstract symbols sit beside a legend assigning explicit fictional meanings. Make one HTML scene with Three.js from cdnjs.
Working Three.js Starter (three-symbols-and-their-legend-tiles-x3417):
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Three Signs — A Fictional Visual Language</title>
<style>
:root {
--paper: #eee8dc;
--ink: #22242a;
--panel: #171a20;
--panel-muted: #a6a9ae;
--gold: #dda336;
--teal: #28a6a0;
--violet: #9278ee;
}
* {
box-sizing: border-box;
}
html,
body {
margin: 0;
min-height: 100%;
background: var(--paper);
color: var(--ink);
font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont,
"Segoe UI", sans-serif;
}
body {
overflow: hidden;
}
button {
font: inherit;
}
#app {
display: grid;
grid-template-columns: minmax(0, 1fr) 370px;
width: 100%;
height: 100dvh;
}
#viewport {
position: relative;
min-width: 0;
overflow: hidden;
background:
radial-gradient(circle at 48% 40%, rgba(255, 255, 255, 0.72), transparent 44%),
var(--paper);
}
#viewport canvas {
position: absolute;
inset: 0;
display: block;
width: 100%;
height: 100%;
touch-action: none;
cursor: grab;
}
#viewport canvas:active {
cursor: grabbing;
}
.scene-heading {
position: absolute;
z-index: 2;
top: 34px;
left: 38px;
max-width: 360px;
pointer-events: none;
}
.eyebrow {
margin: 0 0 13px;
color: #77746d;
font-size: 10px;
font-weight: 750;
letter-spacing: 0.22em;
text-transform: uppercase;
}
.scene-heading h1 {
margin: 0;
max-width: 330px;
font-family: Georgia, "Times New Roman", serif;
font-size: clamp(30px, 3vw, 48px);
font-weight: 400;
line-height: 0.98;
letter-spacing: -0.045em;
}
.scene-heading h1 em {
color: #77746d;
font-weight: 400;
}
.scene-heading .subtitle {
max-width: 280px;
margin: 16px 0 0;
color: #77746d;
font-size: 12px;
line-height: 1.55;
}
.scene-tools {
position: absolute;
z-index: 3;
right: 28px;
top: 30px;
display: flex;
align-items: center;
gap: 10px;
}
#reset-view {
appearance: none;
border: 1px solid rgba(34, 36, 42, 0.2);
border-radius: 999px;
padding: 10px 15px;
color: var(--ink);
background: rgba(255, 255, 255, 0.46);
backdrop-filter: blur(10px);
cursor: pointer;
font-size: 11px;
font-weight: 700;
letter-spacing: 0.04em;
transition:
background 160ms ease,
transform 160ms ease;
}
#reset-view:hover {
background: rgba(255, 255, 255, 0.82);
transform: translateY(-1px);
}
.hint {
position: absolute;
z-index: 2;
left: 38px;
bottom: 28px;
color: #77746d;
font-size: 10px;
font-weight: 650;
letter-spacing: 0.08em;
text-transform: uppercase;
pointer-events: none;
}
.hint span {
margin: 0 7px;
color: #b4afa4;
}
#legend {
position: relative;
z-index: 5;
overflow-y: auto;
padding: 42px 30px 30px;
color: #f4f0e8;
background:
radial-gradient(circle at 90% 0%, rgba(146, 120, 238, 0.13), transparent 35%),
var(--panel);
box-shadow: -20px 0 60px rgba(24, 24, 28, 0.1);
}
#legend::before {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 3px;
content: "";
background: linear-gradient(
90deg,
var(--gold) 0 33.33%,
var(--teal) 33.33% 66.66%,
var(--violet) 66.66% 100%
);
}
.legend-kicker {
margin: 0 0 12px;
color: #7f838c;
font-size: 9px;
font-weight: 750;
letter-spacing: 0.22em;
text-transform: uppercase;
}
#legend h2 {
margin: 0;
font-family: Georgia, "Times New Roman", serif;
font-size: 38px;
font-weight: 400;
letter-spacing: -0.035em;
}
.legend-intro {
max-width: 280px;
margin: 13px 0 34px;
color: var(--panel-muted);
font-size: 12px;
line-height: 1.65;
}
.legend-list {
display: grid;
gap: 10px;
}
.legend-item {
position: relative;
display: grid;
grid-template-columns: 28px 11px 1fr;
gap: 13px;
align-items: start;
width: 100%;
padding: 20px 17px;
overflow: hidden;
border: 1px solid rgba(255, 255, 255, 0.09);
border-radius: 4px;
color: inherit;
text-align: left;
background: rgba(255, 255, 255, 0.025);
cursor: pointer;
transition:
border-color 180ms ease,
background 180ms ease,
transform 180ms ease;
}
.legend-item::after {
position: absolute;
inset: 0 auto 0 0;
width: 2px;
content: "";
background: var(--accent);
opacity: 0;
transition: opacity 180ms ease;
}
.legend-item:hover,
.legend-item:focus-visible,
.legend-item[aria-pressed="true"] {
border-color: rgba(255, 255, 255, 0.18);
background: rgba(255, 255, 255, 0.065);
transform: translateX(-3px);
outline: none;
}
.legend-item:hover::after,
.legend-item:focus-visible::after,
.legend-item[aria-pressed="true"]::after {
opacity: 1;
}
.legend-number {
padding-top: 2px;
color: #777b84;
font-size: 9px;
font-weight: 750;
letter-spacing: 0.12em;
}
.legend-swatch {
width: 9px;
height: 9px;
margin-top: 3px;
border-radius: 50%;
background: var(--accent);
box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 13%, transparent);
}
.legend-copy strong {
display: block;
margin-bottom: 7px;
color: #f6f2ea;
font-size: 12px;
font-weight: 750;
letter-spacing: 0.12em;
text-transform: uppercase;
}
.legend-copy span {
display: block;
color: #b8bbc0;
font-family: Georgia, "Times New Roman", serif;
font-size: 17px;
line-height: 1.35;
}
.legend-note {
margin: 31px 0 0;
padding-top: 21px;
border-top: 1px solid rgba(255, 255, 255, 0.09);
color: #737780;
font-size: 10px;
line-height: 1.65;
}
.legend-note strong {
display: block;
margin-bottom: 7px;
color: #a3a6ac;
font-size: 9px;
letter-spacing: 0.14em;
text-transform: uppercase;
}
#status {
min-height: 28px;
margin-top: 20px;
color: #777b84;
font-size: 9px;
line-height: 1.5;
letter-spacing: 0.04em;
}
@media (max-width: 820px) {
body {
overflow: auto;
}
#app {
display: block;
height: auto;
}
#viewport {
height: 64svh;
min-height: 470px;
}
#legend {
min-height: 520px;
padding: 36px 24px;
}
.scene-heading {
top: 25px;
left: 24px;
}
.scene-heading h1 {
font-size: 34px;
}
.scene-heading .subtitle {
display: none;
}
.scene-tools {
top: 22px;
right: 20px;
}
.hint {
left: 24px;
bottom: 22px;
font-size: 8px;
}
}
@media (max-width: 520px) {
#viewport {
height: 58svh;
min-height: 420px;
}
.scene-heading h1 {
font-size: 29px;
}
.eyebrow {
font-size: 8px;
}
#reset-view {
padding: 9px 12px;
font-size: 9px;
}
.hint {
max-width: 270px;
line-height: 1.8;
}
.hint span {
margin: 0 4px;
}
}
</style>
</head>
<body>
<main id="app">
<section id="viewport" aria-label="Interactive scene with three abstract symbols">
<header class="scene-heading">
<p class="eyebrow">Field study / 03</p>
<h1>Three Signs of a <em>Quiet Language</em></h1>
<p class="subtitle">
An invented visual vocabulary for ideas that do not yet have words.
</p>
</header>
<div class="scene-tools">
<button id="reset-view" type="button">Reset view</button>
</div>
<div class="hint" aria-hidden="true">
Drag to orbit <span>·</span> Scroll to zoom <span>·</span> Select to focus
</div>
</section>
<aside id="legend" aria-labelledby="legend-title">
<p class="legend-kicker">Fictional symbol index</p>
<h2 id="legend-title">Legend</h2>
<p class="legend-intro">
Every shape has one assigned meaning. Select a form to isolate it in the field.
</p>
<div class="legend-list">
<button
class="legend-item"
type="button"
data-symbol="aureole"
style="--accent: var(--gold)"
aria-pressed="false"
>
<span class="legend-number">01</span>
<span class="legend-swatch" aria-hidden="true"></span>
<span class="legend-copy">
<strong>Aureole</strong>
<span>A shared center of attention.</span>
</span>
</button>
<button
class="legend-item"
type="button"
data-symbol="current"
style="--accent: var(--teal)"
aria-pressed="false"
>
<span class="legend-number">02</span>
<span class="legend-swatch" aria-hidden="true"></span>
<span class="legend-copy">
<strong>Current</strong>
<span>An idea moving through a system.</span>
</span>
</button>
<button
class="legend-item"
type="button"
data-symbol="threshold"
style="--accent: var(--violet)"
aria-pressed="false"
>
<span class="legend-number">03</span>
<span class="legend-swatch" aria-hidden="true"></span>
<span class="legend-copy">
<strong>Threshold</strong>
<span>A decision that opens into two paths.</span>
</span>
</button>
</div>
<p class="legend-note">
<strong>About this language</strong>
These meanings are invented for this fictional visual system and do not
refer to established symbols.
</p>
<div id="status" aria-live="polite">
Three symbols are currently in view.
</div>
</aside>
</main>
<script type="module">
import * as THREE from "https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
const viewport = document.querySelector("#viewport");
const legendItems = [...document.querySelectorAll(".legend-item")];
const resetButton = document.querySelector("#reset-view");
const status = document.querySelector("#status");
const symbolData = {
aureole: {
name: "Aureole",
meaning: "A shared center of attention.",
color: 0xdda336,
x: -2.7
},
current: {
name: "Current",
meaning: "An idea moving through a system.",
color: 0x28a6a0,
x: 0
},
threshold: {
name: "Threshold",
meaning: "A decision that opens into two paths.",
color: 0x9278ee,
x: 2.7
}
};
// ---------------------------------------------------------------------
// Renderer, camera, and scene
// ---------------------------------------------------------------------
const scene = new THREE.Scene();
scene.background = new THREE.Color(0xeee8dc);
scene.fog = new THREE.Fog(0xeee8dc, 12, 27);
const camera = new THREE.PerspectiveCamera(38, 1, 0.1, 100);
const renderer = new THREE.WebGLRenderer({
antialias: true,
powerPreference: "high-performance"
});
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1.08;
renderer.domElement.setAttribute(
"aria-label",
"Three abstract sculptures representing Aureole, Current, and Threshold"
);
viewport.prepend(renderer.domElement);
const hemisphere = new THREE.HemisphereLight(0xfff8e8, 0x59616e, 2.15);
scene.add(hemisphere);
const keyLight = new THREE.DirectionalLight(0xfff4df, 3.1);
keyLight.position.set(4.5, 8, 5.5);
keyLight.castShadow = true;
keyLight.shadow.mapSize.set(2048, 2048);
keyLight.shadow.camera.left = -8;
keyLight.shadow.camera.right = 8;
keyLight.shadow.camera.top = 8;
keyLight.shadow.camera.bottom = -8;
keyLight.shadow.camera.near = 0.5;
keyLight.shadow.camera.far = 25;
keyLight.shadow.bias = -0.00025;
scene.add(keyLight);
const rimLight = new THREE.DirectionalLight(0x9eb7ff, 1.35);
rimLight.position.set(-5, 4.5, -5);
scene.add(rimLight);
const warmFill = new THREE.PointLight(0xffc477, 16, 12, 2);
warmFill.position.set(-4, 2.5, 3);
scene.add(warmFill);
// ---------------------------------------------------------------------
// Ground and stage
// ---------------------------------------------------------------------
const floorMaterial = new THREE.MeshStandardMaterial({
color: 0xe7e0d4,
roughness: 0.94,
metalness: 0
});
const floor = new THREE.Mesh(
new THREE.PlaneGeometry(30, 30),
floorMaterial
);
floor.rotation.x = -Math.PI / 2;
floor.position.y = -0.015;
floor.receiveShadow = true;
scene.add(floor);
const grid = new THREE.GridHelper(18, 36, 0xb8b0a2, 0xc9c1b5);
grid.position.y = 0.004;
grid.material.transparent = true;
grid.material.opacity = 0.19;
scene.add(grid);
const pedestalMaterial = new THREE.MeshStandardMaterial({
color: 0xd9d0c1,
roughness: 0.78,
metalness: 0.02
});
const pedestalTopMaterial = new THREE.MeshStandardMaterial({
color: 0xf4eee4,
roughness: 0.62,
metalness: 0.02
});
Object.values(symbolData).forEach((data) => {
const pedestal = new THREE.Mesh(
new THREE.CylinderGeometry(0.91, 1.03, 0.36, 56),
pedestalMaterial
);
pedestal.position.set(data.x, 0.18, 0);
pedestal.castShadow = true;
pedestal.receiveShadow = true;
scene.add(pedestal);
const top = new THREE.Mesh(
new THREE.CylinderGeometry(0.9, 0.9, 0.075, 56),
pedestalTopMaterial
);
top.position.set(data.x, 0.405, 0);
top.castShadow = true;
top.receiveShadow = true;
scene.add(top);
const accent = new THREE.Mesh(
new THREE.TorusGeometry(0.81, 0.024, 8, 64),
new THREE.MeshStandardMaterial({
color: data.color,
roughness: 0.38,
metalness: 0.28,
emissive: data.color,
emissiveIntensity: 0.08
})
);
accent.rotation.x = Math.PI / 2;
accent.position.set(data.x, 0.447, 0);
scene.add(accent);
});
// Subtle suspended dust adds depth without distracting from the symbols.
const dustPositions = new Float32Array(240 * 3);
for (let i = 0; i < 240; i++) {
dustPositions[i * 3] = (Math.random() - 0.5) * 13;
dustPositions[i * 3 + 1] = 0.4 + Math.random() * 5.8;
dustPositions[i * 3 + 2] = -4.5 + Math.random() * 8;
}
const dustGeometry = new THREE.BufferGeometry();
dustGeometry.setAttribute(
"position",
new THREE.BufferAttribute(dustPositions, 3)
);
const dust = new THREE.Points(
dustGeometry,
new THREE.PointsMaterial({
color: 0x9d9487,
size: 0.025,
transparent: true,
opacity: 0.35,
depthWrite: false
})
);
scene.add(dust);
// ---------------------------------------------------------------------
// Shared helpers
// ---------------------------------------------------------------------
const symbols = [];
function standardMaterial(color, options = {}) {
return new THREE.MeshStandardMaterial({
color,
roughness: 0.3,
metalness: 0.28,
flatShading: false,
...options
});
}
function prepareGroup(group, key, baseY) {
group.position.set(symbolData[key].x, baseY, 0);
group.userData.key = key;
group.traverse((object) => {
if (object.isMesh) {
object.castShadow = true;
object.receiveShadow = true;
}
});
const record = {
key,
group,
baseY,
currentScale: 1,
type: key
};
symbols.push(record);
scene.add(group);
return record;
}
// ---------------------------------------------------------------------
// 01 — Aureole: a bright core surrounded by orbiting attention
// ---------------------------------------------------------------------
const aureole = new THREE.Group();
const aureoleCoreMaterial = standardMaterial(0xdda336, {
roughness: 0.24,
metalness: 0.42,
flatShading: true,
emissive: 0x7a3e00,
emissiveIntensity: 0.08
});
const aureoleCore = new THREE.Mesh(
new THREE.IcosahedronGeometry(0.54, 2),
aureoleCoreMaterial
);
aureoleCore.rotation.set(0.25, 0.35, 0.1);
aureole.add(aureoleCore);
const aureoleHaloPivot = new THREE.Group();
aureoleHaloPivot.rotation.x = 1.02;
aureoleHaloPivot.rotation.z = -0.18;
const aureoleRingMaterial = standardMaterial(0xf2c66c, {
roughness: 0.22,
metalness: 0.58
});
const aureoleRing = new THREE.Mesh(
new THREE.TorusGeometry(0.92, 0.075, 14, 96),
aureoleRingMaterial
);
aureoleHaloPivot.add(aureoleRing);
const aureoleInnerRing = new THREE.Mesh(
new THREE.TorusGeometry(0.72, 0.027, 10, 72),
standardMaterial(0x8f5f16, {
roughness: 0.36,
metalness: 0.48
})
);
aureoleInnerRing.rotation.z = 0.42;
aureoleHaloPivot.add(aureoleInnerRing);
const aureoleSatellite = new THREE.Mesh(
new THREE.SphereGeometry(0.13, 24, 16),
standardMaterial(0x262a30, {
roughness: 0.26,
metalness: 0.5
})
);
aureoleSatellite.position.x = 1.02;
aureoleHaloPivot.add(aureoleSatellite);
aureole.add(aureoleHaloPivot);
const aureoleRecord = prepareGroup(aureole, "aureole", 1.58);
aureoleRecord.haloPivot = aureoleHaloPivot;
// ---------------------------------------------------------------------
// 02 — Current: an idea circulating through a connected system
// ---------------------------------------------------------------------
const current = new THREE.Group();
const currentKnot = new THREE.Mesh(
new THREE.TorusKnotGeometry(0.63, 0.16, 144, 22, 2, 3),
standardMaterial(0x28a6a0, {
roughness: 0.27,
metalness: 0.38,
flatShading: true,
emissive: 0x073c3a,
emissiveIntensity: 0.07
})
);
currentKnot.rotation.x = 0.12;
current.add(currentKnot);
const currentOrbit = new THREE.Mesh(
new THREE.TorusGeometry(0.94, 0.022, 10, 80),
standardMaterial(0x1d5b5a, {
roughness: 0.4,
metalness: 0.35
})
);
currentOrbit.rotation.set(0.9, 0.35, -0.2);
current.add(currentOrbit);
const currentBeads = [
[0.69, 0.15, 0.12],
[-0.23, 0.66, 0.18],
[-0.54, -0.4, 0.16]
];
currentBeads.forEach((position) => {
const bead = new THREE.Mesh(
new THREE.SphereGeometry(0.095, 18, 12),
standardMaterial(0xd7f1e7, {
roughness: 0.34,
metalness: 0.12
})
);
bead.position.set(...position);
current.add(bead);
});
const currentRecord = prepareGroup(current, "current", 1.58);
currentRecord.knot = currentKnot;
currentRecord.orbit = currentOrbit;
// ---------------------------------------------------------------------
// 03 — Threshold: one decision opening into two separate paths
// ---------------------------------------------------------------------
const threshold = new THREE.Group();
function createThresholdPlate(side) {
const shape = new THREE.Shape();
if (side < 0) {
shape.moveTo(-0.06, -0.96);
shape.lineTo(-0.82, -0.35);
shape.lineTo(-0.66, 0.88);
shape.lineTo(-0.04, 0.47);
shape.closePath();
} else {
shape.moveTo(0.06, -0.96);
shape.lineTo(0.82, -0.35);
shape.lineTo(0.66, 0.88);
shape.lineTo(0.04, 0.47);
shape.closePath();
}
const geometry = new THREE.ExtrudeGeometry(shape, {
depth: 0.24,
steps: 1,
bevelEnabled: true,
bevelSegments: 4,
bevelSize: 0.055,
bevelThickness: 0.055,
curveSegments: 8
});
geometry.translate(0, 0, -0.12);
return new THREE.Mesh(
geometry,
standardMaterial(side < 0 ? 0x7657db : 0xa38cf4, {
roughness: 0.3,
metalness: 0.32,
flatShading: true
})
);
}
const thresholdLeft = createThresholdPlate(-1);
const thresholdRight = createThresholdPlate(1);
thresholdLeft.position.x = -0.13;
thresholdRight.position.x = 0.13;
threshold.add(thresholdLeft, thresholdRight);
const thresholdCore = new THREE.Mesh(
new THREE.OctahedronGeometry(0.16, 0),
standardMaterial(0x302747, {
roughness: 0.26,
metalness: 0.42,
emissive: 0x5e43bb,
emissiveIntensity: 0.25
})
);
thresholdCore.position.set(0, 0.02, 0.09);
threshold.add(thresholdCore);
const thresholdRecord = prepareGroup(threshold, "threshold", 1.58);
thresholdRecord.left = thresholdLeft;
thresholdRecord.right = thresholdRight;
thresholdRecord.core = thresholdCore;
// ---------------------------------------------------------------------
// Custom camera controls — no OrbitControls or other addons
// ---------------------------------------------------------------------
let yaw = 0.08;
let pitch = 0.19;
let defaultRadius = 10.2;
let desiredRadius = defaultRadius;
let currentRadius = defaultRadius;
const cameraTarget = new THREE.Vector3(0, 1.25, 0);
const desiredTarget = cameraTarget.clone();
let hoveredKey = null;
let selectedKey = null;
function updateCamera() {
const horizontalRadius = Math.cos(pitch) * currentRadius;
camera.position.set(
cameraTarget.x + Math.sin(yaw) * horizontalRadius,
cameraTarget.y + Math.sin(pitch) * currentRadius,
cameraTarget.z + Math.cos(yaw) * horizontalRadius
);
camera.lookAt(cameraTarget);
}
function focusSymbol(key) {
selectedKey = key;
legendItems.forEach((item) => {
item.setAttribute(
"aria-pressed",
String(item.dataset.symbol === selectedKey)
);
});
if (key) {
const data = symbolData[key];
desiredTarget.set(data.x, 1.5, 0);
desiredRadius = 6.6;
status.textContent = `${data.name} — ${data.meaning}`;
} else {
desiredTarget.set(0, 1.25, 0);
desiredRadius = defaultRadius;
status.textContent = "Three symbols are currently in view.";
}
}
resetButton.addEventListener("click", () => {
focusSymbol(null);
});
legendItems.forEach((item) => {
const key = item.dataset.symbol;
item.addEventListener("pointerenter", () => {
hoveredKey = key;
});
item.addEventListener("pointerleave", () => {
hoveredKey = null;
});
item.addEventListener("focus", () => {
hoveredKey = key;
});
item.addEventListener("blur", () => {
hoveredKey = null;
});
item.addEventListener("click", () => {
focusSymbol(key);
});
});
// ---------------------------------------------------------------------
// Pointer picking and direct camera manipulation
// ---------------------------------------------------------------------
const raycaster = new THREE.Raycaster();
const pointer = new THREE.Vector2();
let pointerStart = null;
let pointerLast = null;
let didDrag = false;
function pickSymbol(clientX, clientY) {
const rect = renderer.domElement.getBoundingClientRect();
pointer.x = ((clientX - rect.left) / rect.width) * 2 - 1;
pointer.y = -((clientY - rect.top) / rect.height) * 2 + 1;
raycaster.setFromCamera(pointer, camera);
const intersections = raycaster.intersectObjects(
symbols.map((symbol) => symbol.group),
true
);
if (!intersections.length) return null;
let object = intersections[0].object;
while (object && !object.userData.key) {
object = object.parent;
}
return object ? object.userData.key : null;
}
renderer.domElement.addEventListener("pointerdown", (event) => {
pointerStart = {
x: event.clientX,
y: event.clientY
};
pointerLast = {
x: event.clientX,
y: event.clientY
};
didDrag = false;
renderer.domElement.setPointerCapture(event.pointerId);
});
renderer.domElement.addEventListener("pointermove", (event) => {
if (pointerStart && pointerLast) {
const dx = event.clientX - pointerLast.x;
const dy = event.clientY - pointerLast.y;
const totalDistance = Math.hypot(
event.clientX - pointerStart.x,
event.clientY - pointerStart.y
);
if (totalDistance > 4) didDrag = true;
if (didDrag) {
yaw -= dx * 0.006;
pitch += dy * 0.0045;
pitch = THREE.MathUtils.clamp(pitch, -0.35, 0.72);
}
pointerLast = {
x: event.clientX,
y: event.clientY
};
} else {
hoveredKey = pickSymbol(event.clientX, event.clientY);
renderer.domElement.style.cursor = hoveredKey ? "pointer" : "grab";
}
});
renderer.domElement.addEventListener("pointerup", (event) => {
if (!didDrag) {
const key = pickSymbol(event.clientX, event.clientY);
if (key) {
focusSymbol(key);
} else {
focusSymbol(null);
}
}
pointerStart = null;
pointerLast = null;
if (renderer.domElement.hasPointerCapture(event.pointerId)) {
renderer.domElement.releasePointerCapture(event.pointerId);
}
});
renderer.domElement.addEventListener("pointercancel", () => {
pointerStart = null;
pointerLast = null;
didDrag = false;
});
renderer.domElement.addEventListener("pointerleave", () => {
if (!pointerStart) hoveredKey = null;
});
renderer.domElement.addEventListener(
"wheel",
(event) => {
event.preventDefault();
desiredRadius *= Math.exp(event.deltaY * 0.001);
desiredRadius = THREE.MathUtils.clamp(desiredRadius, 4.8, 18);
},
{ passive: false }
);
// ---------------------------------------------------------------------
// Responsive sizing
// ---------------------------------------------------------------------
function resize() {
const width = Math.max(viewport.clientWidth, 1);
const height = Math.max(viewport.clientHeight, 1);
const aspect = width / height;
camera.aspect = aspect;
camera.updateProjectionMatrix();
renderer.setSize(width, height, false);
defaultRadius = aspect < 0.9 ? 15.2 : 10.2;
if (!selectedKey) {
desiredRadius = defaultRadius;
}
}
const resizeObserver = new ResizeObserver(resize);
resizeObserver.observe(viewport);
resize();
currentRadius = defaultRadius;
desiredRadius = defaultRadius;
updateCamera();
// ---------------------------------------------------------------------
// Animation
// ---------------------------------------------------------------------
const clock = new THREE.Clock();
function animate() {
const elapsed = clock.getElapsedTime();
// Smooth camera focus and zoom.
cameraTarget.lerp(desiredTarget, 0.075);
currentRadius = THREE.MathUtils.lerp(
currentRadius,
desiredRadius,
0.085
);
updateCamera();
const highlightedKey = hoveredKey || selectedKey;
symbols.forEach((symbol, index) => {
const targetScale = symbol.key === highlightedKey ? 1.075 : 1;
symbol.currentScale = THREE.MathUtils.lerp(
symbol.currentScale,
targetScale,
0.1
);
symbol.group.scale.setScalar(symbol.currentScale);
symbol.group.position.y =
symbol.baseY + Math.sin(elapsed * 1.05 + index * 1.7) * 0.055;
});
// Aureole: the halo and satellite rotate around the central core.
aureoleRecord.haloPivot.rotation.z = -0.18 + elapsed * 0.24;
aureoleRecord.haloPivot.rotation.y =
Math.sin(elapsed * 0.48) * 0.14;
// Current: the connected form circulates through its surrounding orbit.
currentRecord.knot.rotation.y = elapsed * 0.27;
currentRecord.knot.rotation.x = 0.12 + Math.sin(elapsed * 0.55) * 0.1;
currentRecord.orbit.rotation.z = elapsed * -0.12;
// Threshold: the two paths breathe open and closed around the decision.
const opening = 0.035 + (Math.sin(elapsed * 0.78) + 1) * 0.035;
thresholdRecord.left.position.x = -0.13 - opening;
thresholdRecord.right.position.x = 0.13 + opening;
thresholdRecord.core.rotation.y = elapsed * 0.48;
thresholdRecord.core.rotation.z = elapsed * 0.22;
dust.rotation.y = elapsed * 0.012;
dust.position.y = Math.sin(elapsed * 0.12) * 0.08;
renderer.render(scene, camera);
}
renderer.setAnimationLoop(animate);
</script>
</body>
</html>
```