Prompt specification
Build or customize the Three.js 3D scene "Multi-channel communication simulator" 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: Multi-channel communication simulator
Category: Voxel Worlds · Style: Voxel 3D
License: MIT · Reference: https://three3d.app/scene/multi-channel-communication-simulator-x0412
Scene Description Prompt:
Make a standalone HTML scene with Three.js from cdnjs that depicts captioned public announcements. Create a public hall with several service events; users disable one information channel and verify that remaining channels still convey each event through consistent symbols and locations. Voxel style.
Working Three.js Starter (multi-channel-communication-simulator-x0412):
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Civic Hall — Redundant Public Announcements</title>
<style>
:root {
--ink: #183038;
--muted: #607277;
--paper: rgba(255, 253, 246, 0.94);
--line: rgba(24, 48, 56, 0.14);
--green: #167b59;
--amber: #b66c20;
--red: #b64444;
--shadow: 0 16px 45px rgba(25, 45, 49, 0.16);
}
* {
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: #dce5e3;
color: var(--ink);
font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
"Segoe UI", sans-serif;
}
button,
select {
font: inherit;
}
button {
color: inherit;
}
#viewport {
position: fixed;
inset: 0;
}
#viewport canvas {
display: block;
width: 100%;
height: 100%;
touch-action: none;
cursor: grab;
}
#viewport canvas.dragging {
cursor: grabbing;
}
.panel {
position: fixed;
z-index: 5;
border: 1px solid rgba(255, 255, 255, 0.72);
border-radius: 16px;
background: var(--paper);
box-shadow: var(--shadow);
backdrop-filter: blur(14px);
-webkit-backdrop-filter: blur(14px);
}
#mission {
top: 18px;
left: 18px;
width: 350px;
padding: 19px 20px 17px;
}
.eyebrow {
margin-bottom: 8px;
color: #27826d;
font-size: 10px;
font-weight: 800;
letter-spacing: 0.16em;
text-transform: uppercase;
}
h1 {
margin: 0;
font-size: clamp(23px, 2.3vw, 32px);
line-height: 1.04;
letter-spacing: -0.035em;
}
#mission p {
margin: 11px 0 14px;
color: var(--muted);
font-size: 13px;
line-height: 1.5;
}
.steps {
display: flex;
flex-wrap: wrap;
gap: 7px;
}
.step {
display: flex;
align-items: center;
gap: 6px;
padding: 6px 8px;
border: 1px solid var(--line);
border-radius: 7px;
background: rgba(255, 255, 255, 0.62);
font-size: 10px;
font-weight: 750;
letter-spacing: 0.035em;
}
.step b {
display: grid;
width: 17px;
height: 17px;
place-items: center;
border-radius: 4px;
background: var(--ink);
color: white;
font-size: 9px;
}
#channel-panel {
top: 18px;
right: 18px;
width: 336px;
padding: 17px;
}
.panel-heading {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
margin-bottom: 12px;
}
.panel-heading h2 {
margin: 0;
font-size: 15px;
letter-spacing: -0.015em;
}
.live-dot {
display: flex;
align-items: center;
gap: 6px;
color: var(--muted);
font-size: 10px;
font-weight: 750;
letter-spacing: 0.08em;
text-transform: uppercase;
}
.live-dot::before {
width: 7px;
height: 7px;
border-radius: 50%;
background: #28a778;
box-shadow: 0 0 0 4px rgba(40, 167, 120, 0.12);
content: "";
}
#channel-list {
display: grid;
gap: 8px;
}
.channel-toggle {
display: grid;
grid-template-columns: 35px 1fr auto;
align-items: center;
gap: 10px;
width: 100%;
padding: 10px;
border: 1px solid rgba(24, 48, 56, 0.12);
border-radius: 10px;
background: rgba(255, 255, 255, 0.7);
cursor: pointer;
text-align: left;
transition: 160ms ease;
}
.channel-toggle:hover {
border-color: rgba(24, 48, 56, 0.28);
transform: translateY(-1px);
}
.channel-toggle.off {
background: rgba(30, 45, 48, 0.055);
color: #7b8587;
}
.channel-icon {
display: grid;
width: 35px;
height: 35px;
place-items: center;
border-radius: 8px;
background: #e8f1ed;
color: #236f5c;
font-size: 18px;
}
.channel-toggle[data-channel="digital"] .channel-icon {
background: #e5f0f5;
color: #267492;
}
.channel-toggle[data-channel="print"] .channel-icon {
background: #f1e9db;
color: #86633f;
}
.channel-toggle.off .channel-icon {
filter: grayscale(1);
opacity: 0.55;
}
.channel-copy b,
.channel-copy small {
display: block;
}
.channel-copy b {
margin-bottom: 2px;
font-size: 12px;
}
.channel-copy small {
color: var(--muted);
font-size: 10px;
}
.channel-state {
min-width: 35px;
padding: 5px 7px;
border-radius: 6px;
background: #dff2e8;
color: var(--green);
font-size: 9px;
font-weight: 900;
letter-spacing: 0.08em;
text-align: center;
}
.channel-toggle.off .channel-state {
background: #e4e5e4;
color: #7a8182;
}
.button-row {
display: flex;
gap: 8px;
margin-top: 12px;
}
.button-row button {
flex: 1;
padding: 10px 11px;
border: 0;
border-radius: 9px;
cursor: pointer;
font-size: 11px;
font-weight: 800;
transition: 160ms ease;
}
#verify-button {
background: var(--ink);
color: white;
}
#verify-button:hover {
background: #274852;
transform: translateY(-1px);
}
#verify-button.verified {
background: var(--green);
}
#reset-button,
#reset-view {
background: #e9ece9;
}
#reset-button:hover,
#reset-view:hover {
background: #dce2df;
}
#coverage-summary {
margin: 11px 1px 0;
color: var(--muted);
font-size: 11px;
line-height: 1.45;
}
#inspector {
bottom: 18px;
left: 18px;
width: 350px;
padding: 17px;
}
.inspector-top {
display: flex;
align-items: center;
gap: 12px;
margin-bottom: 12px;
}
.large-symbol {
display: grid;
flex: 0 0 auto;
width: 48px;
height: 48px;
place-items: center;
border: 1px solid var(--line);
border-radius: 11px;
background: white;
}
.large-symbol svg {
width: 31px;
height: 31px;
}
#inspector-code {
margin-bottom: 2px;
color: var(--green);
font-size: 10px;
font-weight: 850;
letter-spacing: 0.1em;
}
#inspector-title {
font-size: 15px;
line-height: 1.2;
}
#event-select {
width: 100%;
margin-bottom: 12px;
padding: 9px 10px;
border: 1px solid var(--line);
border-radius: 8px;
background: white;
color: var(--ink);
font-size: 11px;
font-weight: 700;
cursor: pointer;
}
#event-previews {
display: grid;
gap: 7px;
}
.preview {
display: grid;
grid-template-columns: 31px 1fr auto;
align-items: center;
gap: 9px;
padding: 8px 9px;
border: 1px solid var(--line);
border-radius: 8px;
background: rgba(255, 255, 255, 0.72);
}
.preview.off {
opacity: 0.43;
background: rgba(25, 35, 36, 0.035);
}
.preview-icon {
display: grid;
width: 31px;
height: 31px;
place-items: center;
border-radius: 6px;
background: #edf3ef;
}
.preview-icon svg {
width: 21px;
height: 21px;
}
.preview-copy b,
.preview-copy small {
display: block;
}
.preview-copy b {
overflow: hidden;
font-size: 10px;
text-overflow: ellipsis;
white-space: nowrap;
}
.preview-copy small {
margin-top: 2px;
color: var(--muted);
font-size: 9px;
}
.preview-state {
color: var(--green);
font-size: 9px;
font-weight: 900;
letter-spacing: 0.08em;
}
.preview.off .preview-state {
color: #7b8587;
}
#verification {
right: 18px;
bottom: 18px;
width: min(730px, calc(100vw - 420px));
padding: 17px;
}
#verification .panel-heading {
margin-bottom: 8px;
}
.status-badge {
padding: 6px 9px;
border-radius: 999px;
background: #dff2e8;
color: var(--green);
font-size: 9px;
font-weight: 900;
letter-spacing: 0.1em;
}
.status-badge.partial {
background: #fff0d9;
color: var(--amber);
}
.status-badge.fail {
background: #f7dfdf;
color: var(--red);
}
#verification-summary {
margin: 0 0 11px;
color: var(--muted);
font-size: 11px;
line-height: 1.45;
}
.table-wrap {
max-height: 220px;
overflow: auto;
border: 1px solid var(--line);
border-radius: 10px;
background: white;
}
table {
width: 100%;
border-collapse: collapse;
font-size: 10px;
}
th,
td {
padding: 8px 9px;
border-bottom: 1px solid rgba(24, 48, 56, 0.09);
text-align: left;
vertical-align: middle;
}
th {
position: sticky;
top: 0;
z-index: 1;
background: #eef2ef;
color: #5e6b6e;
font-size: 9px;
letter-spacing: 0.055em;
text-transform: uppercase;
}
tbody tr:last-child td {
border-bottom: 0;
}
.event-cell {
min-width: 132px;
}
.event-cell b,
.event-cell small {
display: block;
}
.event-cell b {
margin-bottom: 3px;
font-size: 10px;
}
.event-cell small {
color: var(--muted);
font-size: 9px;
}
.proof {
min-width: 112px;
}
.proof.pass {
background: #f1faf4;
}
.proof-top {
display: flex;
align-items: center;
gap: 4px;
}
.proof-top svg {
width: 17px;
height: 17px;
}
.proof-top b {
font-size: 9px;
}
.proof small {
display: block;
margin: 3px 0 0 23px;
color: var(--muted);
font-size: 8px;
}
.proof.off {
color: #929999;
text-align: center;
}
.check {
color: var(--green);
font-weight: 900;
}
.verification-note {
margin: 10px 0 0;
color: var(--muted);
font-size: 9px;
line-height: 1.45;
}
#hint {
position: fixed;
z-index: 4;
bottom: 17px;
left: 50%;
padding: 8px 12px;
border: 1px solid rgba(255, 255, 255, 0.75);
border-radius: 999px;
background: rgba(28, 48, 54, 0.78);
color: white;
font-size: 10px;
font-weight: 700;
pointer-events: none;
transform: translateX(-50%);
backdrop-filter: blur(8px);
}
@media (max-width: 1180px) {
#verification {
width: calc(100vw - 36px);
bottom: 12px;
}
#inspector {
bottom: 292px;
}
#hint {
display: none;
}
}
@media (max-width: 760px) {
#mission {
top: 10px;
left: 10px;
width: calc(100vw - 20px);
padding: 13px;
}
#mission p,
.steps {
display: none;
}
#channel-panel {
top: 108px;
right: 10px;
width: 270px;
padding: 12px;
}
#inspector {
bottom: 10px;
left: 10px;
width: calc(100vw - 20px);
max-height: 230px;
overflow: auto;
}
#verification {
display: none;
}
}
</style>
</head>
<body>
<div id="viewport" aria-label="Interactive voxel public hall"></div>
<header id="mission" class="panel">
<div class="eyebrow">Accessibility resilience / Public Hall 04</div>
<h1>One channel off.<br>Every event still clear.</h1>
<p>
Disable a channel and verify that the remaining signs, captions, and printed
notices preserve the same event symbols and locations.
</p>
<div class="steps">
<span class="step"><b>1</b> Disable a channel</span>
<span class="step"><b>2</b> Select an event</span>
<span class="step"><b>3</b> Verify coverage</span>
</div>
</header>
<section id="channel-panel" class="panel" aria-label="Information channel controls">
<div class="panel-heading">
<h2>Information channels</h2>
<span class="live-dot">Live scene</span>
</div>
<div id="channel-list">
<button class="channel-toggle" data-channel="audio" aria-pressed="true">
<span class="channel-icon">◖</span>
<span class="channel-copy">
<b>PA captions</b>
<small>Public-address audio with visual captions</small>
</span>
<span class="channel-state">ON</span>
</button>
<button class="channel-toggle" data-channel="digital" aria-pressed="true">
<span class="channel-icon">▣</span>
<span class="channel-copy">
<b>Digital signs</b>
<small>Illuminated wayfinding displays</small>
</span>
<span class="channel-state">ON</span>
</button>
<button class="channel-toggle" data-channel="print" aria-pressed="true">
<span class="channel-icon">▤</span>
<span class="channel-copy">
<b>Printed notices</b>
<small>Static event cards and service posters</small>
</span>
<span class="channel-state">ON</span>
</button>
</div>
<div class="button-row">
<button id="verify-button">Verify remaining coverage</button>
<button id="reset-button">Reset</button>
</div>
<p id="coverage-summary" aria-live="polite"></p>
</section>
<section id="inspector" class="panel" aria-label="Selected event inspector">
<div class="panel-heading">
<h2>Event inspector</h2>
<button id="reset-view" title="Reset camera view">Reset view</button>
</div>
<div class="inspector-top">
<div id="inspector-symbol" class="large-symbol"></div>
<div>
<div id="inspector-code"></div>
<div id="inspector-title"></div>
</div>
</div>
<select id="event-select" aria-label="Select a public service event"></select>
<div id="event-previews"></div>
</section>
<section id="verification" class="panel" aria-label="Channel redundancy verification">
<div class="panel-heading">
<h2>Coverage proof</h2>
<span id="status-badge" class="status-badge">PASS</span>
</div>
<p id="verification-summary" aria-live="polite"></p>
<div class="table-wrap">
<table>
<thead>
<tr>
<th>Event</th>
<th>PA captions</th>
<th>Digital signs</th>
<th>Printed notices</th>
</tr>
</thead>
<tbody id="verification-body"></tbody>
</table>
</div>
<p class="verification-note">
Proof rule: every active channel must repeat the canonical event symbol and
the same location code/name. A successful test requires at least two active
channels for every event.
</p>
</section>
<div id="hint">Drag to orbit · Scroll to zoom · Click a service station</div>
<script type="module">
import * as THREE from
"https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
// -------------------------------------------------------------------------
// Scene data
// -------------------------------------------------------------------------
const CHANNEL_ORDER = ["audio", "digital", "print"];
const CHANNEL_META = {
audio: {
name: "PA captions",
short: "PA",
description: "Public-address audio with visual captions"
},
digital: {
name: "Digital signs",
short: "Digital",
description: "Illuminated wayfinding displays"
},
print: {
name: "Printed notices",
short: "Printed",
description: "Static event cards and service posters"
}
};
const events = [
{
id: "bus",
code: "E1",
location: "East Exit",
title: "Bus 24 delayed 10 min",
color: "#e66a3a",
type: "bus",
position: [11.5, 0, -1],
symbol: [
"0011100",
"0111110",
"1101011",
"1111111",
"1001001",
"0111110",
"0011100"
]
},
{
id: "library",
code: "W2",
location: "West Wing",
title: "Library desk now open",
color: "#3978c8",
type: "library",
position: [-11.5, 0, -1],
symbol: [
"1100011",
"1010101",
"1011101",
"1010101",
"1011101",
"1010101",
"1100011"
]
},
{
id: "help",
code: "C1",
location: "Central Counter",
title: "Help desk is available",
color: "#795bc4",
type: "help",
position: [0, 0, 6],
symbol: [
"0111100",
"1100110",
"0000110",
"0001100",
"0011000",
"0000000",
"0011000"
]
},
{
id: "water",
code: "S1",
location: "South Lobby",
title: "Water shuttle is ready",
color: "#249c90",
type: "water",
position: [0, 0, -8],
symbol: [
"0011100",
"0011100",
"0111110",
"0111110",
"1111111",
"1111111",
"0111110"
]
}
];
const eventById = Object.fromEntries(events.map((event) => [event.id, event]));
// Each channel deliberately uses the same canonical symbol and location.
const channelPayload = Object.fromEntries(
CHANNEL_ORDER.map((channel) => [
channel,
Object.fromEntries(
events.map((event) => [
event.id,
{
symbol: event.id,
location: `${event.code} · ${event.location}`,
caption: event.title
}
])
)
])
);
const state = {
activeChannels: new Set(CHANNEL_ORDER),
selectedEvent: "bus"
};
// -------------------------------------------------------------------------
// Renderer and camera
// -------------------------------------------------------------------------
const viewport = document.getElementById("viewport");
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;
viewport.appendChild(renderer.domElement);
const scene = new THREE.Scene();
scene.background = new THREE.Color("#dce5e3");
scene.fog = new THREE.Fog("#dce5e3", 48, 88);
const camera = new THREE.OrthographicCamera(-20, 20, 15, -15, 0.1, 150);
const cameraTarget = new THREE.Vector3(0, 1.5, -1);
const orbit = {
yaw: 0.62,
pitch: 0.68,
zoom: 1.03,
dragging: false,
moved: false,
pointerX: 0,
pointerY: 0
};
const hemisphere = new THREE.HemisphereLight("#f5fbff", "#847765", 2.25);
scene.add(hemisphere);
const sun = new THREE.DirectionalLight("#fff4dd", 3.15);
sun.position.set(16, 24, 13);
sun.castShadow = true;
sun.shadow.mapSize.set(2048, 2048);
sun.shadow.camera.left = -26;
sun.shadow.camera.right = 26;
sun.shadow.camera.top = 24;
sun.shadow.camera.bottom = -24;
sun.shadow.camera.near = 1;
sun.shadow.camera.far = 70;
sun.shadow.bias = -0.00035;
scene.add(sun);
const world = new THREE.Group();
scene.add(world);
const materialCache = new Map();
function getMaterial(color) {
if (!materialCache.has(color)) {
materialCache.set(
color,
new THREE.MeshStandardMaterial({
color,
roughness: 0.88,
metalness: 0.02,
flatShading: true
})
);
}
return materialCache.get(color);
}
function addBox(parent, size, position, color, options = {}) {
const geometry = new THREE.BoxGeometry(...size);
const mesh = new THREE.Mesh(
geometry,
options.material || getMaterial(color)
);
mesh.position.set(...position);
mesh.castShadow = options.castShadow !== false;
mesh.receiveShadow = options.receiveShadow !== false;
parent.add(mesh);
return mesh;
}
function updateCamera() {
const aspect = window.innerWidth / window.innerHeight;
const viewHeight = aspect < 1 ? 39 : 29;
camera.left = (-viewHeight * aspect) / 2;
camera.right = (viewHeight * aspect) / 2;
camera.top = viewHeight / 2;
camera.bottom = -viewHeight / 2;
const radius = 42;
camera.position.set(
cameraTarget.x + Math.sin(orbit.yaw) * Math.cos(orbit.pitch) * radius,
cameraTarget.y + Math.sin(orbit.pitch) * radius,
cameraTarget.z + Math.cos(orbit.yaw) * Math.cos(orbit.pitch) * radius
);
camera.lookAt(cameraTarget);
camera.zoom = orbit.zoom;
camera.updateProjectionMatrix();
}
function resetCamera() {
orbit.yaw = 0.62;
orbit.pitch = 0.68;
orbit.zoom = 1.03;
updateCamera();
}
// -------------------------------------------------------------------------
// Pixel-symbol helpers shared by HTML and Three.js textures
// -------------------------------------------------------------------------
function symbolSVG(event, className = "") {
const cell = 10;
const width = event.symbol[0].length * cell;
const height = event.symbol.length * cell;
const pixels = event.symbol
.flatMap((row, y) =>
[...row].map((value, x) =>
value === "1"
? `<rect x="${x * cell}" y="${y * cell}" width="${cell}" height="${cell}"/>`
: ""
)
)
.join("");
return `
<svg class="${className}" viewBox="0 0 ${width} ${height}"
shape-rendering="crispEdges" aria-hidden="true">
<g fill="${event.color}">${pixels}</g>
</svg>
`;
}
function drawPixelSymbol(ctx, event, x, y, cell) {
ctx.fillStyle = event.color;
event.symbol.forEach((row, rowIndex) => {
[...row].forEach((pixel, columnIndex) => {
if (pixel === "1") {
ctx.fillRect(
x + columnIndex * cell,
y + rowIndex * cell,
cell,
cell
);
}
});
});
}
// -------------------------------------------------------------------------
// Canvas-backed voxel signage
// -------------------------------------------------------------------------
function createChannelLabel(event, channel) {
const canvas = document.createElement("canvas");
canvas.width = 640;
canvas.height = 176;
const ctx = canvas.getContext("2d");
const digital = channel === "digital";
const audio = channel === "audio";
const background = digital ? "#122d34" : audio ? "#fff7e8" : "#f6efdf";
const titleColor = digital ? "#f2ffff" : "#183038";
const locationColor = digital ? "#72e1d5" : "#4f686d";
const borderColor = digital ? "#3a7c86" : "#cfc2ac";
const chipColor = digital ? "#42d4c0" : audio ? "#d99a33" : "#93704a";
ctx.fillStyle = background;
ctx.fillRect(0, 0, canvas.width, canvas.height);
ctx.strokeStyle = borderColor;
ctx.lineWidth = 7;
ctx.strokeRect(4, 4, canvas.width - 8, canvas.height - 8);
ctx.fillStyle = chipColor;
ctx.fillRect(0, 0, 15, canvas.height);
drawPixelSymbol(ctx, event, 30, 45, 12);
ctx.textBaseline = "alphabetic";
ctx.fillStyle = titleColor;
ctx.font = '800 29px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace';
ctx.fillText(event.title, 142, 78, 470);
ctx.fillStyle = locationColor;
ctx.font = '700 23px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace';
ctx.fillText(`${event.code} · ${event.location}`, 142, 123, 470);
ctx.textAlign = "right";
ctx.fillStyle = digital ? "#94aaa9" : "#7b8888";
ctx.font = '800 15px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace';
ctx.fillText(
digital ? "DIGITAL SIGN" : audio ? "PA / CAPTION" : "PRINTED NOTICE",
612,
29
);
ctx.textAlign = "left";
const texture = new THREE.CanvasTexture(canvas);
texture.colorSpace = THREE.SRGBColorSpace;
texture.minFilter = THREE.LinearFilter;
texture.magFilter = THREE.LinearFilter;
const material = new THREE.SpriteMaterial({
map: texture,
transparent: true,
depthTest: false,
depthWrite: false,
toneMapped: false
});
const sprite = new THREE.Sprite(material);
sprite.scale.set(4.25, 1.17, 1);
sprite.renderOrder = 20;
return sprite;
}
function createHallSign(text, subtitle, position, width = 7) {
const canvas = document.createElement("canvas");
canvas.width = 768;
canvas.height = 180;
const ctx = canvas.getContext("2d");
ctx.fillStyle = "#193a40";
ctx.fillRect(0, 0, canvas.width, canvas.height);
ctx.fillStyle = "#6dd4c1";
ctx.fillRect(0, 0, canvas.width, 17);
ctx.textAlign = "center";
ctx.fillStyle = "#f4fffc";
ctx.font = '900 50px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace';
ctx.fillText(text, canvas.width / 2, 83);
ctx.fillStyle = "#9ec0bc";
ctx.font = '700 24px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace';
ctx.fillText(subtitle, canvas.width / 2, 128);
const texture = new THREE.CanvasTexture(canvas);
texture.colorSpace = THREE.SRGBColorSpace;
const sprite = new THREE.Sprite(
new THREE.SpriteMaterial({
map: texture,
depthTest: false,
depthWrite: false,
toneMapped: false
})
);
sprite.position.set(...position);
sprite.scale.set(width, width * (180 / 768), 1);
sprite.renderOrder = 18;
return sprite;
}
// -------------------------------------------------------------------------
// Voxel public hall
// -------------------------------------------------------------------------
function addWindow(parent, x, y, z, width = 5, height = 2.7) {
const frame = "#46666c";
const glass = "#93b8c0";
addBox(parent, [width + 0.32, height + 0.32, 0.16], [x, y, z], frame);
addBox(parent, [width, height, 0.08], [x, y, z + 0.1], glass, {
castShadow: false
});
addBox(parent, [0.12, height, 0.1], [x, y, z + 0.18], frame);
addBox(parent, [width, 0.12, 0.1], [x, y, z + 0.18], frame);
}
function addBench(parent, x, z, rotation = 0) {
const bench = new THREE.Group();
bench.position.set(x, 0, z);
bench.rotation.y = rotation;
parent.add(bench);
addBox(bench, [4.2, 0.32, 1.1], [0, 0.9, 0], "#8a6547");
addBox(bench, [4.2, 1.05, 0.28], [0, 1.55, -0.42], "#9a7452");
addBox(bench, [0.35, 0.85, 0.8], [-1.55, 0.45, 0], "#485a5c");
addBox(bench, [0.35, 0.85, 0.8], [1.55, 0.45, 0], "#485a5c");
return bench;
}
function addPlant(parent, x, z) {
const plant = new THREE.Group();
plant.position.set(x, 0, z);
parent.add(plant);
addBox(plant, [1.2, 1.0, 1.2], [0, 0.5, 0], "#b47554");
addBox(plant, [0.7, 1.8, 0.7], [0, 1.65, 0], "#477a54");
addBox(plant, [1.25, 0.65, 0.65], [0.1, 2.05, 0], "#5e9565");
addBox(plant, [0.65, 0.65, 1.25], [-0.1, 1.55, 0.08], "#3e714d");
}
function addPerson(parent, x, z, shirtColor, skinColor = "#d8a67c") {
const person = new THREE.Group();
person.position.set(x, 0, z);
parent.add(person);
addBox(person, [0.72, 1.15, 0.48], [0, 1.38, 0], shirtColor);
addBox(person, [0.58, 0.58, 0.58], [0, 2.23, 0], skinColor);
addBox(person, [0.62, 0.18, 0.62], [0, 2.55, -0.02], "#4b3d34");
addBox(person, [0.27, 0.9, 0.3], [-0.22, 0.45, 0], "#30454c");
addBox(person, [0.27, 0.9, 0.3], [0.22, 0.45, 0], "#30454c");
addBox(person, [0.22, 0.85, 0.25], [-0.5, 1.35, 0], shirtColor);
addBox(person, [0.22, 0.85, 0.25], [0.5, 1.35, 0], shirtColor);
}
function createHall() {
const hall = new THREE.Group();
world.add(hall);
addBox(hall, [37, 0.6, 28], [0, -0.42, 0], "#b9ad99");
const tileColors = ["#d9d0bf", "#ddd4c3", "#d5ccbb", "#e0d7c7"];
let tileIndex = 0;
for (let ix = 0; ix < 12; ix++) {
for (let iz = 0; iz < 9; iz++) {
addBox(
hall,
[2.91, 0.1, 2.91],
[-16.5 + ix * 3, -0.06, -12 + iz * 3],
tileColors[tileIndex++ % tileColors.length],
{ castShadow: false }
);
}
}
// Back and left walls form a cutaway hall.
addBox(hall, [36.5, 8, 0.55], [0, 4, -13.75], "#d7ded8");
addBox(hall, [0.55, 8, 27.5], [-18, 4, 0], "#cbd6d1");
addBox(hall, [36.2, 0.55, 0.18], [0, 0.25, -13.42], "#71898a");
addBox(hall, [0.18, 0.55, 27.2], [-17.66, 0.25, 0], "#71898a");
addWindow(hall, -11.2, 4.7, -13.43);
addWindow(hall, -2.2, 4.7, -13.43);
addWindow(hall, 6.8, 4.7, -13.43);
// East doorway.
addBox(hall, [4.4, 5.8, 0.25], [14.6, 2.9, -13.42], "#3f555b");
addBox(hall, [3.55, 5.15, 0.18], [14.6, 2.75, -13.25], "#92b0ad");
addBox(hall, [0.14, 5.15, 0.2], [14.6, 2.75, -13.1], "#456267");
addBox(hall, [3.55, 0.14, 0.2], [14.6, 2.75, -13.1], "#456267");
// Structural columns.
[-16.7, 16.7].forEach((x) => {
addBox(hall, [0.8, 8.2, 0.8], [x, 4.1, -12.7], "#aab8b3");
addBox(hall, [1.2, 0.35, 1.2], [x, 0.2, -12.7], "#849994");
addBox(hall, [1.15, 0.35, 1.15], [x, 8.0, -12.7], "#849994");
});
// Open roof beams.
addBox(hall, [33.5, 0.42, 0.5], [0, 7.85, -12.9], "#819794");
addBox(hall, [0.5, 0.42, 26], [-17.45, 7.85, 0], "#819794");
const hallSign = createHallSign(
"CIVIC COMMONS",
"PUBLIC SERVICE HALL • ACCESSIBLE INFORMATION",
[0, 7.05, -13.1],
9.5
);
hall.add(hallSign);
addBench(hall, -6.5, 3.2, 0);
addBench(hall, 6.5, 3.2, 0);
addBench(hall, -14.5, 7.5, Math.PI / 2);
addBench(hall, 14.5, 7.5, Math.PI / 2);
addPlant(hall, -16.1, 10.6);
addPlant(hall, 16.1, 10.6);
addPlant(hall, -16.2, -10.9);
addPlant(hall, 15.9, -10.8);
addPerson(hall, -4.8, 1.3, "#d38a4d");
addPerson(hall, 4.8, 1.8, "#567ca6");
addPerson(hall, -8.4, 7.1, "#718d68");
addPerson(hall, 8.8, -8.1, "#8a6ca4");
addPerson(hall, 2.3, -3.4, "#d2b24d");
// Voxel wayfinding arrows.
for (let i = 0; i < 5; i++) {
addBox(
hall,
[0.7, 0.035, 0.28],
[-9 + i * 0.72, 0.035, 2.3],
"#8da5a1",
{ castShadow: false }
);
}
return hall;
}
createHall();
// -------------------------------------------------------------------------
// Event stations
// -------------------------------------------------------------------------
const hitboxes = [];
const selectionFrames = new Map();
const channelVisuals = {};
function addBus(group, event) {
addBox(group, [3.2, 1.65, 5.0], [0, 1.38, 0], event.color);
addBox(group, [3.0, 0.35, 4.75], [0, 2.27, 0], "#f08b53");
addBox(group, [2.55, 0.58, 0.09], [0, 1.86, 2.54], "#9cc7cf");
addBox(group, [0.09, 0.58, 3.7], [1.63, 1.85, -0.25], "#9cc7cf");
addBox(group, [0.09, 0.58, 3.7], [-1.63, 1.85, -0.25], "#9cc7cf");
addBox(group, [2.8, 0.25, 0.2], [0, 0.7, 2.65], "#5d6161");
[-1.65, 1.65].forEach((x) => {
[-1.7, 1.7].forEach((z) => {
addBox(group, [0.42, 0.82, 0.82], [x, 0.55, z], "#303b3e");
addBox(group, [0.46, 0.46, 0.86], [x, 0.55, z], "#526064");
});
});
}
function addLibrary(group, event) {
addBox(group, [5.5, 4.3, 0.42], [0, 2.2, -0.25], "#755843");
addBox(group, [5.0, 3.85, 0.18], [0, 2.2, 0.02], "#3e5960");
const bookColors = ["#d16b57", "#e0b452", "#4f9a83", "#5c78b4", "#a56c9c"];
for (let shelf = 0; shelf < 3; shelf++) {
const shelfY = 0.95 + shelf * 1.12;
addBox(group, [5.0, 0.15, 1.25], [0, shelfY, 0.55], "#8f6848");
for (let bookIndex = 0; bookIndex < 10; bookIndex++) {
const height = 0.55 + ((bookIndex + shelf) % 3) * 0.12;
addBox(
group,
[0.28, height, 0.55],
[-2.05 + bookIndex * 0.45, shelfY + 0.08 + height / 2, 0.57],
bookColors[(bookIndex + shelf) % bookColors.length]
);
}
}
addBox(group, [0.35, 4.8, 0.5], [-2.8, 2.4, 0.35], event.color);
addBox(group, [0.35, 4.8, 0.5], [2.8, 2.4, 0.35], event.color);
}
function addHelpDesk(group, event) {
addBox(group, [5.0, 1.45, 2.2], [0, 0.82, 0], "#75629c");
addBox(group, [5.4, 0.24, 2.55], [0, 1.68, 0], "#ddd9d0");
addBox(group, [4.3, 0.12, 0.12], [0, 1.18, 1.14], "#d9b5e5");
addBox(group, [1.25, 0.8, 0.22], [1.25, 2.3, -0.75], event.color);
addBox(group, [1.1, 0.55, 0.12], [1.25, 2.38, -0.61], "#f1eafb");
addPerson(group, -0.8, -1.35, "#e7e2d7");
}
function addWaterStation(group, event) {
addBox(group, [4.8, 0.3, 2.6], [0, 1.15, 0], "#78928f");
addBox(group, [0.25, 1.15, 0.25], [-1.9, 0.55, -0.8], "#526b69");
addBox(group, [0.25, 1.15, 0.25], [1.9, 0.55, -0.8], "#526b69");
addBox(group, [0.25, 1.15, 0.25], [-1.9, 0.55, 0.8], "#526b69");
addBox(group, [0.25, 1.15, 0.25], [1.9, 0.55, 0.8], "#526b69");
for (let i = 0; i < 4; i++) {
addBox(
group,
[0.85, 0.85, 0.85],
[-1.45 + i * 0.95, 1.75, -0.45],
i % 2 ? "#4bb4a9" : "#79c9bd"
);
addBox(
group,
[0.72, 0.3, 0.72],
[-1.45 + i * 0.95, 2.3, -0.45],
"#b4e2dc"
);
}
// Pixel-like water drop sculpture.
addBox(group, [1.4, 0.8, 0.7], [0, 2.25, 0.55], event.color);
addBox(group, [0.85, 0.75, 0.7], [0, 2.85, 0.55], event.color);
addBox(group, [0.4, 0.45, 0.7], [0, 3.4, 0.55], event.color);
}
function createSelectionFrame(event) {
const frame = new THREE.Group();
const material = new THREE.MeshBasicMaterial({
color: event.color,
transparent: true,
opacity: 0.9,
depthWrite: false
});
const width = 6.2;
const depth = 6.2;
addBox(frame, [width, 0.07, 0.13], [0, 0.14, -depth / 2], event.color, {
material,
castShadow: false
});
addBox(frame, [width, 0.07, 0.13], [0, 0.14, depth / 2], event.color, {
material,
castShadow: false
});
addBox(frame, [0.13, 0.07, depth], [-width / 2, 0.14, 0], event.color, {
material,
castShadow: false
});
addBox(frame, [0.13, 0.07, depth], [width / 2, 0.14, 0], event.color, {
material,
castShadow: false
});
frame.visible = false;
frame.userData.material = material;
return frame;
}
function createEventStation(event) {
const group = new THREE.Group();
group.position.set(...event.position);
world.add(group);
addBox(group, [5.5, 0.22, 5.8], [0, 0.06, 0], "#c5bdac", {
castShadow: false
});
if (event.type === "bus") addBus(group, event);
if (event.type === "library") addLibrary(group, event);
if (event.type === "help") addHelpDesk(group, event);
if (event.type === "water") addWaterStation(group, event);
const frame = createSelectionFrame(event);
group.add(frame);
selectionFrames.set(event.id, frame);
const hitbox = addBox(
group,
[6.0, 4.2, 6.0],
[0, 2.0, 0],
"#ffffff",
{
material: new THREE.MeshBasicMaterial({
transparent: true,
opacity: 0,
depthWrite: false,
colorWrite: false
}),
castShadow: false,
receiveShadow: false
}
);
hitbox.userData.eventId = event.id;
hitboxes.push(hitbox);
channelVisuals[event.id] = {};
CHANNEL_ORDER.forEach((channel) => {
channelVisuals[event.id][channel] = createChannelVisual(event, channel, group);
});
return group;
}
events.forEach(createEventStation);
// -------------------------------------------------------------------------
// Three physical representations of each channel
// -------------------------------------------------------------------------
function createChannelVisual(event, channel, parent) {
const group = new THREE.Group();
if (channel === "audio") {
group.position.set(-3.8, 0, 1.1);
} else if (channel === "digital") {
group.position.set(0, 0, -3.0);
} else {
group.position.set(3.8, 0, 1.1);
}
parent.add(group);
if (channel === "audio") {
addBox(group, [0.25, 2.2, 0.25], [0, 1.1, 0], "#59676a");
addBox(group, [1.15, 1.15, 0.62], [0, 2.48, 0], "#344247");
addBox(group, [0.78, 0.08, 0.08], [0, 2.75, 0.34], "#8d9997");
addBox(group, [0.78, 0.08, 0.08], [0, 2.48, 0.34], "#8d9997");
addBox(group, [0.78, 0.08, 0.08], [0, 2.21, 0.34], "#8d9997");
const pulses = [];
for (let i = 0; i < 3; i++) {
const pulse = addBox(
group,
[0.15, 0.15, 0.15],
[0, 3.25 + i * 0.32, 0],
"#55cbb5",
{ castShadow: false }
);
pulses.push(pulse);
}
group.userData.pulses = pulses;
const label = createChannelLabel(event, channel);
label.position.set(0, 4.2, 0);
group.add(label);
}
if (channel === "digital") {
addBox(group, [1.9, 0.3, 1.25], [0, 0.15, 0], "#506266");
addBox(group, [0.42, 2.5, 0.42], [0, 1.45, 0], "#40565c");
addBox(group, [2.35, 1.6, 0.38], [0, 2.65, 0], "#203b43");
addBox(group, [2.0, 1.25, 0.08], [0, 2.65, 0.24], "#315e67");
addBox(group, [1.45, 0.12, 0.1], [0, 3.2, 0.31], event.color);
const label = createChannelLabel(event, channel);
label.position.set(0, 4.75, 0);
group.add(label);
}
if (channel === "print") {
addBox(group, [0.22, 1.8, 0.22], [-0.82, 0.9, 0], "#70583f");
addBox(group, [0.22, 1.8, 0.22], [0.82, 0.9, 0], "#70583f");
addBox(group, [2.45, 1.75, 0.25], [0, 2.15, 0], "#9b7650");
addBox(group, [2.08, 1.38, 0.08], [0, 2.15, 0.17], "#fffaf0");
addBox(group, [0.35, 0.12, 0.1], [-0.55, 2.48, 0.24], event.color);
addBox(group, [1.3, 0.08, 0.08], [0.15, 2.21, 0.24], "#9ba19d");
addBox(group, [1.45, 0.08, 0.08], [0.05, 1.98, 0.24], "#9ba19d");
addBox(group, [0.65, 0.08, 0.08], [-0.45, 1.75, 0.24], "#9ba19d");
const label = createChannelLabel(event, channel);
label.position.set(0, 4.2, 0);
group.add(label);
}
return group;
}
// -------------------------------------------------------------------------
// UI rendering and verification
// -------------------------------------------------------------------------
const channelButtons = [...document.querySelectorAll(".channel-toggle")];
const eventSelect = document.getElementById("event-select");
const eventPreviews = document.getElementById("event-previews");
const verificationBody = document.getElementById("verification-body");
const verificationSummary = document.getElementById("verification-summary");
const coverageSummary = document.getElementById("coverage-summary");
const statusBadge = document.getElementById("status-badge");
const verifyButton = document.getElementById("verify-button");
const resetButton = document.getElementById("reset-button");
const resetView = document.getElementById("reset-view");
events.forEach((event) => {
const option = document.createElement("option");
option.value = event.id;
option.textContent = `${event.code} — ${event.title}`;
eventSelect.appendChild(option);
});
function updateChannelScene() {
events.forEach((event) => {
CHANNEL_ORDER.forEach((channel) => {
channelVisuals[event.id][channel].visible =
state.activeChannels.has(channel);
});
});
}
function updateChannelControls() {
channelButtons.forEach((button) => {
const channel = button.dataset.channel;
const active = state.activeChannels.has(channel);
button.classList.toggle("off", !active);
button.setAttribute("aria-pressed", String(active));
button.querySelector(".channel-state").textContent = active ? "ON" : "OFF";
});
}
function proofCell(event, channel) {
if (!state.activeChannels.has(channel)) {
return `<td class="proof off">OFF</td>`;
}
const payload = channelPayload[channel][event.id];
const canonicalLocation = `${event.code} · ${event.location}`;
const valid =
payload.symbol === event.id && payload.location === canonicalLocation;
return `
<td class="proof ${valid ? "pass" : ""}">
<div class="proof-top">
<span class="check">${valid ? "✓" : "!"}</span>
${symbolSVG(event)}
<b>${event.code}</b>
</div>
<small>${event.location}</small>
</td>
`;
}
function calculateVerification() {
const activeChannels = [...state.activeChannels];
let proofCount = 0;
let allEventsCovered = true;
let allSymbolsMatch = true;
let allLocationsMatch = true;
events.forEach((event) => {
if (activeChannels.length === 0) allEventsCovered = false;
activeChannels.forEach((channel) => {
const payload = channelPayload[channel][event.id];
const canonicalLocation = `${event.code} · ${event.location}`;
if (payload.symbol === event.id) proofCount++;
else allSymbolsMatch = false;
if (payload.location === canonicalLocation) proofCount++;
else allLocationsMatch = false;
});
});
const redundant =
activeChannels.length >= 2 &&
events.every((event) =>
activeChannels.every((channel) => {
const payload = channelPayload[channel][event.id];
return (
payload.symbol === event.id &&
payload.location === `${event.code} · ${event.location}`
);
})
);
let status = "PASS";
let message = "";
if (activeChannels.length === 0) {
status = "FAIL";
message = "No information channels are active; no announcement can be received.";
} else if (redundant) {
status = "PASS";
message =
`${activeChannels.length} active channels × ${events.length} events = ` +
`${proofCount} matching confirmations. Every event remains covered twice ` +
`with consistent symbols and locations.`;
} else {
status = "PARTIAL";
message =
"Every event is still present, but only one active channel remains. " +
"Redundancy is lost even though basic coverage continues.";
}
return {
status,
message,
proofCount,
allEventsCovered,
allSymbolsMatch,
allLocationsMatch
};
}
function renderVerification() {
const result = calculateVerification();
verificationBody.innerHTML = events
.map(
(event) => `
<tr>
<td class="event-cell">
<b>${event.code} · ${event.title}</b>
<small>Canonical symbol + location</small>
</td>
${CHANNEL_ORDER.map((channel) => proofCell(event, channel)).join("")}
</tr>
`
)
.join("");
verificationSummary.textContent = result.message;
statusBadge.textContent = result.status;
statusBadge.classList.toggle("partial", result.status === "PARTIAL");
statusBadge.classList.toggle("fail", result.status === "FAIL");
const activeCount = state.activeChannels.size;
const disabledNames = CHANNEL_ORDER
.filter((channel) => !state.activeChannels.has(channel))
.map((channel) => CHANNEL_META[channel].name)
.join(", ");
if (activeCount === 3) {
coverageSummary.textContent =
"3 channels active. Full redundancy is available for all four events.";
} else if (activeCount === 2) {
coverageSummary.textContent =
`1 channel disabled (${disabledNames}). Every event is still conveyed ` +
"by both remaining channels.";
} else if (activeCount === 1) {
coverageSummary.textContent =
`2 channels disabled (${disabledNames}). Coverage continues, but redundancy is lost.`;
} else {
coverageSummary.textContent =
"All channels are disabled. Restore a channel to restore announcements.";
}
}
function updateInspector() {
const event = eventById[state.selectedEvent];
eventSelect.value = event.id;
document.getElementById("inspector-symbol").innerHTML = symbolSVG(event);
document.getElementById("inspector-code").textContent =
`${event.code} / ${event.location.toUpperCase()}`;
document.getElementById("inspector-title").textContent = event.title;
eventPreviews.innerHTML = CHANNEL_ORDER.map((channel) => {
const active = state.activeChannels.has(channel);
const payload = channelPayload[channel][event.id];
return `
<div class="preview ${active ? "" : "off"}">
<span class="preview-icon">${symbolSVG(event)}</span>
<span class="preview-copy">
<b>${payload.caption}</b>
<small>${CHANNEL_META[channel].name} · ${payload.location}</small>
</span>
<span class="preview-state">${active ? "ON" : "OFF"}</span>
</div>
`;
}).join("");
}
function selectEvent(eventId) {
if (!eventById[eventId]) return;
state.selectedEvent = eventId;
selectionFrames.forEach((frame, id) => {
frame.visible = id === eventId;
});
updateInspector();
}
function toggleChannel(channel) {
if (state.activeChannels.has(channel)) {
state.activeChannels.delete(channel);
} else {
state.activeChannels.add(channel);
}
updateChannelScene();
updateChannelControls();
updateInspector();
renderVerification();
}
function runVerification() {
renderVerification();
const result = calculateVerification();
verifyButton.classList.add("verified");
verifyButton.textContent =
result.status === "PASS" ? "Coverage verified ✓" : `${result.status} — review`;
window.setTimeout(() => {
verifyButton.classList.remove("verified");
verifyButton.textContent = "Verify remaining coverage";
}, 1800);
}
channelButtons.forEach((button) => {
button.addEventListener("click", () => {
toggleChannel(button.dataset.channel);
});
});
eventSelect.addEventListener("change", (event) => {
selectEvent(event.target.value);
});
verifyButton.addEventListener("click", runVerification);
resetButton.addEventListener("click", () => {
state.activeChannels = new Set(CHANNEL_ORDER);
updateChannelScene();
updateChannelControls();
updateInspector();
renderVerification();
});
resetView.addEventListener("click", resetCamera);
// -------------------------------------------------------------------------
// Custom mouse/touch camera controls and station picking
// -------------------------------------------------------------------------
const raycaster = new THREE.Raycaster();
const pointer = new THREE.Vector2();
renderer.domElement.addEventListener("pointerdown", (event) => {
orbit.dragging = true;
orbit.moved = false;
orbit.pointerX = event.clientX;
orbit.pointerY = event.clientY;
renderer.domElement.setPointerCapture(event.pointerId);
renderer.domElement.classList.add("dragging");
});
renderer.domElement.addEventListener("pointermove", (event) => {
if (!orbit.dragging) return;
const deltaX = event.clientX - orbit.pointerX;
const deltaY = event.clientY - orbit.pointerY;
if (Math.abs(deltaX) + Math.abs(deltaY) > 4) orbit.moved = true;
orbit.pointerX = event.clientX;
orbit.pointerY = event.clientY;
orbit.yaw -= deltaX * 0.006;
orbit.pitch = THREE.MathUtils.clamp(orbit.pitch + deltaY * 0.005, 0.35, 1.18);
updateCamera();
});
renderer.domElement.addEventListener("pointerup", (event) => {
orbit.dragging = false;
renderer.domElement.classList.remove("dragging");
if (!orbit.moved) {
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(hitboxes, false);
if (intersections.length) {
selectEvent(intersections[0].object.userData.eventId);
}
}
});
renderer.domElement.addEventListener("pointercancel", () => {
orbit.dragging = false;
renderer.domElement.classList.remove("dragging");
});
renderer.domElement.addEventListener(
"wheel",
(event) => {
event.preventDefault();
orbit.zoom = THREE.MathUtils.clamp(
orbit.zoom - event.deltaY * 0.001,
0.65,
1.75
);
updateCamera();
},
{ passive: false }
);
window.addEventListener("keydown", (event) => {
const tag = event.target.tagName;
if (tag === "INPUT" || tag === "SELECT" || tag === "TEXTAREA") return;
if (event.key.toLowerCase() === "r") resetCamera();
if (event.key === "1") toggleChannel("audio");
if (event.key === "2") toggleChannel("digital");
if (event.key === "3") toggleChannel("print");
});
// -------------------------------------------------------------------------
// Resize and animation
// -------------------------------------------------------------------------
function resize() {
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.setSize(window.innerWidth, window.innerHeight);
updateCamera();
}
window.addEventListener("resize", resize);
updateCamera();
updateChannelScene();
updateChannelControls();
selectEvent(state.selectedEvent);
renderVerification();
const clock = new THREE.Clock();
function animate() {
requestAnimationFrame(animate);
const elapsed = clock.getElapsedTime();
events.forEach((event, eventIndex) => {
const audioGroup = channelVisuals[event.id].audio;
const pulses = audioGroup.userData.pulses || [];
pulses.forEach((pulse, pulseIndex) => {
const phase = (elapsed * 0.9 + pulseIndex * 0.32 + eventIndex * 0.2) % 1;
pulse.position.y = 3.25 + phase * 0.7;
pulse.material.opacity = 1 - phase;
pulse.visible = phase < 0.82;
});
});
const selectedFrame = selectionFrames.get(state.selectedEvent);
if (selectedFrame) {
selectedFrame.userData.material.opacity =
0.68 + Math.sin(elapsed * 3.2) * 0.18;
}
renderer.render(scene, camera);
}
animate();
</script>
</body>
</html>
```