Prompt specification
Build or customize the Three.js 3D scene "Neighborhood Oral-History 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: Neighborhood Oral-History Exhibit
Category: Voxel Worlds · Style: Voxel 3D
License: MIT · Reference: https://three3d.app/scene/neighborhood-oral-history-exhibit-x3211
Scene Description Prompt:
Make a standalone HTML scene with Three.js from cdnjs that depicts community memory from partial and differing accounts. Build an exhibition with audio-symbol stations, photographs represented by neutral panels, and source dates. Show how memories are compared without inventing quotations from real people. Voxel style.
Working Three.js Starter (neighborhood-oral-history-exhibit-x3211):
```html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>When the Record Shifts — Community Memory Exhibition</title>
<style>
:root {
--paper: #e8e4d9;
--ink: #252a27;
--muted: #686c66;
--line: rgba(37, 42, 39, .18);
--source-a: #3f8f8b;
--source-b: #bd694b;
--unknown: #d3c8ac;
--panel: rgba(244, 241, 232, .94);
}
* { box-sizing: border-box; }
html, body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: #d8d4c9;
color: var(--ink);
font-family: Inter, ui-sans-serif, system-ui, -apple-system,
BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button {
font: inherit;
}
#scene {
position: fixed;
inset: 0;
}
#scene canvas {
display: block;
width: 100%;
height: 100%;
touch-action: none;
outline: none;
}
.masthead {
position: fixed;
z-index: 5;
top: 24px;
left: 28px;
width: min(430px, calc(100vw - 56px));
pointer-events: none;
}
.eyebrow {
display: flex;
align-items: center;
gap: 9px;
margin-bottom: 10px;
color: var(--muted);
font-size: 11px;
font-weight: 750;
letter-spacing: .16em;
text-transform: uppercase;
}
.eyebrow::before {
content: "";
width: 22px;
height: 4px;
background: var(--ink);
}
h1 {
max-width: 420px;
margin: 0;
font-size: clamp(32px, 4.2vw, 58px);
font-weight: 760;
letter-spacing: -.055em;
line-height: .98;
}
.intro {
max-width: 380px;
margin: 14px 0 0;
color: #51564f;
font-size: 13px;
line-height: 1.55;
}
.utility {
position: fixed;
z-index: 7;
top: 24px;
right: 28px;
display: flex;
gap: 8px;
}
.button {
border: 1px solid rgba(37, 42, 39, .26);
border-radius: 0;
background: rgba(244, 241, 232, .88);
color: var(--ink);
min-height: 40px;
padding: 0 14px;
cursor: pointer;
font-size: 12px;
font-weight: 720;
letter-spacing: .025em;
transition:
background .18s ease,
color .18s ease,
transform .18s ease;
}
.button:hover,
.button:focus-visible {
background: var(--ink);
color: var(--paper);
outline: none;
}
.button:active {
transform: translateY(1px);
}
.button.square {
width: 40px;
padding: 0;
font-size: 18px;
}
.legend {
position: fixed;
z-index: 5;
left: 28px;
bottom: 25px;
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 14px;
max-width: calc(100vw - 56px);
padding: 11px 13px;
border: 1px solid rgba(37, 42, 39, .14);
background: rgba(244, 241, 232, .78);
backdrop-filter: blur(8px);
pointer-events: none;
}
.legend-item {
display: flex;
align-items: center;
gap: 7px;
color: #555a53;
font-size: 11px;
font-weight: 650;
white-space: nowrap;
}
.swatch {
width: 10px;
height: 10px;
background: var(--source-a);
}
.swatch.b { background: var(--source-b); }
.swatch.u { background: var(--unknown); }
.hint {
position: fixed;
z-index: 5;
right: 28px;
bottom: 27px;
color: #555a53;
font-size: 11px;
letter-spacing: .02em;
pointer-events: none;
}
.hint strong {
color: var(--ink);
}
.compare {
position: fixed;
z-index: 8;
top: 76px;
right: 28px;
width: min(400px, calc(100vw - 32px));
max-height: calc(100vh - 104px);
overflow: auto;
border: 1px solid rgba(37, 42, 39, .24);
background: var(--panel);
box-shadow: 0 22px 70px rgba(38, 38, 31, .16);
transform: translateX(calc(100% + 48px));
opacity: 0;
pointer-events: none;
transition:
transform .34s cubic-bezier(.22, .75, .25, 1),
opacity .24s ease;
}
.compare.open {
transform: translateX(0);
opacity: 1;
pointer-events: auto;
}
.compare-head {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 16px;
padding: 20px 20px 17px;
border-bottom: 1px solid var(--line);
}
.compare-head h2 {
margin: 4px 0 0;
font-size: 24px;
letter-spacing: -.035em;
}
.counter {
color: var(--muted);
font-size: 11px;
font-weight: 750;
letter-spacing: .13em;
}
.close {
width: 34px;
height: 34px;
flex: 0 0 auto;
border: 1px solid var(--line);
background: transparent;
color: var(--ink);
cursor: pointer;
font-size: 20px;
}
.compare-body {
padding: 18px 20px 20px;
}
.safety-note {
margin: 0 0 16px;
padding: 10px 12px;
border-left: 3px solid var(--unknown);
background: rgba(211, 200, 172, .22);
color: #5a5b53;
font-size: 11px;
line-height: 1.5;
}
.records {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 10px;
}
.record {
position: relative;
min-width: 0;
padding: 14px 13px 13px;
border: 1px solid var(--line);
background: rgba(255, 255, 255, .35);
}
.record::before {
content: "";
position: absolute;
top: 0;
right: 0;
left: 0;
height: 5px;
background: var(--source-a);
}
.record.b::before {
background: var(--source-b);
}
.record-label {
color: var(--muted);
font-size: 10px;
font-weight: 780;
letter-spacing: .12em;
text-transform: uppercase;
}
.record-medium {
min-height: 42px;
margin-top: 8px;
font-size: 16px;
font-weight: 760;
line-height: 1.2;
}
.date {
margin-top: 13px;
font-size: 34px;
font-weight: 790;
letter-spacing: -.055em;
line-height: 1;
}
.date-label {
margin-top: 4px;
color: var(--muted);
font-size: 9px;
font-weight: 740;
letter-spacing: .12em;
text-transform: uppercase;
}
.precision {
display: flex;
align-items: center;
gap: 5px;
margin-top: 13px;
}
.precision span {
width: 7px;
height: 7px;
background: var(--source-a);
}
.record.b .precision span {
background: var(--source-b);
}
.precision small {
color: var(--muted);
font-size: 10px;
}
.comparison {
margin-top: 16px;
border-top: 1px solid var(--line);
}
.comparison-row {
display: grid;
grid-template-columns: 92px 1fr;
gap: 12px;
padding: 11px 0;
border-bottom: 1px solid var(--line);
font-size: 11px;
line-height: 1.5;
}
.comparison-row span:first-child {
color: var(--muted);
font-weight: 760;
text-transform: uppercase;
letter-spacing: .08em;
}
.compare-actions {
display: flex;
gap: 8px;
margin-top: 16px;
}
.compare-actions .button {
flex: 1;
}
.button.primary {
border-color: var(--ink);
background: var(--ink);
color: var(--paper);
}
.button.primary:hover,
.button.primary:focus-visible {
background: var(--source-a);
}
.loading {
position: fixed;
z-index: 20;
inset: 0;
display: grid;
place-items: center;
background: #d8d4c9;
color: var(--ink);
font-size: 12px;
font-weight: 750;
letter-spacing: .14em;
text-transform: uppercase;
transition: opacity .4s ease;
}
.loading.done {
opacity: 0;
pointer-events: none;
}
@media (max-width: 760px) {
.masthead {
top: 18px;
left: 18px;
}
h1 {
max-width: 310px;
font-size: 38px;
}
.intro {
display: none;
}
.utility {
top: 18px;
right: 18px;
}
.utility .overview-label {
display: none;
}
.compare {
top: auto;
right: 16px;
bottom: 16px;
left: 16px;
width: auto;
max-height: min(68vh, 590px);
transform: translateY(calc(100% + 32px));
}
.compare.open {
transform: translateY(0);
}
.legend {
left: 18px;
bottom: 18px;
gap: 9px;
}
.legend-item:last-child {
display: none;
}
.hint {
display: none;
}
}
@media (prefers-reduced-motion: reduce) {
*, *::before, *::after {
transition-duration: .01ms !important;
}
}
</style>
</head>
<body>
<div id="scene" aria-label="Interactive voxel exhibition of community memory"></div>
<header class="masthead">
<div class="eyebrow">Community memory / exhibition</div>
<h1>When the record shifts</h1>
<p class="intro">
An exhibition of partial accounts, source dates, and unresolved gaps.
Records are compared without reconstructing anyone’s words.
</p>
</header>
<div class="utility">
<button class="button" id="overview" type="button">
<span class="overview-label">↗ Hall view</span>
<span aria-hidden="true">⌂</span>
</button>
</div>
<aside class="compare" id="compare" aria-hidden="true" aria-live="polite">
<div class="compare-head">
<div>
<div class="counter" id="counter">STATION 01 / 04</div>
<h2 id="compareTitle">Compare paired records</h2>
</div>
<button class="close" id="closeCompare" type="button" aria-label="Close comparison">×</button>
</div>
<div class="compare-body">
<p class="safety-note">
Illustrative source dates are used for this standalone exhibit.
Audio is represented symbolically; no quotation or attributed speech is supplied.
</p>
<div class="records">
<article class="record" id="recordA">
<div class="record-label">Source A</div>
<div class="record-medium" id="mediumA"></div>
<div class="date" id="dateA"></div>
<div class="date-label">Source date</div>
<div class="precision">
<span></span>
<small id="precisionA"></small>
</div>
</article>
<article class="record b" id="recordB">
<div class="record-label">Source B</div>
<div class="record-medium" id="mediumB"></div>
<div class="date" id="dateB"></div>
<div class="date-label">Source date</div>
<div class="precision">
<span></span>
<small id="precisionB"></small>
</div>
</article>
</div>
<div class="comparison">
<div class="comparison-row">
<span>Same frame</span>
<span id="sameFrame"></span>
</div>
<div class="comparison-row">
<span>Difference</span>
<span id="difference"></span>
</div>
<div class="comparison-row">
<span>Still unknown</span>
<span>The event date, names, and relationship between the two source dates are not established.</span>
</div>
</div>
<div class="compare-actions">
<button class="button square" id="previous" type="button" aria-label="Previous station">←</button>
<button class="button primary" id="focus" type="button">Focus paired records</button>
<button class="button square" id="next" type="button" aria-label="Next station">→</button>
</div>
</div>
</aside>
<div class="legend" aria-label="Legend">
<div class="legend-item"><i class="swatch"></i> Source A date</div>
<div class="legend-item"><i class="swatch b"></i> Source B date</div>
<div class="legend-item"><i class="swatch u"></i> Unresolved / partial</div>
</div>
<div class="hint">
<strong>Click</strong> a station · <strong>Drag</strong> to orbit · <strong>Scroll</strong> to zoom
</div>
<div class="loading" id="loading">Building memory hall</div>
<noscript>This exhibition requires JavaScript and WebGL.</noscript>
<script type="module">
import * as THREE from "https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
// -------------------------------------------------------------------------
// Core setup
// -------------------------------------------------------------------------
const sceneRoot = document.querySelector("#scene");
const loading = document.querySelector("#loading");
const reducedMotion = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
const scene = new THREE.Scene();
scene.background = new THREE.Color(0xd8d4c9);
scene.fog = new THREE.Fog(0xd8d4c9, 25, 48);
const camera = new THREE.PerspectiveCamera(
46,
window.innerWidth / window.innerHeight,
0.1,
100
);
const renderer = new THREE.WebGLRenderer({
antialias: true,
powerPreference: "high-performance"
});
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1.08;
sceneRoot.appendChild(renderer.domElement);
const hemisphere = new THREE.HemisphereLight(0xf7f1df, 0x6f776e, 2.15);
scene.add(hemisphere);
const sun = new THREE.DirectionalLight(0xfff1d5, 3.3);
sun.position.set(-9, 16, 11);
sun.castShadow = true;
sun.shadow.mapSize.set(2048, 2048);
sun.shadow.camera.left = -20;
sun.shadow.camera.right = 20;
sun.shadow.camera.top = 18;
sun.shadow.camera.bottom = -18;
sun.shadow.camera.near = 1;
sun.shadow.camera.far = 45;
sun.shadow.bias = -0.00025;
scene.add(sun);
const fill = new THREE.DirectionalLight(0x9ac9c2, 0.65);
fill.position.set(12, 7, -8);
scene.add(fill);
const COLORS = {
ink: 0x303530,
inkSoft: 0x4e554f,
paper: 0xe8e4d9,
floor: 0xc9c7bb,
frame: 0x454b45,
neutral: 0xa7a9a2,
neutralLight: 0xc4c6bf,
neutralDark: 0x858982,
sourceA: 0x3f8f8b,
sourceB: 0xbd694b,
unknown: 0xd3c8ac,
wood: 0x8f8167
};
// -------------------------------------------------------------------------
// Small voxel construction helpers
// -------------------------------------------------------------------------
function box(parent, width, height, depth, x, y, z, color, options = {}) {
const geometry = options.geometry || new THREE.BoxGeometry(width, height, depth);
const material = options.material || new THREE.MeshStandardMaterial({
color,
roughness: options.roughness ?? 0.84,
metalness: options.metalness ?? 0,
transparent: options.transparent ?? false,
opacity: options.opacity ?? 1,
emissive: options.emissive ?? 0x000000,
emissiveIntensity: options.emissiveIntensity ?? 0
});
const mesh = new THREE.Mesh(geometry, material);
mesh.position.set(x, y, z);
mesh.castShadow = options.castShadow ?? true;
mesh.receiveShadow = options.receiveShadow ?? true;
parent.add(mesh);
return mesh;
}
function canvasTexture(width, height, draw) {
const canvas = document.createElement("canvas");
canvas.width = width;
canvas.height = height;
const ctx = canvas.getContext("2d");
draw(ctx, width, height);
const texture = new THREE.CanvasTexture(canvas);
texture.colorSpace = THREE.SRGBColorSpace;
texture.anisotropy = Math.min(8, renderer.capabilities.getMaxAnisotropy());
return texture;
}
function textPlane(texture, width, height) {
const material = new THREE.MeshBasicMaterial({
map: texture,
transparent: true,
depthWrite: false,
side: THREE.DoubleSide
});
const mesh = new THREE.Mesh(new THREE.PlaneGeometry(width, height), material);
mesh.castShadow = false;
mesh.receiveShadow = false;
return mesh;
}
function signTexture(title, subtitle = "", accent = "#303530", dark = false) {
return canvasTexture(1024, 256, (ctx, w, h) => {
ctx.clearRect(0, 0, w, h);
ctx.fillStyle = dark ? "rgba(37,42,39,.94)" : "rgba(232,228,217,.94)";
ctx.fillRect(0, 0, w, h);
ctx.fillStyle = accent;
ctx.fillRect(0, 0, 18, h);
ctx.fillStyle = dark ? "#eee9dc" : "#303530";
ctx.font = "700 62px system-ui, sans-serif";
ctx.textBaseline = "middle";
ctx.fillText(title, 54, subtitle ? 93 : 128);
if (subtitle) {
ctx.fillStyle = dark ? "#bfc5bc" : "#676b64";
ctx.font = "600 28px system-ui, sans-serif";
ctx.fillText(subtitle, 56, 164);
}
});
}
function makeRecordTexture(record, isSourceB) {
const accent = isSourceB ? "#bd694b" : "#3f8f8b";
return canvasTexture(512, 640, (ctx, w, h) => {
// Neutral panel ground.
ctx.fillStyle = "#a7a9a2";
ctx.fillRect(0, 0, w, h);
// Pixel-grid texture.
ctx.strokeStyle = "rgba(65,70,65,.07)";
ctx.lineWidth = 2;
for (let x = 0; x <= w; x += 32) {
ctx.beginPath();
ctx.moveTo(x, 0);
ctx.lineTo(x, h);
ctx.stroke();
}
for (let y = 0; y <= h; y += 32) {
ctx.beginPath();
ctx.moveTo(0, y);
ctx.lineTo(w, y);
ctx.stroke();
}
// Source header.
ctx.fillStyle = accent;
ctx.fillRect(0, 0, w, 62);
ctx.fillStyle = "#ffffff";
ctx.font = "800 26px system-ui, sans-serif";
ctx.textBaseline = "middle";
ctx.fillText(record.source.toUpperCase(), 25, 31);
if (record.medium === "Photograph") {
// An intentionally nonfigurative neutral placeholder.
ctx.fillStyle = "#c8cac3";
ctx.fillRect(34, 104, 175, 250);
ctx.fillStyle = "#b8bbb3";
ctx.fillRect(223, 150, 252, 204);
ctx.fillStyle = "#969b93";
ctx.fillRect(122, 194, 160, 160);
ctx.fillStyle = "#d5d6d0";
ctx.fillRect(273, 104, 202, 82);
ctx.fillStyle = "rgba(48,53,48,.72)";
ctx.font = "750 18px system-ui, sans-serif";
ctx.fillText("PHOTOGRAPH PLACEHOLDER", 30, 92);
} else {
// Audio symbol: no waveform is presented as actual speech.
ctx.fillStyle = "rgba(48,53,48,.72)";
ctx.font = "750 18px system-ui, sans-serif";
ctx.fillText("AUDIO SYMBOL", 30, 92);
const heights = [45, 80, 120, 165, 112, 190, 130, 76, 145, 96, 52];
const barWidth = 20;
const gap = 15;
const startX = (w - (heights.length * barWidth + (heights.length - 1) * gap)) / 2;
heights.forEach((height, i) => {
ctx.fillStyle = i % 2 === 0 ? accent : "#5d655e";
ctx.fillRect(startX + i * (barWidth + gap), 260 - height / 2, barWidth, height);
});
ctx.strokeStyle = "rgba(48,53,48,.22)";
ctx.lineWidth = 2;
ctx.beginPath();
ctx.moveTo(30, 260);
ctx.lineTo(w - 30, 260);
ctx.stroke();
}
// Source date plate.
ctx.fillStyle = "rgba(239,237,228,.96)";
ctx.fillRect(0, 402, w, 238);
ctx.fillStyle = "#666b64";
ctx.font = "750 17px system-ui, sans-serif";
ctx.fillText("SOURCE DATE", 25, 439);
ctx.fillStyle = "#303530";
ctx.font = "800 83px system-ui, sans-serif";
ctx.fillText(record.date, 23, 515);
ctx.fillStyle = "#666b64";
ctx.font = "650 17px system-ui, sans-serif";
ctx.fillText(record.precision.toUpperCase(), 26, 565);
ctx.fillStyle = "#8a8d85";
ctx.font = "600 15px system-ui, sans-serif";
ctx.fillText("EVENT DATE: NOT ESTABLISHED", 26, 610);
// Corner registration marks.
ctx.fillStyle = "rgba(48,53,48,.65)";
ctx.fillRect(475, 76, 14, 14);
ctx.fillRect(475, 98, 14, 14);
});
}
// -------------------------------------------------------------------------
// Voxel exhibition hall
// -------------------------------------------------------------------------
const hall = new THREE.Group();
scene.add(hall);
// Foundation and tiled floor.
box(hall, 30, 0.35, 24, 0, -0.36, 0, 0xb7b8ad);
const tileGeometry = new THREE.BoxGeometry(0.965, 0.12, 0.965);
const tileMaterial = new THREE.MeshStandardMaterial({
color: 0xffffff,
roughness: 0.92
});
const tileCountX = 29;
const tileCountZ = 23;
const tiles = new THREE.InstancedMesh(tileGeometry, tileMaterial, tileCountX * tileCountZ);
tiles.receiveShadow = true;
tiles.castShadow = false;
const matrix = new THREE.Matrix4();
const tileColor = new THREE.Color();
let tileIndex = 0;
for (let x = 0; x < tileCountX; x++) {
for (let z = 0; z < tileCountZ; z++) {
const px = (x - (tileCountX - 1) / 2) * 1.03;
const pz = (z - (tileCountZ - 1) / 2) * 1.03;
matrix.makeTranslation(px, -0.13, pz);
tiles.setMatrixAt(tileIndex, matrix);
const light = 0.72 + ((x * 7 + z * 11) % 9) * 0.008;
tileColor.setHSL(0.12, 0.055, light);
tiles.setColorAt(tileIndex, tileColor);
tileIndex++;
}
}
tiles.instanceMatrix.needsUpdate = true;
if (tiles.instanceColor) tiles.instanceColor.needsUpdate = true;
hall.add(tiles);
// Back wall built from large voxel courses.
for (let row = 0; row < 5; row++) {
for (let col = 0; col < 10; col++) {
const shade = (row + col) % 3 === 0 ? 0xd1cec1 : 0xd8d5ca;
box(
hall,
2.75,
1.12,
0.48,
-12.4 + col * 2.76,
0.57 + row * 1.13,
-11.25,
shade
);
}
}
// Left wall.
for (let row = 0; row < 5; row++) {
for (let col = 0; col < 8; col++) {
const shade = (row + col) % 4 === 0 ? 0xcac7bb : 0xd6d3c7;
box(
hall,
0.45,
1.12,
2.68,
-14.2,
0.57 + row * 1.13,
-9.6 + col * 2.7,
shade
);
}
}
// Structural columns.
[-11.2, -5.6, 0, 5.6, 11.2].forEach((x) => {
box(hall, 0.62, 6.4, 0.72, x, 3.15, -10.72, 0x7b8179);
box(hall, 0.9, 0.28, 1.0, x, 6.3, -10.72, 0x646a64);
});
// Hall identity.
const wallSign = textPlane(
signTexture("COMMUNITY MEMORY", "PARTIAL RECORDS / DATED SOURCES", "#3f8f8b", true),
8.3,
2.08
);
wallSign.position.set(0, 4.72, -10.96);
hall.add(wallSign);
// Wall-side interpretation label.
const methodSign = textPlane(
signTexture(
"COMPARE METADATA, NOT MEMORY",
"SOURCE DATE · MEDIUM · UNKNOWN",
"#bd694b",
true
),
6.4,
1.6
);
methodSign.position.set(-13.94, 3.2, 1.5);
methodSign.rotation.y = Math.PI / 2;
hall.add(methodSign);
// -------------------------------------------------------------------------
// Central comparison table
// -------------------------------------------------------------------------
const center = new THREE.Group();
hall.add(center);
box(center, 6.2, 0.22, 4.8, 0, 0.08, 0, 0xb3ad9b);
box(center, 5.3, 0.28, 3.9, 0, 1.32, 0, COLORS.wood);
[-2.05, 2.05].forEach((x) => {
[-1.35, 1.35].forEach((z) => {
box(center, 0.32, 1.15, 0.32, x, 0.68, z, 0x6f685a);
});
});
// Three paired rows: source A / unknown / source B.
[-1.05, 0, 1.05].forEach((z, index) => {
const a = box(center, 0.72, 0.52, 0.72, -1.45, 1.73, z, COLORS.sourceA);
const b = box(center, 0.72, 0.52, 0.72, 1.45, 1.73, z, COLORS.sourceB);
const u = box(center, 0.56, 0.56, 0.56, 0, 1.71, z, COLORS.unknown);
a.rotation.y = Math.PI / 4;
b.rotation.y = Math.PI / 4;
u.rotation.y = Math.PI / 4;
box(center, 1.0, 0.08, 0.08, -0.72, 1.59, z, 0xe7e1d1);
box(center, 1.0, 0.08, 0.08, 0.72, 1.59, z, 0xe7e1d1);
if (index === 1) {
box(center, 0.32, 0.8, 0.32, -1.45, 2.1, z, COLORS.sourceA);
box(center, 0.32, 0.64, 0.32, 1.45, 2.02, z, COLORS.sourceB);
}
});
const tableSign = textPlane(
signTexture("ALIGN / MARK UNKNOWN", "", "#303530", false),
4.15,
1.04
);
tableSign.position.set(0, 1.1, 1.97);
center.add(tableSign);
// -------------------------------------------------------------------------
// Memory stations
// -------------------------------------------------------------------------
const stationData = [
{
id: "01",
records: [
{
source: "Source A",
medium: "Photograph",
date: "1996",
precision: "Year only",
event: "Not established"
},
{
source: "Source B",
medium: "Audio symbol",
date: "2003",
precision: "Year only",
event: "Not established"
}
]
},
{
id: "02",
records: [
{
source: "Source A",
medium: "Audio symbol",
date: "1978",
precision: "Year only",
event: "Not established"
},
{
source: "Source B",
medium: "Photograph",
date: "1984",
precision: "Year only",
event: "Not established"
}
]
},
{
id: "03",
records: [
{
source: "Source A",
medium: "Photograph",
date: "1991",
precision: "Year only",
event: "Not established"
},
{
source: "Source B",
medium: "Audio symbol",
date: "1999",
precision: "Year only",
event: "Not established"
}
]
},
{
id: "04",
records: [
{
source: "Source A",
medium: "Audio symbol",
date: "2006",
precision: "Year only",
event: "Not established"
},
{
source: "Source B",
medium: "Photograph",
date: "2012",
precision: "Year only",
event: "Not established"
}
]
}
];
const stationPositions = [
[-7.8, 0, -4.5],
[7.8, 0, -4.5],
[-7.8, 0, 5.6],
[7.8, 0, 5.6]
];
const stations = [];
const audioBars = [];
function buildAudioSymbol(parent, x, y, z, accent, phaseOffset = 0) {
const heights = [0.34, 0.65, 0.95, 1.25, 0.84, 1.48, 1.04, 0.57, 0.92, 0.43];
const spacing = 0.16;
const totalWidth = heights.length * spacing;
heights.forEach((height, i) => {
const bar = box(
parent,
0.105,
height,
0.13,
x - totalWidth / 2 + i * spacing,
y + height / 2,
z,
i % 2 === 0 ? accent : 0x59615a
);
bar.userData.baseHeight = height;
bar.userData.baseY = y + height / 2;
bar.userData.phase = phaseOffset + i * 0.57;
audioBars.push(bar);
});
}
function buildStation(data, position, index) {
const group = new THREE.Group();
group.position.set(...position);
// Face the center of the hall.
const yaw = Math.atan2(-position[0], -position[2]);
group.rotation.y = yaw;
group.userData.stationIndex = index;
group.userData.id = data.id;
// Platform and stepped edge.
box(group, 5.2, 0.25, 3.1, 0, 0.18, 0, 0xb3ae9e);
box(group, 4.75, 0.16, 2.7, 0, 0.39, 0, 0xc9c5b6);
// Pairing rail between the records.
box(group, 0.11, 3.0, 0.11, 0, 1.94, -0.42, 0xd1c8ae);
const accentColors = [COLORS.sourceA, COLORS.sourceB];
data.records.forEach((record, recordIndex) => {
const x = recordIndex === 0 ? -1.23 : 1.23;
const accent = accentColors[recordIndex];
// Record plinth and support.
box(group, 1.96, 0.18, 1.18, x, 0.57, 0.24, 0x96998f);
box(group, 0.19, 0.8, 0.19, x, 0.92, 0.24, 0x5c635d);
// Neutral framed panel.
box(group, 1.76, 2.2, 0.16, x, 2.23, 0.24, COLORS.frame);
const panelTexture = makeRecordTexture(record, recordIndex === 1);
const panel = textPlane(panelTexture, 1.58, 1.98);
panel.position.set(x, 2.23, 0.327);
group.add(panel);
// Date-color tab.
box(group, 0.58, 0.12, 0.12, x, 3.43, 0.28, accent);
if (record.medium === "Audio symbol") {
// A physical waveform symbol above the neutral date panel.
buildAudioSymbol(group, x, 3.63, 0.19, accent, index * 0.3);
box(group, 1.32, 0.1, 0.1, x, 3.61, 0.19, 0x8a8e85);
} else {
// Neutral photographic stand-ins: blocks with no identifiable people.
box(group, 0.36, 0.1, 0.1, x - 0.34, 3.65, 0.18, 0xa8aaa3);
box(group, 0.36, 0.22, 0.1, x, 3.72, 0.18, 0xc3c5bd);
box(group, 0.36, 0.14, 0.1, x + 0.34, 3.68, 0.18, 0x979b93);
}
});
// Station title.
const stationSign = textPlane(
signTexture(
`MEMORY STATION ${data.id}`,
"TWO SOURCES / PARTIAL RECORD",
data.id === "01" ? "#3f8f8b" : data.id === "02" ? "#bd694b" : "#303530",
true
),
4.25,
1.06
);
stationSign.position.set(0, 4.62, 0.08);
group.add(stationSign);
// Voxel selection outline.
const selectionMaterial = new THREE.MeshBasicMaterial({
color: 0x3f8f8b,
transparent: true,
opacity: 0
});
const outline = new THREE.Group();
outline.userData.selectionMaterial = selectionMaterial;
box(outline, 5.45, 0.065, 0.065, 0, 0.49, 1.58, 0xffffff, {
material: selectionMaterial,
castShadow: false,
receiveShadow: false
});
box(outline, 5.45, 0.065, 0.065, 0, 0.49, -1.58, 0xffffff, {
material: selectionMaterial,
castShadow: false,
receiveShadow: false
});
box(outline, 0.065, 0.065, 3.15, -2.7, 0.49, 0, 0xffffff, {
material: selectionMaterial,
castShadow: false,
receiveShadow: false
});
box(outline, 0.065, 0.065, 3.15, 2.7, 0.49, 0, 0xffffff, {
material: selectionMaterial,
castShadow: false,
receiveShadow: false
});
group.add(outline);
group.userData.outline = outline;
// Assign clickable IDs to descendants.
group.traverse((child) => {
if (child.isMesh) child.userData.stationIndex = index;
});
hall.add(group);
return group;
}
stationData.forEach((data, index) => {
const group = buildStation(data, stationPositions[index], index);
stations.push(group);
});
// Small floor wayfinding blocks leading toward the comparison table.
for (let i = 0; i < 5; i++) {
const z = -4.2 + i * 1.2;
const marker = box(hall, 0.24, 0.045, 0.62, 0, 0.005, z, i % 2 ? 0xd0c7ad : 0x929990);
marker.castShadow = false;
}
// -------------------------------------------------------------------------
// Custom camera controls: orbit, pan-free focus, zoom
// -------------------------------------------------------------------------
const overview = {
target: new THREE.Vector3(0, 1.15, 0),
radius: 26.5,
theta: 0.58,
phi: 0.91
};
const desired = {
target: overview.target.clone(),
radius: overview.radius,
theta: overview.theta,
phi: overview.phi
};
const current = {
target: overview.target.clone(),
radius: overview.radius,
theta: overview.theta,
phi: overview.phi
};
const spherical = new THREE.Spherical();
function focusOverview() {
desired.target.copy(overview.target);
desired.radius = overview.radius;
desired.theta = overview.theta;
desired.phi = overview.phi;
}
function focusStation(index) {
const station = stations[index];
const p = station.position;
desired.target.set(p.x, 1.85, p.z);
desired.radius = 8.8;
desired.theta = station.rotation.y;
desired.phi = 1.08;
}
function damp(currentValue, targetValue, lambda, dt) {
return THREE.MathUtils.lerp(currentValue, targetValue, 1 - Math.exp(-lambda * dt));
}
function dampAngle(currentValue, targetValue, lambda, dt) {
let delta = (targetValue - currentValue) % (Math.PI * 2);
if (delta > Math.PI) delta -= Math.PI * 2;
if (delta < -Math.PI) delta += Math.PI * 2;
return currentValue + delta * (1 - Math.exp(-lambda * dt));
}
let dragging = false;
let pointerMoved = false;
let pointerStartX = 0;
let pointerStartY = 0;
let previousX = 0;
let previousY = 0;
const raycaster = new THREE.Raycaster();
const pointer = new THREE.Vector2();
function getStationIntersection(event) {
const rect = renderer.domElement.getBoundingClientRect();
pointer.x = ((event.clientX - rect.left) / rect.width) * 2 - 1;
pointer.y = -((event.clientY - rect.top) / rect.height) * 2 + 1;
raycaster.setFromCamera(pointer, camera);
const intersections = raycaster.intersectObjects(stations, true);
for (const hit of intersections) {
if (hit.object.userData.stationIndex !== undefined) {
return hit.object.userData.stationIndex;
}
}
return null;
}
renderer.domElement.addEventListener("pointerdown", (event) => {
if (event.button !== 0) return;
dragging = true;
pointerMoved = false;
pointerStartX = event.clientX;
pointerStartY = event.clientY;
previousX = event.clientX;
previousY = event.clientY;
renderer.domElement.setPointerCapture(event.pointerId);
});
renderer.domElement.addEventListener("pointermove", (event) => {
if (dragging) {
const dx = event.clientX - previousX;
const dy = event.clientY - previousY;
if (
Math.abs(event.clientX - pointerStartX) +
Math.abs(event.clientY - pointerStartY) > 5
) {
pointerMoved = true;
}
desired.theta -= dx * 0.005;
desired.phi = THREE.MathUtils.clamp(
desired.phi - dy * 0.0045,
0.38,
1.36
);
previousX = event.clientX;
previousY = event.clientY;
} else {
renderer.domElement.style.cursor =
getStationIntersection(event) !== null ? "pointer" : "grab";
}
});
renderer.domElement.addEventListener("pointerup", (event) => {
const wasDragging = dragging;
dragging = false;
if (renderer.domElement.hasPointerCapture(event.pointerId)) {
renderer.domElement.releasePointerCapture(event.pointerId);
}
if (wasDragging && !pointerMoved) {
const stationIndex = getStationIntersection(event);
if (stationIndex !== null) selectStation(stationIndex, true);
}
});
renderer.domElement.addEventListener("pointercancel", () => {
dragging = false;
});
renderer.domElement.addEventListener("wheel", (event) => {
event.preventDefault();
desired.radius = THREE.MathUtils.clamp(
desired.radius + event.deltaY * 0.012,
6.5,
34
);
}, { passive: false });
renderer.domElement.addEventListener("contextmenu", (event) => {
event.preventDefault();
});
// -------------------------------------------------------------------------
// Comparison UI
// -------------------------------------------------------------------------
const comparePanel = document.querySelector("#compare");
const counter = document.querySelector("#counter");
const compareTitle = document.querySelector("#compareTitle");
const mediumA = document.querySelector("#mediumA");
const mediumB = document.querySelector("#mediumB");
const dateA = document.querySelector("#dateA");
const dateB = document.querySelector("#dateB");
const precisionA = document.querySelector("#precisionA");
const precisionB = document.querySelector("#precisionB");
const sameFrame = document.querySelector("#sameFrame");
const difference = document.querySelector("#difference");
let selectedStation = 0;
function selectStation(index, focus = false) {
selectedStation = (index + stationData.length) % stationData.length;
const data = stationData[selectedStation];
const recordA = data.records[0];
const recordB = data.records[1];
counter.textContent = `STATION ${data.id} / 04`;
compareTitle.textContent = "Compare paired records";
mediumA.textContent = recordA.medium;
mediumB.textContent = recordB.medium;
dateA.textContent = recordA.date;
dateB.textContent = recordB.date;
precisionA.textContent = recordA.precision;
precisionB.textContent = recordB.precision;
sameFrame.textContent =
`Both source records are placed at Station ${data.id}. ` +
"The exhibit does not claim that they describe the same moment.";
const yearGap = Math.abs(Number(recordA.date) - Number(recordB.date));
difference.textContent =
`The source dates are ${yearGap} year${yearGap === 1 ? "" : "s"} apart. ` +
"A difference in source date is shown, not resolved.";
comparePanel.classList.add("open");
comparePanel.setAttribute("aria-hidden", "false");
if (focus) focusStation(selectedStation);
}
function closeComparison() {
comparePanel.classList.remove("open");
comparePanel.setAttribute("aria-hidden", "true");
}
document.querySelector("#closeCompare").addEventListener("click", closeComparison);
document.querySelector("#overview").addEventListener("click", () => {
closeComparison();
focusOverview();
});
document.querySelector("#focus").addEventListener("click", () => {
focusStation(selectedStation);
});
document.querySelector("#previous").addEventListener("click", () => {
selectStation(selectedStation - 1, true);
});
document.querySelector("#next").addEventListener("click", () => {
selectStation(selectedStation + 1, true);
});
window.addEventListener("keydown", (event) => {
if (event.key === "Escape") {
closeComparison();
focusOverview();
}
if (event.key === "ArrowRight" && comparePanel.classList.contains("open")) {
selectStation(selectedStation + 1, true);
}
if (event.key === "ArrowLeft" && comparePanel.classList.contains("open")) {
selectStation(selectedStation - 1, true);
}
});
// -------------------------------------------------------------------------
// Resize and render loop
// -------------------------------------------------------------------------
window.addEventListener("resize", () => {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
});
const clock = new THREE.Clock();
function animate() {
requestAnimationFrame(animate);
const dt = Math.min(clock.getDelta(), 0.05);
const time = clock.elapsedTime;
// Damped camera movement.
current.target.lerp(desired.target, 1 - Math.exp(-4.2 * dt));
current.radius = damp(current.radius, desired.radius, 4.2, dt);
current.theta = dampAngle(current.theta, desired.theta, 4.2, dt);
current.phi = damp(current.phi, desired.phi, 4.2, dt);
spherical.set(current.radius, current.phi, current.theta);
camera.position.setFromSpherical(spherical).add(current.target);
camera.lookAt(current.target);
// Gentle audio-symbol motion. These are symbols, not playable audio.
if (!reducedMotion) {
audioBars.forEach((bar) => {
const pulse = 0.82 + Math.sin(time * 2.15 + bar.userData.phase) * 0.16;
bar.scale.y = pulse;
const original = bar.userData.baseHeight;
bar.position.y =
bar.userData.baseY - (original * (1 - pulse)) / 2;
});
}
// Highlight the selected station.
stations.forEach((station, index) => {
const material = station.userData.outline.userData.selectionMaterial;
const targetOpacity = index === selectedStation && comparePanel.classList.contains("open")
? 0.9
: 0;
material.opacity = damp(
material.opacity,
targetOpacity,
7,
dt
);
material.color.setHex(index === selectedStation ? COLORS.sourceA : COLORS.sourceB);
});
renderer.render(scene, camera);
}
animate();
requestAnimationFrame(() => {
loading.classList.add("done");
setTimeout(() => loading.remove(), 500);
});
</script>
</body>
</html>
```