Prompt specification
Build or customize the Three.js 3D scene "Community Mural Planning Wall" 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: Community Mural Planning Wall
Category: Voxel Worlds · Style: Voxel 3D
License: MIT · Reference: https://three3d.app/scene/community-mural-planning-wall-x3338
Scene Description Prompt:
Build a self-contained HTML scene with Three.js from cdnjs featuring public art and interpretations of shared memory. Build a wall of original symbolic panels representing a fictional neighborhood's activities. Let users rearrange panels and see whose activities are included or omitted. Voxel style.
Working Three.js Starter (community-mural-planning-wall-x3338):
```html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="theme-color" content="#e9dfcb">
<title>The Shape of a Neighborhood</title>
<style>
:root {
--ink: #29251f;
--muted: #746d62;
--paper: #f8f2e6;
--paper-deep: #eee2ce;
--line: rgba(54, 47, 38, 0.17);
--orange: #e9773e;
--green: #587b61;
--shadow: 0 18px 50px rgba(49, 38, 24, 0.16);
}
* {
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: #e9dfcb;
color: var(--ink);
font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
"Segoe UI", sans-serif;
}
button {
font: inherit;
}
button:focus-visible {
outline: 3px solid rgba(233, 119, 62, 0.45);
outline-offset: 3px;
}
#scene {
position: fixed;
inset: 0;
display: block;
width: 100%;
height: 100%;
touch-action: none;
cursor: grab;
}
#scene.dragging {
cursor: grabbing;
}
.masthead {
position: fixed;
z-index: 3;
top: 28px;
left: 30px;
width: min(490px, calc(100vw - 450px));
pointer-events: none;
text-shadow: 0 1px rgba(255, 255, 255, 0.35);
}
.eyebrow {
margin: 0 0 9px;
color: var(--green);
font-size: 11px;
font-weight: 800;
letter-spacing: 0.18em;
text-transform: uppercase;
}
h1,
h2,
h3,
p {
margin-top: 0;
}
h1 {
max-width: 480px;
margin-bottom: 12px;
font-family: Georgia, "Times New Roman", serif;
font-size: clamp(34px, 4.4vw, 62px);
font-weight: 500;
line-height: 0.95;
letter-spacing: -0.045em;
}
.intro {
max-width: 430px;
margin-bottom: 0;
color: #5d564c;
font-size: 14px;
line-height: 1.55;
}
.place-chip {
display: inline-flex;
align-items: center;
gap: 8px;
margin-top: 15px;
padding: 7px 10px;
border: 1px solid rgba(41, 37, 31, 0.14);
border-radius: 999px;
background: rgba(248, 242, 230, 0.72);
color: #5b5449;
font-size: 11px;
font-weight: 700;
letter-spacing: 0.06em;
text-transform: uppercase;
backdrop-filter: blur(8px);
}
.place-chip::before {
width: 7px;
height: 7px;
border-radius: 50%;
background: var(--orange);
content: "";
}
.manifest {
position: fixed;
z-index: 5;
top: 18px;
right: 18px;
bottom: 18px;
display: flex;
width: 370px;
flex-direction: column;
overflow: hidden;
border: 1px solid rgba(59, 48, 35, 0.14);
border-radius: 24px;
background: rgba(248, 242, 230, 0.94);
box-shadow: var(--shadow);
backdrop-filter: blur(18px);
}
.manifest-head {
padding: 22px 22px 16px;
border-bottom: 1px solid var(--line);
}
.manifest-head h2 {
margin-bottom: 5px;
font-family: Georgia, "Times New Roman", serif;
font-size: 26px;
font-weight: 500;
letter-spacing: -0.025em;
}
.manifest-head p {
margin: 0;
color: var(--muted);
font-size: 12px;
line-height: 1.45;
}
.memory-score {
display: grid;
grid-template-columns: 1fr auto;
gap: 9px 14px;
align-items: end;
margin-top: 17px;
}
.score-number {
font-family: Georgia, "Times New Roman", serif;
font-size: 32px;
line-height: 1;
}
.score-number span {
color: var(--muted);
font-family: inherit;
font-size: 16px;
}
.score-label {
color: var(--muted);
font-size: 11px;
font-weight: 700;
letter-spacing: 0.08em;
text-align: right;
text-transform: uppercase;
}
.memory-strip {
display: grid;
grid-template-columns: repeat(12, 1fr);
gap: 4px;
margin-top: 12px;
}
.memory-strip i {
height: 7px;
border-radius: 3px;
background: #d9ccb8;
transition: background 180ms ease, transform 180ms ease;
}
.memory-strip i.in {
background: var(--green);
}
.memory-strip i.out {
background: transparent;
box-shadow: inset 0 0 0 1px #b8aa96;
}
.memory-note {
margin: 11px 0 0;
color: #756a5b;
font-size: 11px;
line-height: 1.45;
}
.story-list {
flex: 1;
min-height: 0;
overflow: auto;
padding: 8px 10px;
scrollbar-width: thin;
scrollbar-color: #c9bba5 transparent;
}
.story-row {
display: grid;
grid-template-columns: 1fr 58px;
gap: 6px;
align-items: center;
margin: 2px 0;
padding: 4px;
border: 1px solid transparent;
border-radius: 13px;
transition: background 160ms ease, border-color 160ms ease;
}
.story-row:hover {
background: rgba(255, 255, 255, 0.45);
}
.story-row.selected {
border-color: rgba(89, 123, 97, 0.35);
background: rgba(89, 123, 97, 0.08);
}
.story-select {
display: grid;
min-width: 0;
grid-template-columns: 12px 1fr;
gap: 10px;
align-items: center;
padding: 8px 7px;
border: 0;
background: transparent;
color: inherit;
text-align: left;
cursor: pointer;
}
.swatch {
width: 10px;
height: 28px;
border-radius: 4px;
background: var(--story-color);
opacity: 1;
}
.story-row.omitted .swatch {
opacity: 0.22;
filter: grayscale(0.8);
}
.story-copy {
min-width: 0;
}
.story-copy strong,
.story-copy small {
display: block;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.story-copy strong {
font-size: 12px;
font-weight: 750;
}
.story-copy small {
margin-top: 3px;
color: var(--muted);
font-size: 10px;
}
.story-toggle {
min-height: 38px;
padding: 5px 6px;
border: 1px solid rgba(52, 45, 36, 0.12);
border-radius: 9px;
background: transparent;
color: var(--green);
font-size: 8px;
font-weight: 850;
letter-spacing: 0.07em;
cursor: pointer;
}
.story-toggle:hover {
background: rgba(255, 255, 255, 0.65);
}
.story-row.omitted .story-toggle {
border-style: dashed;
color: #9a765d;
}
.manifest-actions {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 8px;
padding: 12px;
border-top: 1px solid var(--line);
}
.action {
min-height: 40px;
border: 1px solid rgba(52, 45, 36, 0.16);
border-radius: 11px;
background: transparent;
color: var(--ink);
font-size: 11px;
font-weight: 750;
cursor: pointer;
}
.action:hover {
background: white;
}
.selected-card {
position: fixed;
z-index: 4;
bottom: 28px;
left: 30px;
width: min(390px, calc(100vw - 430px));
padding: 19px 20px 17px;
border: 1px solid rgba(55, 45, 33, 0.14);
border-radius: 18px;
background: rgba(248, 242, 230, 0.94);
box-shadow: 9px 9px 0 rgba(69, 55, 38, 0.09), var(--shadow);
backdrop-filter: blur(14px);
}
.selected-top {
display: flex;
justify-content: space-between;
gap: 16px;
align-items: start;
}
.selected-card h3 {
margin-bottom: 5px;
font-family: Georgia, "Times New Roman", serif;
font-size: 24px;
font-weight: 500;
line-height: 1.05;
}
.selected-owner {
margin-bottom: 10px;
color: var(--green);
font-size: 10px;
font-weight: 850;
letter-spacing: 0.11em;
text-transform: uppercase;
}
.state-badge {
flex: 0 0 auto;
padding: 6px 8px;
border-radius: 999px;
background: rgba(89, 123, 97, 0.13);
color: var(--green);
font-size: 8px;
font-weight: 900;
letter-spacing: 0.08em;
text-transform: uppercase;
}
.state-badge.omitted {
background: rgba(154, 118, 93, 0.12);
color: #8c674f;
}
.selected-note {
margin-bottom: 14px;
color: #665e53;
font-size: 12px;
line-height: 1.5;
}
.card-controls {
display: flex;
gap: 7px;
align-items: center;
}
.direction-controls {
display: flex;
gap: 3px;
}
.square-button {
display: grid;
width: 31px;
height: 31px;
place-items: center;
padding: 0;
border: 1px solid rgba(52, 45, 36, 0.16);
border-radius: 8px;
background: transparent;
color: var(--ink);
font-size: 14px;
cursor: pointer;
}
.square-button:hover:not(:disabled) {
background: white;
}
.square-button:disabled {
opacity: 0.25;
cursor: default;
}
.omit-button {
min-height: 31px;
margin-left: auto;
padding: 0 12px;
border: 0;
border-radius: 8px;
background: var(--ink);
color: var(--paper);
font-size: 10px;
font-weight: 800;
cursor: pointer;
}
.omit-button.included {
background: #a17459;
}
.hint {
position: fixed;
z-index: 3;
bottom: 25px;
left: 50%;
padding: 8px 12px;
border-radius: 999px;
background: rgba(248, 242, 230, 0.72);
color: #6c6255;
font-size: 10px;
font-weight: 700;
letter-spacing: 0.04em;
pointer-events: none;
transform: translateX(-50%);
backdrop-filter: blur(8px);
}
#tooltip {
position: fixed;
z-index: 8;
max-width: 220px;
padding: 7px 9px;
border-radius: 8px;
background: rgba(38, 33, 27, 0.92);
color: #fff8eb;
font-size: 10px;
font-weight: 700;
pointer-events: none;
opacity: 0;
transform: translate(12px, 12px);
transition: opacity 100ms ease;
}
#toast {
position: fixed;
z-index: 10;
top: 24px;
left: 50%;
max-width: 430px;
padding: 11px 15px;
border-radius: 12px;
background: rgba(41, 37, 31, 0.92);
color: #fff8eb;
font-size: 11px;
line-height: 1.4;
opacity: 0;
pointer-events: none;
transform: translate(-50%, -12px);
transition: opacity 180ms ease, transform 180ms ease;
}
#toast.visible {
opacity: 1;
transform: translate(-50%, 0);
}
#loading {
position: fixed;
z-index: 30;
inset: 0;
display: grid;
place-items: center;
background: #e9dfcb;
transition: opacity 350ms ease;
}
#loading.hidden {
opacity: 0;
pointer-events: none;
}
.loader {
text-align: center;
}
.loader-blocks {
display: flex;
justify-content: center;
gap: 5px;
margin-bottom: 13px;
}
.loader-blocks i {
width: 12px;
height: 12px;
background: var(--orange);
animation: pulse 900ms infinite alternate ease-in-out;
}
.loader-blocks i:nth-child(2) {
animation-delay: 140ms;
background: var(--green);
}
.loader-blocks i:nth-child(3) {
animation-delay: 280ms;
background: #687ca0;
}
.loader p {
color: #665c4f;
font-size: 11px;
font-weight: 800;
letter-spacing: 0.12em;
text-transform: uppercase;
}
@keyframes pulse {
to {
transform: translateY(-8px);
}
}
@media (max-width: 1000px) {
.masthead {
width: calc(100vw - 420px);
}
.selected-card {
width: 340px;
}
.hint {
display: none;
}
}
@media (max-width: 760px) {
.masthead {
top: 15px;
left: 15px;
width: calc(100vw - 30px);
}
.masthead h1 {
max-width: 340px;
font-size: 37px;
}
.intro {
max-width: 370px;
font-size: 12px;
}
.place-chip {
display: none;
}
.manifest {
top: auto;
right: 10px;
bottom: 10px;
left: 10px;
width: auto;
height: 41vh;
border-radius: 19px;
}
.manifest-head {
padding: 13px 16px 10px;
}
.manifest-head h2 {
font-size: 21px;
}
.manifest-head p,
.memory-note {
display: none;
}
.memory-score {
position: absolute;
top: 12px;
right: 15px;
margin: 0;
}
.score-number {
font-size: 23px;
}
.score-label {
display: none;
}
.memory-strip {
margin-top: 7px;
}
.story-list {
padding: 5px 7px;
}
.story-row {
grid-template-columns: 1fr 53px;
}
.manifest-actions {
padding: 8px;
}
.selected-card {
top: 143px;
right: 15px;
bottom: auto;
left: 15px;
width: auto;
padding: 14px 16px;
}
.selected-card h3 {
font-size: 20px;
}
.selected-note {
margin-bottom: 9px;
font-size: 11px;
}
.state-badge {
font-size: 7px;
}
}
@media (max-height: 650px) and (min-width: 761px) {
.manifest-head {
padding-top: 14px;
padding-bottom: 11px;
}
.memory-note {
display: none;
}
.selected-card {
padding: 14px 17px;
}
.selected-note {
margin-bottom: 9px;
}
}
</style>
</head>
<body>
<canvas id="scene" aria-label="A voxel-art public memory wall in the fictional neighborhood of Morrow Commons"></canvas>
<header class="masthead">
<p class="eyebrow">Morrow Commons · Public Memory Project</p>
<h1>The Shape of a Neighborhood</h1>
<p class="intro">
A wall of twelve everyday rituals. Each tile belongs to someone.
Rearrange the stories and notice who is remembered—and who is left in the empty spaces.
</p>
<div class="place-chip">An original, participatory artwork</div>
</header>
<aside class="manifest" aria-label="Neighborhood memory manifest">
<div class="manifest-head">
<p class="eyebrow">The public record</p>
<h2>Shared memory</h2>
<p>Turning a story off does not erase it. It reveals the shape of the omission.</p>
<div class="memory-score">
<div class="score-number"><b id="score-count">10</b><span> / 12</span></div>
<div class="score-label">Activities represented</div>
</div>
<div id="memory-strip" class="memory-strip" aria-hidden="true"></div>
<p id="memory-note" class="memory-note"></p>
</div>
<div id="story-list" class="story-list" role="list"></div>
<div class="manifest-actions">
<button id="shuffle" class="action" type="button">Shuffle order</button>
<button id="reset" class="action" type="button">Reset memory</button>
</div>
</aside>
<section id="selected-card" class="selected-card" aria-live="polite">
<div class="selected-top">
<div>
<div id="selected-owner" class="selected-owner"></div>
<h3 id="selected-title"></h3>
</div>
<span id="selected-state" class="state-badge"></span>
</div>
<p id="selected-note" class="selected-note"></p>
<div class="card-controls">
<div class="direction-controls" aria-label="Move selected panel">
<button class="square-button" data-direction="left" type="button" aria-label="Move panel left">←</button>
<button class="square-button" data-direction="right" type="button" aria-label="Move panel right">→</button>
<button class="square-button" data-direction="up" type="button" aria-label="Move panel up">↑</button>
<button class="square-button" data-direction="down" type="button" aria-label="Move panel down">↓</button>
</div>
<button id="toggle-selected" class="omit-button" type="button"></button>
</div>
</section>
<div class="hint">Drag a tile to rearrange · Drag empty space to orbit · Scroll to zoom</div>
<div id="tooltip"></div>
<div id="toast" role="status" aria-live="polite"></div>
<div id="loading">
<div class="loader">
<div class="loader-blocks"><i></i><i></i><i></i></div>
<p>Building the neighborhood</p>
</div>
</div>
<script type="module">
let THREE;
try {
THREE = await import(
"https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js"
);
} catch (error) {
document.querySelector("#loading p").textContent =
"Three.js could not be loaded. Check your connection and reload.";
throw error;
}
const canvas = document.querySelector("#scene");
const loading = document.querySelector("#loading");
const tooltip = document.querySelector("#tooltip");
const toast = document.querySelector("#toast");
const renderer = new THREE.WebGLRenderer({
canvas,
antialias: true,
alpha: false,
powerPreference: "high-performance"
});
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.setSize(window.innerWidth, window.innerHeight, false);
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1.08;
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
const scene = new THREE.Scene();
scene.background = new THREE.Color(0xe9dfcb);
scene.fog = new THREE.Fog(0xe9dfcb, 23, 43);
const camera = new THREE.PerspectiveCamera(
42,
window.innerWidth / window.innerHeight,
0.1,
100
);
const cameraTarget = new THREE.Vector3(
window.innerWidth > 900 ? 0.85 : 0,
3.55,
0
);
const orbit = {
azimuth: 0.02,
polar: 1.34,
radius: window.innerWidth < 760 ? 31 : 18.5
};
function updateCamera() {
const sinPolar = Math.sin(orbit.polar);
camera.position.set(
cameraTarget.x + orbit.radius * sinPolar * Math.sin(orbit.azimuth),
cameraTarget.y + orbit.radius * Math.cos(orbit.polar),
cameraTarget.z + orbit.radius * sinPolar * Math.cos(orbit.azimuth)
);
camera.lookAt(cameraTarget);
}
updateCamera();
const hemi = new THREE.HemisphereLight(0xfff6df, 0x887d68, 2.0);
scene.add(hemi);
const sun = new THREE.DirectionalLight(0xfff2d8, 3.2);
sun.position.set(-8, 15, 10);
sun.castShadow = true;
sun.shadow.mapSize.set(2048, 2048);
sun.shadow.camera.left = -15;
sun.shadow.camera.right = 15;
sun.shadow.camera.top = 15;
sun.shadow.camera.bottom = -10;
sun.shadow.camera.near = 1;
sun.shadow.camera.far = 40;
sun.shadow.bias = -0.00035;
scene.add(sun);
const fill = new THREE.DirectionalLight(0xa9c2d6, 0.8);
fill.position.set(10, 7, -8);
scene.add(fill);
const unitBox = new THREE.BoxGeometry(1, 1, 1);
const dummy = new THREE.Object3D();
function addBox(parent, width, height, depth, material, x, y, z) {
const mesh = new THREE.Mesh(unitBox, material);
mesh.scale.set(width, height, depth);
mesh.position.set(x, y, z);
mesh.castShadow = true;
mesh.receiveShadow = true;
parent.add(mesh);
return mesh;
}
function makeInstances(items, roughness = 0.88) {
const material = new THREE.MeshStandardMaterial({
color: 0xffffff,
roughness
});
const mesh = new THREE.InstancedMesh(unitBox, material, items.length);
items.forEach((item, index) => {
dummy.position.set(item.x, item.y, item.z);
dummy.rotation.set(0, 0, 0);
dummy.scale.set(item.w, item.h, item.d);
dummy.updateMatrix();
mesh.setMatrixAt(index, dummy.matrix);
mesh.setColorAt(index, new THREE.Color(item.color));
});
mesh.instanceMatrix.needsUpdate = true;
if (mesh.instanceColor) mesh.instanceColor.needsUpdate = true;
mesh.castShadow = true;
mesh.receiveShadow = true;
mesh.computeBoundingSphere();
return mesh;
}
const stories = [
{
id: "bakery",
owner: "Mara",
title: "Dawn bakery",
short: "bread before sunrise",
color: 0xed8a45,
light: 0xffd79a,
dark: 0x70442b,
note: "Mara's first ritual is steam on the window: a warm signal that the day has begun for someone else.",
glyph: [
"....A....",
"...AAA...",
"..AAAAA..",
".AAAAAAA.",
"..AAAAA..",
"...DDD...",
"........."
]
},
{
id: "bicycle",
owner: "Oren",
title: "Bicycle repair",
short: "making wheels turn again",
color: 0x3d9d99,
light: 0xbce4d2,
dark: 0x244e51,
note: "Oren remembers the neighborhood not as streets, but as things repaired: wheels, bells, promises, brakes.",
glyph: [
"...A..A..",
"..AD.DA..",
".A.AAA.A.",
"..AAAAA..",
"...AAA...",
"..A...A..",
".D.....D."
]
},
{
id: "football",
owner: "Zuri",
title: "Evening football",
short: "the whole block runs",
color: 0x709b52,
light: 0xd9e7a5,
dark: 0x38573b,
note: "For Zuri, a game is a temporary government: teams, rules, penalties, and a place for everyone at the end.",
glyph: [
"...DDD...",
"..AAAAA..",
"...AAA...",
"..AAAAA..",
"..A.A.A..",
"...AAA...",
"..D...D.."
]
},
{
id: "reading",
owner: "Ilya",
title: "Reading nook",
short: "borrowed stories",
color: 0x647fa7,
light: 0xc9d8ee,
dark: 0x303d62,
note: "Ilya keeps a chair by the window. The panel remembers all the lives that passed through borrowed books.",
glyph: [
"..DDDDD..",
".DAAAAAD.",
".DAAAAAD.",
"..DAAAD..",
"...AAD...",
"..AA.AA..",
".AA...AA."
]
},
{
id: "garden",
owner: "Ada",
title: "Garden hour",
short: "nothing wasted",
color: 0x7a9d55,
light: 0xd4df8a,
dark: 0x3e5830,
note: "Ada's garden is both food and argument: about who gets shade, who gets water, and what is allowed to grow.",
glyph: [
"...D.D...",
"..DADAD..",
"...AAA...",
"..AAAAA..",
"..A.A.A..",
"...AAA...",
"..DD.DD.."
]
},
{
id: "music",
owner: "Sol",
title: "Porch music",
short: "notes travel upstairs",
color: 0x926b9f,
light: 0xe4c3dc,
dark: 0x49324f,
note: "Sol plays until the sound becomes public. The melody moves between homes and becomes a neighborhood clock.",
glyph: [
"..D..D...",
".DAADAAD.",
"..AAAA...",
"...AA....",
"..AAAA...",
".DA.DA...",
"DD..D.DD."
]
},
{
id: "childcare",
owner: "Noor",
title: "Block hour",
short: "small hands, shared care",
color: 0xd96c5e,
light: 0xf4c2a7,
dark: 0x6e3737,
note: "Noor's colored blocks mark the invisible infrastructure of care: the adults who trade hours, meals, and patience.",
glyph: [
"DD.DD.DD.",
".........",
".AA.D.AA.",
".........",
"..D.A.D..",
".........",
".D.DD.DD."
]
},
{
id: "tea",
owner: "Bea",
title: "Tea circle",
short: "stories with steep leaves",
color: 0xc97872,
light: 0xf3c2ad,
dark: 0x693c3b,
note: "Bea's cups hold more than tea. The circle makes a place for memory, translation, and gentle disagreement.",
glyph: [
"..AAAAA..",
"..A...A..",
"..AAAAA..",
"...AAA...",
"..AAAAA..",
".AA.A.AA.",
"........."
]
},
{
id: "market",
owner: "Kian",
title: "Corner market",
short: "the daily exchange",
color: 0xd2a640,
light: 0xf6dc8b,
dark: 0x695526,
note: "At Kian's stall, information travels with change. Prices, weather, jokes, and rumors become public knowledge.",
glyph: [
"D.A.D.A.D",
".AAAAAAA.",
"..AAAAA..",
".A.A.A.A.",
"..AAAAA..",
".AA...AA.",
"........."
]
},
{
id: "laundry",
owner: "Momo",
title: "Shared laundry",
short: "clothes, time, and trust",
color: 0x61a7b5,
light: 0xbde0df,
dark: 0x315a64,
note: "Momo's laundry is ordinary labor made visible: warm machines, borrowed soap, and the patience to wait together.",
glyph: [
"...AAA...",
"..AAAAA..",
".AA.A.AA.",
"..AAAAA..",
"...AAA...",
".AA...AA.",
"DD.DD.DD."
]
},
{
id: "radio",
owner: "Eli",
title: "Night radio",
short: "voices after dark",
color: 0x676da2,
light: 0xc0c4eb,
dark: 0x353858,
note: "Eli's late broadcast belongs to people who sleep while others work. It imagines a neighborhood awake in shifts.",
glyph: [
"..AAAAA..",
".A.....A.",
"..AAAAA..",
"..A.A.A..",
"..AAAAA..",
".AA...AA.",
"........."
]
},
{
id: "meal",
owner: "Everyone",
title: "Shared meal",
short: "many hands, one table",
color: 0xc66b4e,
light: 0xf1b38c,
dark: 0x67392f,
note: "The final panel belongs to no single person. It can only be made when enough different lives are represented.",
glyph: [
"..D.D.D..",
"..AAAAA..",
".A.A.A.A.",
"..AAAAA..",
".A.A.A.A.",
"..AAAAA..",
"..D.D.D.."
]
}
];
const storyById = new Map(stories.map((story) => [story.id, story]));
const colorToCss = (color) => `#${new THREE.Color(color).getHexString()}`;
const slotX = [-4.65, -1.55, 1.55, 4.65];
const slotY = [1.22, 3.64, 6.06];
const slotPositions = [];
for (let row = 0; row < 3; row++) {
for (let col = 0; col < 4; col++) {
slotPositions.push(
new THREE.Vector3(slotX[col], slotY[row], 0.24)
);
}
}
const initialSlots = [
"bakery",
"bicycle",
"football",
"reading",
"garden",
"music",
"childcare",
"tea",
"market",
null,
null,
"meal"
];
const state = {
slots: [...initialSlots],
selectedId: "bakery",
hoverId: null
};
const panelGroups = new Map();
const panelRoots = [];
const emptyMarkers = [];
const panelBaseMaterial = new THREE.MeshStandardMaterial({
color: 0x51463b,
roughness: 0.92
});
function buildPanel(story) {
const group = new THREE.Group();
group.userData.panelId = story.id;
const base = addBox(
group,
2.8,
2.1,
0.18,
panelBaseMaterial,
0,
0,
0
);
base.castShadow = true;
const items = [];
const cols = 20;
const rows = 15;
const cell = 0.13;
const glyph = story.glyph.map((row) => row.padEnd(9, ".").slice(0, 9));
for (let y = 0; y < rows; y++) {
for (let x = 0; x < cols; x++) {
const symbolX = Math.floor((x - 1) / 2);
const symbolY = Math.floor(y / 2);
const symbol =
symbolX >= 0 &&
symbolX < 9 &&
symbolY >= 0 &&
symbolY < 7
? glyph[symbolY][symbolX]
: ".";
let color;
let depth = 0.09;
if (symbol === "A") {
color = story.color;
depth = 0.15;
} else if (symbol === "L") {
color = story.light;
depth = 0.15;
} else if (symbol === "D") {
color = story.dark;
depth = 0.15;
} else {
color = (x + y) % 3 === 0 ? 0xe6d8bd : 0xf0e5cf;
}
items.push({
x: (x - (cols - 1) / 2) * cell,
y: ((rows - 1) / 2 - y) * cell,
z: 0.13,
w: cell * 0.94,
h: cell * 0.94,
d: depth,
color
});
}
}
items.push(
{ x: 0, y: 1.015, z: 0.16, w: 2.72, h: 0.09, d: 0.2, color: story.dark },
{ x: 0, y: -1.015, z: 0.16, w: 2.72, h: 0.09, d: 0.2, color: story.dark },
{ x: -1.355, y: 0, z: 0.16, w: 0.09, h: 1.94, d: 0.2, color: story.dark },
{ x: 1.355, y: 0, z: 0.16, w: 0.09, h: 1.94, d: 0.2, color: story.dark }
);
const voxels = makeInstances(items);
voxels.userData.panelId = story.id;
group.add(voxels);
group.userData.panelId = story.id;
const index = state.slots.indexOf(story.id);
if (index >= 0) {
group.position.copy(slotPositions[index]);
group.scale.setScalar(1);
} else {
group.visible = false;
group.scale.setScalar(0.001);
}
scene.add(group);
panelGroups.set(story.id, group);
panelRoots.push(group);
}
stories.forEach(buildPanel);
const wallMaterial = new THREE.MeshStandardMaterial({
color: 0xd8c8ad,
roughness: 0.95
});
addBox(
scene,
13.4,
8.6,
0.48,
wallMaterial,
0,
3.7,
-0.29
);
const capMaterial = new THREE.MeshStandardMaterial({
color: 0xbba98c,
roughness: 0.9
});
for (let i = 0; i < 24; i++) {
addBox(
scene,
0.56,
0.26,
0.64,
capMaterial,
-6.55 + i * 0.57,
8.08,
-0.19
);
}
const brickColors = [0xd8c8ad, 0xcdbb9d, 0xe1d2b9, 0xc5b394, 0xd9c6a7];
const brickItems = [];
for (let row = 0; row < 14; row++) {
const offset = row % 2 ? 0.29 : 0;
for (let col = 0; col < 22; col++) {
const x = -6.375 + col * 0.58 + offset;
if (x > 6.48) continue;
brickItems.push({
x,
y: 0.05 + row * 0.56,
z: 0.025,
w: 0.54,
h: 0.51,
d: 0.11,
color: brickColors[(row * 3 + col * 5) % brickColors.length]
});
}
}
const bricks = makeInstances(brickItems);
scene.add(bricks);
const floorMaterial = new THREE.MeshStandardMaterial({
color: 0xb7ac98,
roughness: 1
});
addBox(scene, 34, 0.4, 24, floorMaterial, 0, -0.48, 3.2);
const tileItems = [];
const tileColors = [0xc9beaa, 0xd1c6b2, 0xbeb29d, 0xd8cdb9];
for (let x = -9; x <= 9; x++) {
for (let z = -2; z <= 8; z++) {
tileItems.push({
x: x * 0.9,
y: -0.16,
z: z * 0.9,
w: 0.86,
h: 0.18,
d: 0.86,
color: tileColors[(x * 7 + z * 11 + 30) % tileColors.length]
});
}
}
const floorTiles = makeInstances(tileItems);
scene.add(floorTiles);
const recessMaterial = new THREE.MeshStandardMaterial({
color: 0x8e8373,
roughness: 1
});
const omissionMaterial = new THREE.MeshStandardMaterial({
color: 0xb5a78f,
roughness: 1
});
for (let i = 0; i < slotPositions.length; i++) {
const marker = new THREE.Group();
marker.position.copy(slotPositions[i]);
marker.position.z = 0.09;
addBox(
marker,
2.76,
2.06,
0.055,
recessMaterial,
0,
0,
0
);
const omissionCells = [
[-0.48, 0.32],
[0, 0.32],
[0.48, 0.32],
[-0.24, 0],
[0.24, 0],
[0, -0.32]
];
omissionCells.forEach(([x, y]) => {
addBox(
marker,
0.18,
0.18,
0.08,
omissionMaterial,
x,
y,
0.07
);
});
marker.visible = state.slots[i] === null;
scene.add(marker);
emptyMarkers.push(marker);
}
const highlightMaterial = new THREE.MeshStandardMaterial({
color: 0xf3b45f,
emissive: 0x9a5b1f,
emissiveIntensity: 0.55,
roughness: 0.5
});
const slotHighlight = new THREE.Group();
addBox(slotHighlight, 2.94, 0.1, 0.12, highlightMaterial, 0, 1.13, 0);
addBox(slotHighlight, 2.94, 0.1, 0.12, highlightMaterial, 0, -1.13, 0);
addBox(slotHighlight, 0.1, 2.16, 0.12, highlightMaterial, -1.47, 0, 0);
addBox(slotHighlight, 0.1, 2.16, 0.12, highlightMaterial, 1.47, 0, 0);
slotHighlight.visible = false;
scene.add(slotHighlight);
const selectionMaterial = new THREE.MeshStandardMaterial({
color: 0xf0d183,
emissive: 0x9c6527,
emissiveIntensity: 0.48,
roughness: 0.5
});
const selectionHalo = new THREE.Group();
addBox(selectionHalo, 2.94, 0.075, 0.11, selectionMaterial, 0, 1.13, 0);
addBox(selectionHalo, 2.94, 0.075, 0.11, selectionMaterial, 0, -1.13, 0);
addBox(selectionHalo, 0.075, 2.18, 0.11, selectionMaterial, -1.47, 0, 0);
addBox(selectionHalo, 0.075, 2.18, 0.11, selectionMaterial, 1.47, 0, 0);
scene.add(selectionHalo);
function makeTree(x, z, scale = 1) {
const tree = new THREE.Group();
tree.position.set(x, -0.06, z);
tree.scale.setScalar(scale);
const trunk = new THREE.MeshStandardMaterial({ color: 0x79563a });
const leaves = new THREE.MeshStandardMaterial({ color: 0x71874e });
addBox(tree, 0.42, 2.25, 0.42, trunk, 0, 1.05, 0);
addBox(tree, 1.65, 1.25, 1.45, leaves, 0, 2.55, 0);
addBox(tree, 1.15, 1.1, 1.1, leaves, -0.78, 2.15, 0.15);
addBox(tree, 1.05, 1.15, 1.15, leaves, 0.78, 2.3, -0.08);
addBox(tree, 0.9, 0.9, 0.9, leaves, 0.1, 3.25, 0.1);
scene.add(tree);
}
makeTree(-7.45, 0.15, 1.05);
makeTree(7.55, -0.15, 0.92);
function makePerson(x, z, shirtColor, scale = 1) {
const person = new THREE.Group();
person.position.set(x, -0.06, z);
person.scale.setScalar(scale);
const shirt = new THREE.MeshStandardMaterial({ color: shirtColor });
const skin = new THREE.MeshStandardMaterial({ color: 0xc58f68 });
const trousers = new THREE.MeshStandardMaterial({ color: 0x45474a });
addBox(person, 0.48, 0.75, 0.32, shirt, 0, 0.95, 0);
addBox(person, 0.4, 0.4, 0.38, skin, 0, 1.53, 0);
addBox(person, 0.17, 0.52, 0.2, trousers, -0.14, 0.38, 0);
addBox(person, 0.17, 0.52, 0.2, trousers, 0.14, 0.38, 0);
addBox(person, 0.14, 0.58, 0.16, shirt, -0.34, 0.92, 0);
addBox(person, 0.14, 0.58, 0.16, shirt, 0.34, 0.92, 0);
scene.add(person);
}
makePerson(-4.7, 2.25, 0xcb6c55, 0.95);
makePerson(-3.85, 2.55, 0x587b91, 0.82);
makePerson(4.15, 2.15, 0x92719c, 0.92);
makePerson(4.95, 2.55, 0xb18b45, 0.78);
const benchWood = new THREE.MeshStandardMaterial({ color: 0x8a603d });
const benchMetal = new THREE.MeshStandardMaterial({ color: 0x4d514d });
const bench = new THREE.Group();
bench.position.set(-4.4, -0.03, 3.4);
addBox(bench, 2.35, 0.2, 0.65, benchWood, 0, 0.48, 0);
addBox(bench, 2.35, 0.58, 0.16, benchWood, 0, 0.87, -0.28);
addBox(bench, 0.18, 0.58, 0.5, benchMetal, -0.82, 0.18, 0);
addBox(bench, 0.18, 0.58, 0.5, benchMetal, 0.82, 0.18, 0);
scene.add(bench);
const cloudMaterial = new THREE.MeshStandardMaterial({
color: 0xf3ead8,
roughness: 1
});
function makeCloud(x, y, z, scale) {
const cloud = new THREE.Group();
cloud.position.set(x, y, z);
cloud.scale.setScalar(scale);
addBox(cloud, 1.7, 0.55, 0.8, cloudMaterial, 0, 0, 0);
addBox(cloud, 0.85, 0.8, 0.8, cloudMaterial, -0.45, 0.2, 0);
addBox(cloud, 1.05, 0.9, 0.8, cloudMaterial, 0.35, 0.25, 0);
scene.add(cloud);
}
makeCloud(-7.2, 8.8, -4.5, 1.15);
makeCloud(7.8, 7.7, -5.2, 0.8);
makeCloud(3.5, 10.3, -7.5, 0.65);
const raycaster = new THREE.Raycaster();
const pointerNdc = new THREE.Vector2();
const dragPlane = new THREE.Plane(new THREE.Vector3(0, 0, 1), -0.24);
const dragPoint = new THREE.Vector3();
function setRay(clientX, clientY) {
const rect = canvas.getBoundingClientRect();
pointerNdc.x = ((clientX - rect.left) / rect.width) * 2 - 1;
pointerNdc.y = -((clientY - rect.top) / rect.height) * 2 + 1;
raycaster.setFromCamera(pointerNdc, camera);
}
function findPanelOwner(object) {
let current = object;
while (current) {
if (current.userData.panelId) return current.userData.panelId;
current = current.parent;
}
return null;
}
function getPanelHit(clientX, clientY) {
setRay(clientX, clientY);
const intersections = raycaster.intersectObjects(panelRoots, true);
for (const intersection of intersections) {
const id = findPanelOwner(intersection.object);
if (!id) continue;
const group = panelGroups.get(id);
if (group && group.visible && group.scale.x > 0.15) return id;
}
return null;
}
function nearestSlot(worldPoint) {
let bestIndex = 0;
let bestDistance = Infinity;
slotPositions.forEach((position, index) => {
const dx = worldPoint.x - position.x;
const dy = worldPoint.y - position.y;
const distance = dx * dx + dy * dy;
if (distance < bestDistance) {
bestDistance = distance;
bestIndex = index;
}
});
return bestIndex;
}
function selectStory(id) {
state.selectedId = id;
updateUI();
}
function movePanelToSlot(id, targetIndex) {
const fromIndex = state.slots.indexOf(id);
if (fromIndex < 0 || targetIndex < 0 || fromIndex === targetIndex) return;
const displaced = state.slots[targetIndex];
state.slots[targetIndex] = id;
state.slots[fromIndex] = displaced;
state.selectedId = id;
syncState();
showToast(
displaced
? `${storyById.get(id).title} and ${storyById.get(displaced).title} exchanged places.`
: `${storyById.get(id).title} moved to a new place on the wall.`
);
}
function toggleStory(id) {
const index = state.slots.indexOf(id);
const story = storyById.get(id);
if (index >= 0) {
state.slots[index] = null;
showToast(`${story.title} was omitted. The empty socket remains part of the record.`);
} else {
const emptyIndex = state.slots.findIndex((value) => value === null);
if (emptyIndex >= 0) {
state.slots[emptyIndex] = id;
showToast(`${story.title} returned to the shared wall.`);
}
}
state.selectedId = id;
syncState();
}
function moveSelected(direction) {
const id = state.selectedId;
const index = state.slots.indexOf(id);
if (index < 0) return;
const row = Math.floor(index / 4);
const col = index % 4;
let targetRow = row;
let targetCol = col;
if (direction === "left") targetCol--;
if (direction === "right") targetCol++;
if (direction === "up") targetRow++;
if (direction === "down") targetRow--;
if (targetRow < 0 || targetRow > 2 || targetCol < 0 || targetCol > 3) return;
movePanelToSlot(id, targetRow * 4 + targetCol);
}
let toastTimer;
function showToast(message) {
toast.textContent = message;
toast.classList.add("visible");
clearTimeout(toastTimer);
toastTimer = setTimeout(() => toast.classList.remove("visible"), 2600);
}
function updateSelectedCard() {
const story = storyById.get(state.selectedId);
const index = state.slots.indexOf(story.id);
const included = index >= 0;
document.querySelector("#selected-owner").textContent =
`${story.owner} · ${story.short}`;
document.querySelector("#selected-title").textContent = story.title;
document.querySelector("#selected-note").textContent = story.note;
const badge = document.querySelector("#selected-state");
badge.textContent = included ? "On the wall" : "Omitted";
badge.classList.toggle("omitted", !included);
const toggle = document.querySelector("#toggle-selected");
toggle.textContent = included ? "Omit story" : "Return to wall";
toggle.classList.toggle("included", included);
document.querySelectorAll("[data-direction]").forEach((button) => {
button.disabled = !included;
});
}
function updateManifest() {
const includedCount = state.slots.filter(Boolean).length;
const omittedCount = stories.length - includedCount;
document.querySelector("#score-count").textContent = includedCount;
document.querySelector("#memory-strip").innerHTML = stories
.map((story) => {
const included = state.slots.includes(story.id);
return `<i class="${included ? "in" : "out"}"></i>`;
})
.join("");
const note = document.querySelector("#memory-note");
if (omittedCount === 0) {
note.textContent = "Every activity is currently represented. The wall can still be rearranged.";
} else if (omittedCount === 1) {
note.textContent = "One activity remains outside the shared record.";
} else {
note.textContent = `${omittedCount} activities remain outside the shared record.`;
}
const list = document.querySelector("#story-list");
list.replaceChildren();
stories.forEach((story) => {
const included = state.slots.includes(story.id);
const row = document.createElement("div");
row.className = `story-row${included ? "" : " omitted"}`;
row.classList.toggle("selected", story.id === state.selectedId);
row.setAttribute("role", "listitem");
const select = document.createElement("button");
select.type = "button";
select.className = "story-select";
select.setAttribute(
"aria-label",
`${story.title}, ${story.owner}, ${included ? "included" : "omitted"}`
);
select.innerHTML = `
<span class="swatch" style="--story-color:${colorToCss(story.color)}"></span>
<span class="story-copy">
<strong>${story.title}</strong>
<small>${story.owner}</small>
</span>
`;
select.addEventListener("click", () => selectStory(story.id));
const toggle = document.createElement("button");
toggle.type = "button";
toggle.className = "story-toggle";
toggle.textContent = included ? "ON WALL" : "OMITTED";
toggle.setAttribute("aria-label", `${included ? "Omit" : "Include"} ${story.title}`);
toggle.addEventListener("click", () => toggleStory(story.id));
row.append(select, toggle);
list.append(row);
});
updateSelectedCard();
}
function syncState() {
emptyMarkers.forEach((marker, index) => {
marker.visible = state.slots[index] === null;
});
stories.forEach((story) => {
const group = panelGroups.get(story.id);
if (state.slots.includes(story.id)) group.visible = true;
});
updateManifest();
}
document.querySelectorAll("[data-direction]").forEach((button) => {
button.addEventListener("click", () => moveSelected(button.dataset.direction));
});
document.querySelector("#toggle-selected").addEventListener("click", () => {
toggleStory(state.selectedId);
});
document.querySelector("#reset").addEventListener("click", () => {
state.slots = [...initialSlots];
state.selectedId = "bakery";
syncState();
showToast("The original arrangement and omissions have been restored.");
});
document.querySelector("#shuffle").addEventListener("click", () => {
const occupied = [];
state.slots.forEach((id, index) => {
if (id) occupied.push(index);
});
const values = occupied.map((index) => state.slots[index]);
for (let i = values.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[values[i], values[j]] = [values[j], values[i]];
}
occupied.forEach((index, i) => {
state.slots[index] = values[i];
});
syncState();
showToast("The stories have been rearranged. Their omissions have not.");
});
const pointers = new Map();
let dragState = null;
let orbitState = null;
let pinchState = null;
canvas.addEventListener("contextmenu", (event) => event.preventDefault());
canvas.addEventListener("pointerdown", (event) => {
canvas.setPointerCapture(event.pointerId);
pointers.set(event.pointerId, { x: event.clientX, y: event.clientY });
if (pointers.size === 2) {
dragState = null;
slotHighlight.visible = false;
const [a, b] = [...pointers.values()];
pinchState = {
distance: Math.hypot(a.x - b.x, a.y - b.y),
radius: orbit.radius
};
orbitState = null;
return;
}
if (pointers.size !== 1) return;
if (event.button === 0) {
const hit = getPanelHit(event.clientX, event.clientY);
if (hit) {
setRay(event.clientX, event.clientY);
const point = new THREE.Vector3();
if (raycaster.ray.intersectPlane(dragPlane, point)) {
const group = panelGroups.get(hit);
dragState = {
id: hit,
offset: group.position.clone().sub(point),
point: group.position.clone(),
targetSlot: state.slots.indexOf(hit),
moved: false
};
canvas.classList.add("dragging");
tooltip.style.opacity = "0";
return;
}
}
}
orbitState = {
x: event.clientX,
y: event.clientY,
pan: event.button === 2 || event.shiftKey
};
});
canvas.addEventListener("pointermove", (event) => {
const previous = pointers.get(event.pointerId);
if (previous) {
pointers.set(event.pointerId, { x: event.clientX, y: event.clientY });
}
if (pointers.size >= 2) {
const [a, b] = [...pointers.values()];
const distance = Math.hypot(a.x - b.x, a.y - b.y);
if (pinchState && distance > 0) {
orbit.radius = THREE.MathUtils.clamp(
pinchState.radius * pinchState.distance / distance,
10,
38
);
}
return;
}
if (dragState) {
const dx = event.clientX - (previous?.x ?? event.clientX);
const dy = event.clientY - (previous?.y ?? event.clientY);
if (Math.abs(dx) + Math.abs(dy) > 1) dragState.moved = true;
setRay(event.clientX, event.clientY);
if (raycaster.ray.intersectPlane(dragPlane, dragPoint)) {
const desired = dragPoint.clone().add(dragState.offset);
dragState.point.set(desired.x, desired.y, 0.82);
const target = nearestSlot(desired);
dragState.targetSlot = target;
slotHighlight.position.copy(slotPositions[target]);
slotHighlight.position.z = 0.58;
slotHighlight.visible = true;
}
return;
}
if (orbitState) {
const dx = event.clientX - orbitState.x;
const dy = event.clientY - orbitState.y;
orbitState.x = event.clientX;
orbitState.y = event.clientY;
if (orbitState.pan) {
const right = new THREE.Vector3().setFromMatrixColumn(camera.matrix, 0);
const up = new THREE.Vector3().setFromMatrixColumn(camera.matrix, 1);
const scale = orbit.radius * 0.00145;
cameraTarget.addScaledVector(right, -dx * scale);
cameraTarget.addScaledVector(up, dy * scale);
cameraTarget.x = THREE.MathUtils.clamp(cameraTarget.x, -9, 9);
cameraTarget.y = THREE.MathUtils.clamp(cameraTarget.y, 1.2, 8);
} else {
orbit.azimuth -= dx * 0.005;
orbit.polar = THREE.MathUtils.clamp(orbit.polar - dy * 0.004, 0.67, 1.54);
}
return;
}
const hit = getPanelHit(event.clientX, event.clientY);
state.hoverId = hit;
canvas.style.cursor = hit ? "pointer" : "grab";
if (hit) {
const story = storyById.get(hit);
tooltip.textContent = `${story.title} · ${story.owner}`;
tooltip.style.left = `${event.clientX}px`;
tooltip.style.top = `${event.clientY}px`;
tooltip.style.opacity = "1";
} else {
tooltip.style.opacity = "0";
}
});
function endPointer(event, cancelled = false) {
const wasSingle = pointers.size === 1;
pointers.delete(event.pointerId);
if (wasSingle && dragState) {
const id = dragState.id;
const target = dragState.targetSlot;
const moved = dragState.moved;
dragState = null;
slotHighlight.visible = false;
canvas.classList.remove("dragging");
if (!cancelled && moved && target >= 0) {
movePanelToSlot(id, target);
} else {
selectStory(id);
}
}
if (pointers.size < 2) pinchState = null;
if (pointers.size === 0) orbitState = null;
}
canvas.addEventListener("pointerup", (event) => endPointer(event, false));
canvas.addEventListener("pointercancel", (event) => endPointer(event, true));
canvas.addEventListener("pointerleave", () => {
if (!dragState) tooltip.style.opacity = "0";
});
canvas.addEventListener(
"wheel",
(event) => {
event.preventDefault();
orbit.radius = THREE.MathUtils.clamp(
orbit.radius + event.deltaY * 0.009,
10,
38
);
},
{ passive: false }
);
window.addEventListener("resize", () => {
renderer.setSize(window.innerWidth, window.innerHeight, false);
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
if (!dragState && !orbitState) {
cameraTarget.x = window.innerWidth > 900 ? 0.85 : 0;
}
});
const clock = new THREE.Clock();
const tempScale = new THREE.Vector3();
function animate() {
requestAnimationFrame(animate);
const dt = Math.min(clock.getDelta(), 0.05);
const smoothing = 1 - Math.exp(-dt * 11);
updateCamera();
stories.forEach((story) => {
const group = panelGroups.get(story.id);
const index = state.slots.indexOf(story.id);
const included = index >= 0;
const targetScale = included ? 1 : 0;
if (included) {
group.visible = true;
const target = slotPositions[index];
if (dragState?.id === story.id) {
group.position.lerp(dragState.point, smoothing);
} else {
group.position.lerp(target, smoothing);
}
const current = group.scale.x;
const next = THREE.MathUtils.lerp(current, targetScale, smoothing);
group.scale.setScalar(Math.max(0.001, next));
} else {
const current = group.scale.x;
const next = THREE.MathUtils.lerp(current, targetScale, smoothing);
group.scale.setScalar(Math.max(0.001, next));
if (next < 0.025) group.visible = false;
}
});
const selectedGroup = panelGroups.get(state.selectedId);
if (selectedGroup && selectedGroup.visible && selectedGroup.scale.x > 0.2) {
selectionHalo.visible = true;
selectionHalo.position.lerp(selectedGroup.position, smoothing);
selectionHalo.position.z = 0.55;
} else {
selectionHalo.visible = false;
}
renderer.render(scene, camera);
}
syncState();
animate();
requestAnimationFrame(() => {
loading.classList.add("hidden");
setTimeout(() => loading.remove(), 400);
});
</script>
</body>
</html>
```