Prompt specification
Build or customize the Three.js 3D scene "Information-version sorting game" 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: Information-version sorting game
Category: Architecture & Cities · Style: Procedural Solid / Shader 3D
License: MIT · Reference: https://three3d.app/scene/information-version-sorting-game-x0516
Scene Description Prompt:
Please create one self-contained HTML file with Three.js from cdnjs showing newspaper editions. Create a community board with fictional updates about an event; users arrange notices by time and identify the latest relevant instruction using explicit dates and revision markers. Low-poly.
Working Three.js Starter (information-version-sorting-game-x0516):
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="theme-color" content="#183f3a">
<title>Harborlight Community Board</title>
<style>
:root {
--ink: #183b37;
--muted: #65736e;
--paper: #f7f2e7;
--panel: #fffdf8;
--line: #d9d5c9;
--green: #235d50;
--green-dark: #173f39;
--mint: #dce9df;
--gold: #d49a3a;
--red: #b84f45;
--shadow: 0 18px 50px rgba(30, 50, 43, 0.14);
}
* {
box-sizing: border-box;
}
html,
body {
width: 100%;
min-height: 100%;
margin: 0;
}
body {
overflow: hidden;
color: var(--ink);
background: var(--paper);
font-family:
Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
"Segoe UI", sans-serif;
}
button,
select,
input {
font: inherit;
}
button,
select {
color: inherit;
}
button {
cursor: pointer;
}
button:focus-visible,
select:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
outline: 3px solid rgba(35, 93, 80, 0.28);
outline-offset: 2px;
}
#app {
width: 100vw;
height: 100vh;
display: flex;
flex-direction: column;
}
.topbar {
min-height: 78px;
display: flex;
align-items: center;
justify-content: space-between;
gap: 24px;
padding: 14px 24px;
color: #f8f4e8;
background:
linear-gradient(115deg, rgba(255,255,255,0.04), transparent 38%),
var(--green-dark);
border-bottom: 1px solid rgba(255, 255, 255, 0.12);
z-index: 10;
}
.brand {
display: flex;
align-items: center;
gap: 13px;
min-width: 0;
}
.brand-mark {
width: 42px;
height: 42px;
flex: 0 0 auto;
display: grid;
place-items: center;
color: var(--green-dark);
background: #e8d6a7;
border-radius: 9px 9px 9px 2px;
box-shadow: inset 0 0 0 2px rgba(24, 63, 58, 0.12);
transform: rotate(-2deg);
}
.brand-mark svg {
width: 25px;
height: 25px;
}
.brand-copy {
min-width: 0;
}
.eyebrow {
margin: 0 0 3px;
color: #b9d2c7;
font-size: 10px;
font-weight: 800;
letter-spacing: 0.15em;
text-transform: uppercase;
}
.brand h1 {
margin: 0;
overflow: hidden;
font-family: Georgia, "Times New Roman", serif;
font-size: clamp(19px, 2vw, 28px);
font-weight: 700;
letter-spacing: 0.01em;
text-overflow: ellipsis;
white-space: nowrap;
}
.top-actions {
display: flex;
align-items: center;
gap: 12px;
}
.fiction-chip {
display: inline-flex;
align-items: center;
gap: 8px;
padding: 8px 11px;
color: #dce9df;
border: 1px solid rgba(255,255,255,0.18);
border-radius: 999px;
font-size: 11px;
font-weight: 750;
letter-spacing: 0.06em;
text-transform: uppercase;
white-space: nowrap;
}
.fiction-chip::before {
content: "";
width: 7px;
height: 7px;
background: #95c6a8;
border-radius: 50%;
box-shadow: 0 0 0 4px rgba(149, 198, 168, 0.12);
}
.ghost-button {
padding: 9px 13px;
color: #f9f5e8;
background: rgba(255,255,255,0.07);
border: 1px solid rgba(255,255,255,0.19);
border-radius: 8px;
font-size: 12px;
font-weight: 700;
transition: background 150ms ease, transform 150ms ease;
}
.ghost-button:hover {
background: rgba(255,255,255,0.13);
transform: translateY(-1px);
}
main {
min-height: 0;
flex: 1;
display: grid;
grid-template-columns: minmax(0, 1fr) 390px;
}
.scene-shell {
position: relative;
min-width: 0;
min-height: 0;
overflow: hidden;
background: #cbd9cf;
}
#stage {
position: absolute;
inset: 0;
}
#stage canvas {
display: block;
width: 100%;
height: 100%;
touch-action: none;
}
.scene-heading {
position: absolute;
top: 22px;
left: 22px;
max-width: 340px;
padding: 13px 15px;
color: var(--ink);
background: rgba(255, 253, 248, 0.88);
border: 1px solid rgba(255,255,255,0.75);
border-radius: 12px;
box-shadow: 0 10px 30px rgba(30, 50, 43, 0.1);
backdrop-filter: blur(12px);
pointer-events: none;
}
.scene-heading strong {
display: block;
margin-bottom: 4px;
font-family: Georgia, "Times New Roman", serif;
font-size: 18px;
}
.scene-heading span {
color: var(--muted);
font-size: 12px;
line-height: 1.45;
}
.scene-legend {
position: absolute;
right: 20px;
bottom: 20px;
display: flex;
flex-wrap: wrap;
justify-content: flex-end;
gap: 8px;
max-width: 430px;
pointer-events: none;
}
.legend-item {
display: inline-flex;
align-items: center;
gap: 7px;
padding: 8px 10px;
color: #37534b;
background: rgba(255, 253, 248, 0.88);
border: 1px solid rgba(255,255,255,0.75);
border-radius: 8px;
box-shadow: 0 8px 24px rgba(30, 50, 43, 0.09);
font-size: 11px;
font-weight: 650;
backdrop-filter: blur(10px);
}
.legend-dot {
width: 8px;
height: 8px;
background: var(--green);
border-radius: 2px;
transform: rotate(8deg);
}
.legend-dot.gold {
background: var(--gold);
}
.toast {
position: absolute;
left: 50%;
bottom: 24px;
max-width: calc(100% - 40px);
padding: 11px 15px;
color: #f8f4e8;
background: rgba(24, 63, 58, 0.94);
border-radius: 9px;
box-shadow: var(--shadow);
font-size: 12px;
font-weight: 700;
opacity: 0;
transform: translate(-50%, 12px);
transition: opacity 180ms ease, transform 180ms ease;
pointer-events: none;
}
.toast.show {
opacity: 1;
transform: translate(-50%, 0);
}
.panel {
min-height: 0;
overflow-y: auto;
padding: 22px;
background: var(--panel);
border-left: 1px solid var(--line);
box-shadow: -12px 0 35px rgba(36, 55, 49, 0.06);
scrollbar-width: thin;
scrollbar-color: #c8cec7 transparent;
}
.panel-section {
padding-bottom: 22px;
margin-bottom: 22px;
border-bottom: 1px solid var(--line);
}
.panel-section:last-child {
padding-bottom: 0;
margin-bottom: 0;
border-bottom: 0;
}
.section-heading {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 12px;
margin-bottom: 8px;
}
.section-heading h2 {
margin: 0;
font-family: Georgia, "Times New Roman", serif;
font-size: 21px;
line-height: 1.15;
}
.section-heading h3 {
margin: 0;
font-size: 14px;
line-height: 1.3;
}
.section-copy {
margin: 0 0 14px;
color: var(--muted);
font-size: 12px;
line-height: 1.55;
}
.count-badge {
min-width: 27px;
padding: 5px 8px;
color: var(--green);
background: var(--mint);
border-radius: 999px;
font-size: 11px;
font-weight: 800;
text-align: center;
}
.small-button {
flex: 0 0 auto;
padding: 7px 9px;
color: var(--green);
background: #f1f4ed;
border: 1px solid #d6dfd6;
border-radius: 7px;
font-size: 10px;
font-weight: 800;
letter-spacing: 0.035em;
text-transform: uppercase;
}
.small-button:hover {
background: var(--mint);
}
.timeline {
display: grid;
gap: 8px;
margin-top: 13px;
}
.notice-row {
position: relative;
display: grid;
grid-template-columns: 25px minmax(0, 1fr) auto;
align-items: center;
gap: 9px;
padding: 10px 9px;
background: #faf8f1;
border: 1px solid #e0ddd3;
border-radius: 9px;
cursor: grab;
transition:
border-color 140ms ease,
background 140ms ease,
box-shadow 140ms ease,
opacity 140ms ease;
}
.notice-row:hover {
background: #fffdf7;
border-color: #bdcabe;
}
.notice-row.selected {
background: #edf5ee;
border-color: #75a087;
box-shadow: inset 3px 0 0 var(--green);
}
.notice-row.dragging {
opacity: 0.45;
}
.notice-row.drop-before {
box-shadow: inset 0 3px 0 var(--green);
}
.notice-row.drop-after {
box-shadow: inset 0 -3px 0 var(--green);
}
.row-number {
width: 25px;
height: 25px;
display: grid;
place-items: center;
color: #fff;
background: var(--topic-color, var(--green));
border-radius: 7px 7px 7px 2px;
font-size: 10px;
font-weight: 850;
box-shadow: 0 3px 8px rgba(30, 50, 43, 0.14);
}
.row-content {
min-width: 0;
}
.row-title {
overflow: hidden;
margin-bottom: 4px;
font-size: 12px;
font-weight: 800;
line-height: 1.25;
text-overflow: ellipsis;
white-space: nowrap;
}
.row-meta {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 5px;
color: var(--muted);
font-size: 9px;
font-weight: 700;
letter-spacing: 0.025em;
text-transform: uppercase;
}
.revision-pill {
padding: 2px 5px;
color: #765417;
background: #f5e8c9;
border-radius: 4px;
font-size: 9px;
font-weight: 900;
}
.drag-grip {
color: #a6aca7;
font-size: 17px;
letter-spacing: -3px;
user-select: none;
}
.selected-card {
padding: 14px;
margin-top: 14px;
background: #f2f4ed;
border: 1px solid #d8dfd6;
border-radius: 10px;
}
.selected-card h4 {
margin: 0 0 8px;
font-size: 13px;
line-height: 1.35;
}
.date-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 8px;
margin: 10px 0;
}
.date-cell {
padding: 9px;
background: rgba(255,255,255,0.72);
border-radius: 7px;
}
.date-cell span {
display: block;
margin-bottom: 3px;
color: var(--muted);
font-size: 8px;
font-weight: 850;
letter-spacing: 0.08em;
text-transform: uppercase;
}
.date-cell strong {
display: block;
font-size: 10px;
line-height: 1.35;
}
.order-actions {
display: flex;
gap: 7px;
}
.order-actions button {
flex: 1;
padding: 8px;
color: var(--green);
background: #fff;
border: 1px solid #cfd8ce;
border-radius: 7px;
font-size: 10px;
font-weight: 800;
}
.order-actions button:hover:not(:disabled) {
background: var(--mint);
}
.order-actions button:disabled {
cursor: not-allowed;
opacity: 0.4;
}
.finder-controls {
display: grid;
grid-template-columns: minmax(0, 1fr) auto;
gap: 8px;
margin: 12px 0 10px;
}
.finder-controls select {
min-width: 0;
width: 100%;
padding: 10px 32px 10px 11px;
background: #fff;
border: 1px solid #cfd5cd;
border-radius: 8px;
font-size: 12px;
font-weight: 700;
}
.toggle {
display: flex;
align-items: center;
gap: 8px;
color: var(--muted);
font-size: 11px;
font-weight: 700;
cursor: pointer;
}
.toggle input {
width: 16px;
height: 16px;
accent-color: var(--green);
}
.method-note {
padding: 9px 10px;
margin: 11px 0;
color: #617069;
background: #f4f1e8;
border-left: 3px solid #d2a24f;
border-radius: 4px;
font-size: 10px;
line-height: 1.5;
}
.result {
position: relative;
overflow: hidden;
padding: 15px;
background:
linear-gradient(135deg, rgba(255,255,255,0.05), transparent),
var(--green);
border-radius: 11px;
color: #f8f4e8;
box-shadow: 0 12px 30px rgba(23, 63, 57, 0.16);
}
.result::after {
content: "";
position: absolute;
right: -22px;
top: -28px;
width: 90px;
height: 90px;
border: 18px solid rgba(255,255,255,0.05);
border-radius: 50%;
pointer-events: none;
}
.result-label {
display: inline-block;
padding: 5px 7px;
margin-bottom: 10px;
color: #173f39;
background: #e8d6a7;
border-radius: 4px;
font-size: 9px;
font-weight: 950;
letter-spacing: 0.1em;
text-transform: uppercase;
}
.result h4 {
position: relative;
z-index: 1;
margin: 0 0 8px;
font-family: Georgia, "Times New Roman", serif;
font-size: 19px;
line-height: 1.2;
}
.result-topic {
margin-bottom: 10px;
color: #c5ddd0;
font-size: 10px;
font-weight: 800;
letter-spacing: 0.07em;
text-transform: uppercase;
}
.result-date {
padding: 10px;
margin-bottom: 10px;
background: rgba(0,0,0,0.12);
border-radius: 7px;
font-size: 11px;
line-height: 1.45;
}
.result-explanation {
margin: 0;
color: #dbe8df;
font-size: 10px;
line-height: 1.55;
}
.result-button {
position: relative;
z-index: 1;
width: 100%;
margin-top: 12px;
padding: 9px;
color: #173f39;
background: #f5f1e6;
border: 0;
border-radius: 7px;
font-size: 10px;
font-weight: 900;
letter-spacing: 0.05em;
text-transform: uppercase;
}
.result-button:hover {
background: #fff;
}
.fiction-footer {
padding-top: 16px;
color: #8a928e;
font-size: 9px;
line-height: 1.5;
text-align: center;
}
@media (max-width: 1000px) {
main {
grid-template-columns: minmax(0, 1fr) 350px;
}
.panel {
padding: 18px;
}
.fiction-chip {
display: none;
}
}
@media (max-width: 760px) {
body {
overflow: auto;
}
#app {
height: auto;
min-height: 100vh;
}
.topbar {
position: sticky;
top: 0;
min-height: 68px;
padding: 11px 14px;
}
.brand-mark {
width: 37px;
height: 37px;
}
.top-actions .ghost-button {
padding: 8px 10px;
font-size: 10px;
}
main {
display: block;
}
.scene-shell {
height: 60vh;
min-height: 470px;
}
.panel {
overflow: visible;
border-left: 0;
border-top: 1px solid var(--line);
}
.scene-heading {
top: 14px;
left: 14px;
right: 14px;
max-width: none;
}
.scene-heading strong {
font-size: 16px;
}
.scene-legend {
right: 12px;
bottom: 12px;
}
.legend-item {
padding: 6px 8px;
font-size: 9px;
}
}
</style>
</head>
<body>
<div id="app">
<header class="topbar">
<div class="brand">
<div class="brand-mark" aria-hidden="true">
<svg viewBox="0 0 24 24" fill="none">
<path d="M4 20V5h16v15M8 8h8M8 12h8M8 16h5"
stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/>
</svg>
</div>
<div class="brand-copy">
<p class="eyebrow">Harborlight civic desk · fictional exercise</p>
<h1>North Pier Community Board</h1>
</div>
</div>
<div class="top-actions">
<span class="fiction-chip">Lantern Weekend · 18–20 Jun 2025</span>
<button id="resetView" class="ghost-button" type="button">Reset view</button>
</div>
</header>
<main>
<section class="scene-shell" aria-label="Interactive low-poly community board">
<div id="stage"></div>
<div class="scene-heading">
<strong>Arrange the postings by time</strong>
<span>
Drag a notice to reorder it. Drag empty space to orbit the board;
scroll to zoom.
</span>
</div>
<div class="scene-legend" aria-hidden="true">
<span class="legend-item"><i class="legend-dot"></i>Selected notice</span>
<span class="legend-item"><i class="legend-dot gold"></i>Revision marker</span>
</div>
<div id="toast" class="toast" role="status" aria-live="polite"></div>
</section>
<aside class="panel" aria-label="Board arrangement and instruction finder">
<section class="panel-section">
<div class="section-heading">
<div>
<p class="eyebrow">Display order</p>
<h2>Arrange by time</h2>
</div>
<span id="noticeCount" class="count-badge">7</span>
</div>
<p class="section-copy">
Drag rows to change the board order, or sort all postings by their
explicit effective timestamp.
</p>
<button id="sortByDate" class="small-button" type="button">
Sort by effective time ↑
</button>
<div id="timeline" class="timeline" aria-label="Postings in board order"></div>
<div id="selectedDetails"></div>
</section>
<section class="panel-section">
<div class="section-heading">
<div>
<p class="eyebrow">Decision support</p>
<h3>Latest relevant instruction</h3>
</div>
</div>
<p class="section-copy">
Choose a subject to identify the newest applicable instruction.
Dates and revision markers remain visible on every posting.
</p>
<div class="finder-controls">
<label for="topicFilter" class="sr-only">Instruction topic</label>
<select id="topicFilter">
<option value="all">All topics</option>
<option value="Safety">Safety</option>
<option value="Transport">Transport</option>
<option value="Weather">Weather</option>
<option value="Medical">Medical</option>
<option value="Volunteers">Volunteers</option>
</select>
<label class="toggle">
<input id="instructionsOnly" type="checkbox" checked>
Instructions only
</label>
</div>
<div class="method-note">
Precedence: effective timestamp → revision marker → issue timestamp.
Community updates are excluded unless the toggle is turned off.
</div>
<div id="finderResult" aria-live="polite"></div>
</section>
<div class="fiction-footer">
All people, places, dates, instructions, and revisions on this board
are fictional. Times are shown as local event time.
</div>
</aside>
</main>
</div>
<style>
.sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border: 0;
}
</style>
<script type="module">
import * as THREE from
"https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
// -------------------------------------------------------------------------
// Fictional event data
// -------------------------------------------------------------------------
const notices = [
{
id: "n1",
code: "P-01",
title: "Volunteer check-in",
topic: "Volunteers",
tags: ["Volunteers"],
kind: "instruction",
issuedAt: "2025-06-18T07:30:00Z",
effectiveAt: "2025-06-18T07:30:00Z",
revision: "A",
previousRevision: null,
summary: "Report to the east marquee before the first lantern procession."
},
{
id: "n2",
code: "P-02",
title: "Rain route changes",
topic: "Weather",
tags: ["Weather"],
kind: "instruction",
issuedAt: "2025-06-18T10:15:00Z",
effectiveAt: "2025-06-18T11:45:00Z",
revision: "B",
previousRevision: "A",
summary: "Use the covered route from Gate A if showers continue."
},
{
id: "n3",
code: "P-03",
title: "Pier 2 entry plan",
topic: "Transport",
tags: ["Transport"],
kind: "instruction",
issuedAt: "2025-06-18T15:00:00Z",
effectiveAt: "2025-06-18T16:20:00Z",
revision: "C",
previousRevision: "B",
summary: "Enter through Pier 2 and keep the service lane unobstructed."
},
{
id: "n4",
code: "P-04",
title: "First-aid station move",
topic: "Medical",
tags: ["Medical"],
kind: "instruction",
issuedAt: "2025-06-19T07:20:00Z",
effectiveAt: "2025-06-19T08:10:00Z",
revision: "C",
previousRevision: "B",
summary: "The first-aid station is now beside the west information tent."
},
{
id: "n5",
code: "P-05",
title: "Lantern handoff",
topic: "Volunteers",
tags: ["Volunteers"],
kind: "instruction",
issuedAt: "2025-06-19T12:30:00Z",
effectiveAt: "2025-06-19T12:30:00Z",
revision: "B",
previousRevision: "A",
summary: "Collect numbered lanterns at the east marquee for handoff."
},
{
id: "n6",
code: "P-06",
title: "Coastal wind watch",
topic: "Weather",
tags: ["Weather"],
kind: "update",
issuedAt: "2025-06-19T17:10:00Z",
effectiveAt: "2025-06-19T17:10:00Z",
revision: "A",
previousRevision: null,
summary: "A community update about strengthening coastal winds."
},
{
id: "n7",
code: "P-07",
title: "South gate closure & reroute",
topic: "Safety",
tags: ["Safety", "Transport"],
kind: "instruction",
issuedAt: "2025-06-20T09:00:00Z",
effectiveAt: "2025-06-20T18:00:00Z",
revision: "B",
previousRevision: "A",
summary: "South Gate is closed. Follow the signed reroute to Gate C."
}
];
const noticeById = new Map(notices.map((notice) => [notice.id, notice]));
const topicColors = {
Volunteers: "#3b7764",
Weather: "#477b9a",
Transport: "#9a6339",
Medical: "#a64f55",
Safety: "#725c94"
};
const initialOrder = ["n4", "n1", "n7", "n2", "n5", "n3", "n6"];
let order = [...initialOrder];
let selectedId = "n7";
let draggedListId = null;
// -------------------------------------------------------------------------
// Formatting helpers
// -------------------------------------------------------------------------
function formatStamp(iso, includeYear = true) {
const date = new Date(iso);
const options = {
day: "2-digit",
month: "short",
hour: "2-digit",
minute: "2-digit",
hour12: false,
timeZone: "UTC"
};
if (includeYear) options.year = "numeric";
return new Intl.DateTimeFormat("en-GB", options)
.format(date)
.replace(",", " ·")
.toUpperCase();
}
function revisionNumber(revision) {
return String(revision)
.trim()
.toUpperCase()
.split("")
.reduce((value, character) => {
const digit = character.charCodeAt(0) - 64;
return digit >= 1 && digit <= 26 ? value * 26 + digit : value;
}, 0);
}
function revisionText(notice) {
if (!notice.previousRevision) {
return `REV ${notice.revision}`;
}
return `REV ${notice.revision} · SUPERSEDES ${notice.previousRevision}`;
}
function showToast(message) {
const toast = document.getElementById("toast");
toast.textContent = message;
toast.classList.add("show");
clearTimeout(showToast.timeout);
showToast.timeout = setTimeout(() => {
toast.classList.remove("show");
}, 2200);
}
// -------------------------------------------------------------------------
// Three.js scene
// -------------------------------------------------------------------------
const stage = document.getElementById("stage");
const scene = new THREE.Scene();
scene.background = new THREE.Color("#cbd9cf");
scene.fog = new THREE.Fog("#cbd9cf", 16, 27);
const camera = new THREE.PerspectiveCamera(40, 1, 0.1, 60);
const renderer = new THREE.WebGLRenderer({
antialias: true,
alpha: false,
powerPreference: "high-performance"
});
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1.08;
renderer.domElement.setAttribute(
"aria-label",
"Three-dimensional community noticeboard. Use the adjacent list for an accessible alternative."
);
stage.appendChild(renderer.domElement);
const hemisphere = new THREE.HemisphereLight("#f8f5e8", "#6c8277", 2.1);
scene.add(hemisphere);
const sun = new THREE.DirectionalLight("#fff0ce", 3.3);
sun.position.set(-5, 9, 8);
sun.castShadow = true;
sun.shadow.mapSize.set(1024, 1024);
sun.shadow.camera.left = -8;
sun.shadow.camera.right = 8;
sun.shadow.camera.top = 8;
sun.shadow.camera.bottom = -8;
sun.shadow.camera.near = 1;
sun.shadow.camera.far = 25;
sun.shadow.bias = -0.0008;
scene.add(sun);
const fill = new THREE.DirectionalLight("#b8d9d2", 1.1);
fill.position.set(7, 3, 5);
scene.add(fill);
const ground = new THREE.Mesh(
new THREE.CircleGeometry(18, 32),
new THREE.MeshStandardMaterial({
color: "#aebfb2",
roughness: 1,
flatShading: true
})
);
ground.rotation.x = -Math.PI / 2;
ground.position.y = -4.25;
ground.receiveShadow = true;
scene.add(ground);
const board = new THREE.Group();
board.position.y = 0.35;
scene.add(board);
// Low-poly wooden frame with a beveled edge.
const frameShape = new THREE.Shape();
frameShape.moveTo(-4.35, -3.05);
frameShape.lineTo(4.35, -3.05);
frameShape.lineTo(4.35, 3.05);
frameShape.lineTo(-4.35, 3.05);
frameShape.closePath();
const frameHole = new THREE.Path();
frameHole.moveTo(-3.96, -2.69);
frameHole.lineTo(-3.96, 2.69);
frameHole.lineTo(3.96, 2.69);
frameHole.lineTo(3.96, -2.69);
frameHole.closePath();
frameShape.holes.push(frameHole);
const frameGeometry = new THREE.ExtrudeGeometry(frameShape, {
depth: 0.22,
steps: 1,
bevelEnabled: true,
bevelSegments: 1,
bevelSize: 0.07,
bevelThickness: 0.07,
curveSegments: 1
});
const frame = new THREE.Mesh(
frameGeometry,
new THREE.MeshStandardMaterial({
color: "#9b663e",
roughness: 0.88,
flatShading: true
})
);
frame.position.z = -0.1;
frame.castShadow = true;
frame.receiveShadow = true;
board.add(frame);
// Procedural cork texture.
function createCorkTexture() {
const canvas = document.createElement("canvas");
canvas.width = 768;
canvas.height = 512;
const context = canvas.getContext("2d");
context.fillStyle = "#bb8c59";
context.fillRect(0, 0, canvas.width, canvas.height);
let seed = 9137;
const random = () => {
seed = (seed * 16807) % 2147483647;
return (seed - 1) / 2147483646;
};
const colors = ["#a87547", "#c89b67", "#aa7a4e", "#d0a774", "#96704e"];
for (let index = 0; index < 1700; index += 1) {
const x = random() * canvas.width;
const y = random() * canvas.height;
const radius = 0.5 + random() * 2.5;
context.beginPath();
context.moveTo(x - radius, y);
context.lineTo(x, y - radius * 0.7);
context.lineTo(x + radius, y + radius * 0.3);
context.lineTo(x + radius * 0.2, y + radius);
context.closePath();
context.fillStyle = colors[Math.floor(random() * colors.length)];
context.globalAlpha = 0.22 + random() * 0.35;
context.fill();
}
context.globalAlpha = 1;
const texture = new THREE.CanvasTexture(canvas);
texture.colorSpace = THREE.SRGBColorSpace;
texture.anisotropy = renderer.capabilities.getMaxAnisotropy();
return texture;
}
const cork = new THREE.Mesh(
new THREE.PlaneGeometry(7.92, 5.38, 4, 3),
new THREE.MeshStandardMaterial({
map: createCorkTexture(),
roughness: 1,
flatShading: true
})
);
cork.position.z = 0.17;
cork.receiveShadow = true;
board.add(cork);
// Board title plaque.
function createTitleTexture() {
const canvas = document.createElement("canvas");
canvas.width = 1200;
canvas.height = 170;
const context = canvas.getContext("2d");
context.fillStyle = "#173f39";
context.fillRect(0, 0, canvas.width, canvas.height);
context.fillStyle = "#e6d4a5";
context.fillRect(42, 34, 8, 102);
context.fillStyle = "#f5f0df";
context.font = "700 46px Georgia";
context.fillText("NORTH PIER · LANTERN WEEKEND", 76, 75);
context.fillStyle = "#bcd2c5";
context.font = "700 24px Arial";
context.fillText("COMMUNITY NOTICE BOARD / 18—20 JUNE 2025", 78, 122);
const texture = new THREE.CanvasTexture(canvas);
texture.colorSpace = THREE.SRGBColorSpace;
texture.anisotropy = renderer.capabilities.getMaxAnisotropy();
return texture;
}
const titlePlaque = new THREE.Mesh(
new THREE.PlaneGeometry(5.9, 0.83),
new THREE.MeshStandardMaterial({
map: createTitleTexture(),
roughness: 0.85
})
);
titlePlaque.position.set(0, 2.28, 0.27);
titlePlaque.castShadow = true;
board.add(titlePlaque);
// Board legs.
const legMaterial = new THREE.MeshStandardMaterial({
color: "#855937",
roughness: 0.92,
flatShading: true
});
[-3.15, 3.15].forEach((x) => {
const leg = new THREE.Mesh(
new THREE.BoxGeometry(0.28, 1.85, 0.32),
legMaterial
);
leg.position.set(x, -3.53, -0.18);
leg.castShadow = true;
board.add(leg);
});
// Low-poly planters add depth without distracting from the notices.
function createPlanter(x, foliageColor) {
const group = new THREE.Group();
const pot = new THREE.Mesh(
new THREE.CylinderGeometry(0.52, 0.68, 0.78, 7),
new THREE.MeshStandardMaterial({
color: "#a56549",
roughness: 1,
flatShading: true
})
);
pot.position.y = -3.82;
pot.castShadow = true;
group.add(pot);
const foliage = new THREE.Mesh(
new THREE.IcosahedronGeometry(0.85, 0),
new THREE.MeshStandardMaterial({
color: foliageColor,
roughness: 1,
flatShading: true
})
);
foliage.position.y = -2.85;
foliage.scale.set(0.85, 1.25, 0.8);
foliage.castShadow = true;
group.add(foliage);
group.position.x = x;
group.position.z = -0.5;
scene.add(group);
}
createPlanter(-5.05, "#668f69");
createPlanter(5.05, "#78966a");
// -------------------------------------------------------------------------
// Notice textures and 3D cards
// -------------------------------------------------------------------------
function roundedRect(context, x, y, width, height, radius) {
const r = Math.min(radius, width / 2, height / 2);
context.beginPath();
context.moveTo(x + r, y);
context.arcTo(x + width, y, x + width, y + height, r);
context.arcTo(x + width, y + height, x, y + height, r);
context.arcTo(x, y + height, x, y, r);
context.arcTo(x, y, x + width, y, r);
context.closePath();
}
function wrapText(context, text, x, y, maxWidth, lineHeight, maxLines = 2) {
const words = text.split(" ");
const lines = [];
let line = "";
for (const word of words) {
const test = line ? `${line} ${word}` : word;
if (context.measureText(test).width > maxWidth && line) {
lines.push(line);
line = word;
if (lines.length === maxLines - 1) break;
} else {
line = test;
}
}
if (line) lines.push(line);
const visible = lines.slice(0, maxLines);
if (lines.length > maxLines && visible.length) {
visible[visible.length - 1] =
visible[visible.length - 1].replace(/.{3}$/, "…");
}
visible.forEach((visibleLine, index) => {
context.fillText(visibleLine, x, y + index * lineHeight);
});
return visible.length * lineHeight;
}
function createNoticeTexture(notice) {
const canvas = document.createElement("canvas");
canvas.width = 700;
canvas.height = 430;
const context = canvas.getContext("2d");
const accent = topicColors[notice.topic] || "#3b7764";
context.clearRect(0, 0, canvas.width, canvas.height);
context.save();
context.shadowColor = "rgba(30, 30, 20, 0.22)";
context.shadowBlur = 18;
context.shadowOffsetY = 8;
context.fillStyle = "#fffaf0";
context.beginPath();
context.moveTo(26, 14);
context.lineTo(659, 9);
context.lineTo(691, 32);
context.lineTo(684, 408);
context.lineTo(43, 420);
context.lineTo(12, 390);
context.closePath();
context.fill();
context.restore();
context.fillStyle = accent;
context.fillRect(38, 39, 135, 30);
roundedRect(context, 38, 39, 135, 30, 4);
context.fill();
context.fillStyle = "#ffffff";
context.font = "800 16px Arial";
context.fillText(notice.topic.toUpperCase(), 49, 60);
context.fillStyle = notice.kind === "instruction" ? accent : "#697772";
context.font = "800 13px Arial";
context.textAlign = "right";
context.fillText(
notice.kind === "instruction" ? "INSTRUCTION" : "COMMUNITY UPDATE",
660,
55
);
context.textAlign = "left";
context.fillStyle = "#213c37";
context.font = "700 38px Georgia";
const titleHeight = wrapText(
context,
notice.title,
39,
123,
605,
43,
2
);
context.fillStyle = "#5b6964";
context.font = "22px Arial";
wrapText(
context,
notice.summary,
40,
123 + titleHeight + 22,
602,
29,
2
);
context.strokeStyle = "#d7cdb8";
context.lineWidth = 2;
context.beginPath();
context.moveTo(39, 304);
context.lineTo(660, 304);
context.stroke();
context.fillStyle = "#738079";
context.font = "700 13px Arial";
context.fillText("ISSUED", 40, 332);
context.fillStyle = "#253d38";
context.font = "700 18px Arial";
context.fillText(formatStamp(notice.issuedAt), 40, 357);
context.fillStyle = "#738079";
context.font = "700 13px Arial";
context.fillText("EFFECTIVE / REVISION", 40, 389);
context.fillStyle = accent;
context.font = "900 17px Arial";
context.fillText(
`${formatStamp(notice.effectiveAt)} · REV ${notice.revision}`,
40,
412
);
const texture = new THREE.CanvasTexture(canvas);
texture.colorSpace = THREE.SRGBColorSpace;
texture.anisotropy = renderer.capabilities.getMaxAnisotropy();
return texture;
}
const slots = [
new THREE.Vector3(-2.47, 0.98, 0.18),
new THREE.Vector3(0, 0.98, 0.18),
new THREE.Vector3(2.47, 0.98, 0.18),
new THREE.Vector3(-2.47, -0.46, 0.18),
new THREE.Vector3(0, -0.46, 0.18),
new THREE.Vector3(2.47, -0.46, 0.18),
new THREE.Vector3(0, -1.9, 0.18)
];
const cardMeshes = new Map();
const cardFronts = [];
const slotGuides = [];
function makeRectangleGuide(width, height, color) {
const points = [
new THREE.Vector3(-width / 2, -height / 2, 0),
new THREE.Vector3(width / 2, -height / 2, 0),
new THREE.Vector3(width / 2, height / 2, 0),
new THREE.Vector3(-width / 2, height / 2, 0)
];
const geometry = new THREE.BufferGeometry().setFromPoints(points);
const material = new THREE.LineBasicMaterial({
color,
transparent: true,
opacity: 0
});
return new THREE.LineLoop(geometry, material);
}
slots.forEach((slot) => {
const guide = makeRectangleGuide(2.22, 1.39, "#f8f0cf");
guide.position.copy(slot);
guide.position.z += 0.08;
board.add(guide);
slotGuides.push(guide);
});
notices.forEach((notice) => {
const root = new THREE.Group();
root.userData.noticeId = notice.id;
const backing = new THREE.Mesh(
new THREE.PlaneGeometry(2.2, 1.37),
new THREE.MeshStandardMaterial({
color: "#6c6659",
roughness: 1,
flatShading: true
})
);
backing.position.z = 0;
backing.castShadow = true;
backing.userData.noticeId = notice.id;
root.add(backing);
const front = new THREE.Mesh(
new THREE.PlaneGeometry(2.13, 1.3, 3, 2),
new THREE.MeshStandardMaterial({
map: createNoticeTexture(notice),
color: "#ffffff",
roughness: 0.94,
metalness: 0,
flatShading: true,
emissive: "#b7d3bf",
emissiveIntensity: 0
})
);
front.position.z = 0.025;
front.castShadow = true;
front.receiveShadow = true;
front.userData.noticeId = notice.id;
root.add(front);
cardFronts.push(front);
const pinMaterial = new THREE.MeshStandardMaterial({
color: notice.revision === "B" || notice.revision === "C" ? "#d7a13d" : "#ba554b",
roughness: 0.55,
flatShading: true
});
const pin = new THREE.Mesh(
new THREE.CylinderGeometry(0.085, 0.085, 0.16, 8),
pinMaterial
);
pin.rotation.x = Math.PI / 2;
pin.position.set(-0.83, 0.5, 0.13);
pin.castShadow = true;
root.add(pin);
const pinHead = new THREE.Mesh(
new THREE.IcosahedronGeometry(0.105, 0),
pinMaterial
);
pinHead.position.set(-0.83, 0.5, 0.23);
pinHead.castShadow = true;
root.add(pinHead);
const ring = makeRectangleGuide(2.24, 1.41, "#f8f0cf");
ring.position.z = 0.065;
ring.material.opacity = 0.8;
ring.visible = false;
root.add(ring);
const tilt = (notices.indexOf(notice) % 3 - 1) * 0.012;
root.rotation.z = tilt;
cardMeshes.set(notice.id, { root, front, ring, pinMaterial });
board.add(root);
});
function applySlotPositions() {
order.forEach((id, index) => {
const card = cardMeshes.get(id);
card.root.position.copy(slots[index]);
});
}
applySlotPositions();
// -------------------------------------------------------------------------
// Direct camera controls: orbit, pan-free zoom, and reset
// -------------------------------------------------------------------------
const cameraState = {
azimuth: 0.025,
elevation: 0.025,
radius: 11.8,
target: new THREE.Vector3(0, 0.15, 0)
};
function updateCamera() {
const horizontalRadius =
cameraState.radius * Math.cos(cameraState.elevation);
camera.position.set(
cameraState.target.x + Math.sin(cameraState.azimuth) * horizontalRadius,
cameraState.target.y + Math.sin(cameraState.elevation) * cameraState.radius + 0.42,
cameraState.target.z + Math.cos(cameraState.azimuth) * horizontalRadius
);
camera.lookAt(cameraState.target);
}
function resetCamera() {
cameraState.azimuth = 0.025;
cameraState.elevation = 0.025;
cameraState.radius = 11.8;
updateCamera();
showToast("View reset");
}
document.getElementById("resetView").addEventListener("click", resetCamera);
updateCamera();
renderer.domElement.addEventListener(
"wheel",
(event) => {
event.preventDefault();
cameraState.radius = THREE.MathUtils.clamp(
cameraState.radius + event.deltaY * 0.008,
8.4,
15.5
);
updateCamera();
},
{ passive: false }
);
// -------------------------------------------------------------------------
// Board dragging and selection
// -------------------------------------------------------------------------
const raycaster = new THREE.Raycaster();
const pointer = new THREE.Vector2();
const dragPlane = new THREE.Plane(new THREE.Vector3(0, 0, 1), -0.43);
const dragPoint = new THREE.Vector3();
let interaction = null;
let pointerStart = { x: 0, y: 0 };
function updatePointer(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;
}
function getCardIntersection() {
raycaster.setFromCamera(pointer, camera);
return raycaster.intersectObjects(cardFronts, false)[0] || null;
}
function setGuidesVisible(visible) {
slotGuides.forEach((guide) => {
guide.material.opacity = visible ? 0.48 : 0;
});
}
renderer.domElement.addEventListener("pointerdown", (event) => {
if (event.button !== 0) return;
updatePointer(event);
pointerStart = { x: event.clientX, y: event.clientY };
const hit = getCardIntersection();
renderer.domElement.setPointerCapture(event.pointerId);
if (hit) {
const id = hit.object.userData.noticeId;
selectNotice(id);
interaction = {
type: "card",
pointerId: event.pointerId,
id
};
setGuidesVisible(true);
renderer.domElement.style.cursor = "grabbing";
} else {
interaction = {
type: "orbit",
pointerId: event.pointerId
};
renderer.domElement.style.cursor = "grabbing";
}
});
renderer.domElement.addEventListener("pointermove", (event) => {
updatePointer(event);
if (!interaction) {
const hit = getCardIntersection();
renderer.domElement.style.cursor = hit ? "grab" : "default";
return;
}
if (interaction.type === "orbit") {
const deltaX = event.clientX - pointerStart.x;
const deltaY = event.clientY - pointerStart.y;
cameraState.azimuth -= deltaX * 0.005;
cameraState.elevation = THREE.MathUtils.clamp(
cameraState.elevation + deltaY * 0.0035,
-0.52,
0.55
);
pointerStart = { x: event.clientX, y: event.clientY };
updateCamera();
return;
}
raycaster.setFromCamera(pointer, camera);
if (raycaster.ray.intersectPlane(dragPlane, dragPoint)) {
const localPoint = board.worldToLocal(dragPoint.clone());
const card = cardMeshes.get(interaction.id);
card.root.position.x = THREE.MathUtils.clamp(localPoint.x, -3.8, 3.8);
card.root.position.y = THREE.MathUtils.clamp(localPoint.y, -2.48, 1.65);
card.root.position.z = 0.38;
}
});
function endPointerInteraction(event) {
if (!interaction) return;
if (interaction.type === "card") {
const card = cardMeshes.get(interaction.id);
let nearestSlot = 0;
let nearestDistance = Infinity;
slots.forEach((slot, index) => {
const distance =
Math.abs(card.root.position.x - slot.x) +
Math.abs(card.root.position.y - slot.y);
if (distance < nearestDistance) {
nearestDistance = distance;
nearestSlot = index;
}
});
reorderNotice(interaction.id, nearestSlot, false);
setGuidesVisible(false);
}
interaction = null;
renderer.domElement.style.cursor = "default";
if (renderer.domElement.hasPointerCapture(event.pointerId)) {
renderer.domElement.releasePointerCapture(event.pointerId);
}
}
renderer.domElement.addEventListener("pointerup", endPointerInteraction);
renderer.domElement.addEventListener("pointercancel", endPointerInteraction);
// -------------------------------------------------------------------------
// DOM interface
// -------------------------------------------------------------------------
function reorderNotice(id, targetIndex, announce = true) {
const currentIndex = order.indexOf(id);
const safeTarget = THREE.MathUtils.clamp(targetIndex, 0, order.length - 1);
if (currentIndex === safeTarget) return;
order.splice(currentIndex, 1);
order.splice(safeTarget, 0, id);
applySlotPositions();
renderTimeline();
renderSelectedDetails();
updateCardSelection();
if (announce) {
const notice = noticeById.get(id);
showToast(`${notice.code} moved to position ${safeTarget + 1}`);
}
}
function renderTimeline() {
const timeline = document.getElementById("timeline");
timeline.innerHTML = "";
order.forEach((id, index) => {
const notice = noticeById.get(id);
const row = document.createElement("article");
row.className = `notice-row${id === selectedId ? " selected" : ""}`;
row.draggable = true;
row.tabIndex = 0;
row.dataset.id = id;
row.style.setProperty("--topic-color", topicColors[notice.topic]);
row.setAttribute("aria-label", `Position ${index + 1}: ${notice.title}`);
row.innerHTML = `
<div class="row-number">${String(index + 1).padStart(2, "0")}</div>
<div class="row-content">
<div class="row-title">${notice.title}</div>
<div class="row-meta">
<span>${formatStamp(notice.effectiveAt, false)}</span>
<span class="revision-pill">REV ${notice.revision}</span>
<span>${notice.kind === "instruction" ? "Instruction" : "Update"}</span>
</div>
</div>
<div class="drag-grip" aria-hidden="true">•••</div>
`;
row.addEventListener("click", () => selectNotice(id));
row.addEventListener("keydown", (event) => {
if (event.key === "Enter" || event.key === " ") {
event.preventDefault();
selectNotice(id);
}
});
row.addEventListener("dragstart", (event) => {
draggedListId = id;
row.classList.add("dragging");
event.dataTransfer.effectAllowed = "move";
event.dataTransfer.setData("text/plain", id);
});
row.addEventListener("dragend", () => {
draggedListId = null;
row.classList.remove("dragging");
document.querySelectorAll(".notice-row").forEach((item) => {
item.classList.remove("drop-before", "drop-after");
});
});
row.addEventListener("dragover", (event) => {
event.preventDefault();
if (!draggedListId || draggedListId === id) return;
const rect = row.getBoundingClientRect();
const before = event.clientY < rect.top + rect.height / 2;
row.classList.toggle("drop-before", before);
row.classList.toggle("drop-after", !before);
});
row.addEventListener("dragleave", () => {
row.classList.remove("drop-before", "drop-after");
});
row.addEventListener("drop", (event) => {
event.preventDefault();
const sourceId = draggedListId || event.dataTransfer.getData("text/plain");
if (!sourceId || sourceId === id) return;
const rect = row.getBoundingClientRect();
const before = event.clientY < rect.top + rect.height / 2;
const sourceIndex = order.indexOf(sourceId);
const targetIndex = order.indexOf(id);
order.splice(sourceIndex, 1);
let insertionIndex = order.indexOf(id);
if (!before) insertionIndex += 1;
order.splice(insertionIndex, 0, sourceId);
applySlotPositions();
renderTimeline();
renderSelectedDetails();
updateCardSelection();
showToast(`${noticeById.get(sourceId).code} reordered`);
});
timeline.appendChild(row);
});
document.getElementById("noticeCount").textContent = String(order.length);
}
function renderSelectedDetails() {
const container = document.getElementById("selectedDetails");
const notice = noticeById.get(selectedId);
const position = order.indexOf(selectedId);
container.innerHTML = `
<div class="selected-card">
<h4>${notice.title}</h4>
<div class="date-grid">
<div class="date-cell">
<span>Issued</span>
<strong>${formatStamp(notice.issuedAt)}</strong>
</div>
<div class="date-cell">
<span>Effective / revision</span>
<strong>${formatStamp(notice.effectiveAt)}<br>REV ${notice.revision}</strong>
</div>
</div>
<div class="order-actions">
<button type="button" id="moveEarlier" ${position === 0 ? "disabled" : ""}>
← Earlier
</button>
<button type="button" id="moveLater" ${position === order.length - 1 ? "disabled" : ""}>
Later →
</button>
</div>
</div>
`;
document.getElementById("moveEarlier").addEventListener("click", () => {
reorderNotice(selectedId, order.indexOf(selectedId) - 1);
});
document.getElementById("moveLater").addEventListener("click", () => {
reorderNotice(selectedId, order.indexOf(selectedId) + 1);
});
}
function updateCardSelection() {
cardMeshes.forEach((card, id) => {
const selected = id === selectedId;
card.ring.visible = selected;
card.front.material.emissiveIntensity = selected ? 0.11 : 0;
});
}
function selectNotice(id) {
selectedId = id;
updateCardSelection();
renderTimeline();
renderSelectedDetails();
}
function compareForLatest(a, b) {
const effectiveDifference =
Date.parse(b.effectiveAt) - Date.parse(a.effectiveAt);
if (effectiveDifference !== 0) return effectiveDifference;
const revisionDifference =
revisionNumber(b.revision) - revisionNumber(a.revision);
if (revisionDifference !== 0) return revisionDifference;
return Date.parse(b.issuedAt) - Date.parse(a.issuedAt);
}
function renderFinderResult() {
const topic = document.getElementById("topicFilter").value;
const instructionsOnly =
document.getElementById("instructionsOnly").checked;
const candidates = notices
.filter((notice) => topic === "all" || notice.tags.includes(topic))
.filter((notice) => !instructionsOnly || notice.kind === "instruction")
.sort(compareForLatest);
const container = document.getElementById("finderResult");
if (!candidates.length) {
container.innerHTML = `
<div class="result">
<span class="result-label">No matching instruction</span>
<h4>Nothing matches this filter</h4>
<p class="result-explanation">
Try another subject or include community updates.
</p>
</div>
`;
return;
}
const latest = candidates[0];
const runnerUp = candidates[1];
container.innerHTML = `
<div class="result">
<span class="result-label">Latest relevant match</span>
<h4>${latest.title}</h4>
<div class="result-topic">
${latest.tags.join(" · ")} / ${latest.code}
</div>
<div class="result-date">
<strong>Effective ${formatStamp(latest.effectiveAt)}</strong><br>
<strong>Revision marker: REV ${latest.revision}</strong>
${
latest.previousRevision
? `<br><span>Explicitly supersedes REV ${latest.previousRevision}</span>`
: ""
}
</div>
<p class="result-explanation">
${
runnerUp
? `This posting has the latest effective timestamp among the matching notices. The next candidate is ${runnerUp.code} at ${formatStamp(runnerUp.effectiveAt)}, REV ${runnerUp.revision}.`
: "This is the only posting matching the current subject and status filter."
}
</p>
<button id="locateResult" class="result-button" type="button">
Select on the board
</button>
</div>
`;
document.getElementById("locateResult").addEventListener("click", () => {
selectNotice(latest.id);
showToast(`${latest.code} selected on the board`);
});
}
document.getElementById("sortByDate").addEventListener("click", () => {
order = [...notices]
.sort((a, b) => Date.parse(a.effectiveAt) - Date.parse(b.effectiveAt))
.map((notice) => notice.id);
applySlotPositions();
renderTimeline();
renderSelectedDetails();
updateCardSelection();
showToast("Board sorted by effective timestamp");
});
document
.getElementById("topicFilter")
.addEventListener("change", renderFinderResult);
document
.getElementById("instructionsOnly")
.addEventListener("change", renderFinderResult);
renderTimeline();
renderSelectedDetails();
updateCardSelection();
renderFinderResult();
// -------------------------------------------------------------------------
// Resize and animation
// -------------------------------------------------------------------------
function resizeRenderer() {
const width = Math.max(stage.clientWidth, 1);
const height = Math.max(stage.clientHeight, 1);
renderer.setSize(width, height, false);
camera.aspect = width / height;
camera.updateProjectionMatrix();
}
const resizeObserver = new ResizeObserver(resizeRenderer);
resizeObserver.observe(stage);
resizeRenderer();
const reducedMotion = window.matchMedia(
"(prefers-reduced-motion: reduce)"
).matches;
function animate(time) {
requestAnimationFrame(animate);
const selectedCard = cardMeshes.get(selectedId);
if (selectedCard?.ring.visible) {
const pulse = reducedMotion ? 1 : 1 + Math.sin(time * 0.0025) * 0.012;
selectedCard.ring.scale.set(pulse, pulse, 1);
selectedCard.ring.material.opacity = reducedMotion
? 0.8
: 0.65 + Math.sin(time * 0.0025) * 0.15;
}
renderer.render(scene, camera);
}
requestAnimationFrame(animate);
</script>
</body>
</html>
```