Prompt specification
Build or customize the Three.js 3D scene "Design Revision From User Feedback" 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: Design Revision From User Feedback
Category: Voxel Worlds · Style: Voxel 3D
License: MIT · Reference: https://three3d.app/scene/design-revision-from-user-feedback-x3244
Scene Description Prompt:
Please use Three.js from cdnjs for a voxel scene based on this idea: design revision from user feedback. Compare an initial and revised community-center layout using the same explicit task scenarios. Show which changes resolve specific failures without claiming the design meets every possible need. Return one self-contained HTML file.
Working Three.js Starter (design-revision-from-user-feedback-x3244):
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Community Center — Scenario-Based Design Revision</title>
<style>
:root {
--ink: #17251f;
--muted: #68756f;
--paper: #f4f2e9;
--panel: #fffefa;
--line: #d9dfd7;
--green: #147b69;
--green-soft: #e3f2ec;
--red: #c85746;
--red-soft: #faeae5;
--blue: #416d88;
--blue-soft: #e9f0f4;
--gold: #e8ae43;
--shadow: 0 14px 42px rgba(25, 44, 35, 0.1);
}
* {
box-sizing: border-box;
}
html,
body {
margin: 0;
min-height: 100%;
background:
radial-gradient(circle at 10% 0%, rgba(213, 232, 216, 0.8), transparent 30rem),
var(--paper);
color: var(--ink);
font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button {
font: inherit;
}
.app-header {
background: #172720;
color: #f8f6ed;
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.header-inner {
max-width: 1600px;
margin: 0 auto;
padding: 19px 28px;
display: flex;
align-items: center;
justify-content: space-between;
gap: 28px;
}
.brand {
display: flex;
align-items: center;
gap: 14px;
min-width: 0;
}
.brand-mark {
width: 43px;
height: 43px;
flex: 0 0 auto;
display: grid;
place-items: center;
border: 1px solid rgba(255, 255, 255, 0.16);
border-radius: 13px;
background: #244037;
box-shadow: inset 0 0 0 5px rgba(255, 255, 255, 0.025);
}
.brand-mark svg {
width: 25px;
height: 25px;
}
.brand h1 {
margin: 0;
font-size: clamp(18px, 2vw, 25px);
line-height: 1.1;
letter-spacing: -0.025em;
}
.brand p {
margin: 5px 0 0;
color: #b8c6bf;
font-size: 13px;
}
.header-meta {
display: flex;
align-items: center;
gap: 9px;
flex-wrap: wrap;
justify-content: flex-end;
}
.meta-pill {
padding: 8px 11px;
border: 1px solid rgba(255, 255, 255, 0.13);
border-radius: 999px;
color: #dce6e1;
font-size: 11px;
font-weight: 700;
letter-spacing: 0.045em;
text-transform: uppercase;
white-space: nowrap;
}
.meta-pill.limit {
color: #f5d28e;
border-color: rgba(229, 174, 67, 0.34);
background: rgba(229, 174, 67, 0.08);
}
main {
max-width: 1600px;
margin: 0 auto;
padding: 24px 28px 34px;
}
.intro {
display: flex;
justify-content: space-between;
gap: 30px;
align-items: end;
margin-bottom: 19px;
}
.intro h2 {
margin: 0;
font-size: clamp(24px, 3vw, 38px);
letter-spacing: -0.045em;
line-height: 1.05;
}
.intro p {
margin: 9px 0 0;
max-width: 760px;
color: var(--muted);
line-height: 1.55;
font-size: 14px;
}
.intro-note {
max-width: 315px;
padding: 12px 14px;
border-left: 3px solid var(--gold);
color: #5b625d;
background: rgba(255, 255, 255, 0.46);
font-size: 12px;
line-height: 1.5;
}
.workspace {
display: grid;
grid-template-columns: minmax(0, 1fr) 390px;
gap: 18px;
align-items: stretch;
}
.visual-column {
min-width: 0;
}
.scenario-bar {
background: var(--panel);
border: 1px solid var(--line);
border-radius: 16px;
padding: 9px;
box-shadow: 0 6px 18px rgba(29, 49, 39, 0.04);
margin-bottom: 12px;
}
.scenario-tabs {
display: grid;
grid-template-columns: repeat(6, minmax(0, 1fr));
gap: 5px;
}
.scenario-tab {
min-width: 0;
border: 0;
border-radius: 10px;
padding: 10px 8px 9px;
background: transparent;
color: #66716b;
cursor: pointer;
text-align: left;
transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}
.scenario-tab:hover {
background: #f0f3ee;
color: var(--ink);
}
.scenario-tab[aria-selected="true"] {
background: var(--ink);
color: white;
box-shadow: 0 5px 13px rgba(23, 37, 31, 0.18);
}
.tab-number {
display: block;
margin-bottom: 3px;
color: #8a958e;
font-size: 10px;
font-weight: 800;
letter-spacing: 0.09em;
}
.scenario-tab[aria-selected="true"] .tab-number {
color: #a9c7ba;
}
.tab-name {
display: block;
overflow: hidden;
font-size: 12px;
font-weight: 750;
text-overflow: ellipsis;
white-space: nowrap;
}
.stage {
position: relative;
height: 650px;
overflow: hidden;
border: 1px solid #cfd8cf;
border-radius: 20px;
background: #e8eee7;
box-shadow: var(--shadow);
isolation: isolate;
}
#canvasHost {
position: absolute;
inset: 0;
z-index: 0;
}
#canvasHost canvas {
display: block;
width: 100%;
height: 100%;
outline: none;
cursor: grab;
touch-action: none;
}
#canvasHost canvas:active {
cursor: grabbing;
}
.view {
position: absolute;
z-index: 1;
pointer-events: none;
overflow: hidden;
}
#viewInitial {
inset: 0 50% 0 0;
border-right: 1px solid rgba(36, 58, 47, 0.24);
}
#viewRevised {
inset: 0 0 0 50%;
}
.view-head {
position: absolute;
z-index: 4;
top: 15px;
left: 15px;
display: flex;
align-items: center;
gap: 10px;
padding: 9px 12px 9px 9px;
border: 1px solid rgba(255, 255, 255, 0.65);
border-radius: 12px;
background: rgba(255, 254, 250, 0.88);
backdrop-filter: blur(9px);
box-shadow: 0 6px 18px rgba(30, 45, 37, 0.09);
}
.view-badge {
display: grid;
place-items: center;
width: 29px;
height: 29px;
border-radius: 8px;
color: white;
font-size: 12px;
font-weight: 850;
}
.view-initial .view-badge {
background: var(--red);
}
.view-revised .view-badge {
background: var(--green);
}
.view-title {
font-size: 12px;
font-weight: 800;
line-height: 1.1;
}
.view-subtitle {
margin-top: 3px;
color: var(--muted);
font-size: 10px;
font-weight: 600;
}
.labels {
position: absolute;
inset: 0;
}
.scene-label {
position: absolute;
z-index: 3;
max-width: 160px;
padding: 6px 8px;
transform: translate(-50%, -100%);
border: 1px solid rgba(25, 43, 34, 0.14);
border-radius: 8px;
background: rgba(255, 254, 249, 0.92);
box-shadow: 0 4px 12px rgba(30, 48, 39, 0.09);
color: #35443c;
font-size: 10px;
font-weight: 750;
line-height: 1.25;
text-align: center;
white-space: nowrap;
}
.scene-label.problem {
border-color: rgba(200, 87, 70, 0.35);
background: rgba(255, 241, 236, 0.95);
color: #9f4436;
}
.scene-label.success {
border-color: rgba(20, 123, 105, 0.35);
background: rgba(234, 247, 242, 0.96);
color: #116c5c;
}
.stage-tools {
position: absolute;
z-index: 5;
right: 14px;
bottom: 14px;
display: flex;
align-items: center;
gap: 7px;
padding: 7px;
border: 1px solid rgba(255, 255, 255, 0.7);
border-radius: 12px;
background: rgba(255, 254, 250, 0.9);
backdrop-filter: blur(10px);
box-shadow: 0 7px 18px rgba(30, 48, 39, 0.1);
}
.tool-button {
border: 0;
border-radius: 8px;
padding: 8px 10px;
background: #edf0ea;
color: #34443b;
font-size: 11px;
font-weight: 750;
cursor: pointer;
}
.tool-button:hover {
background: #e2e8e1;
}
.tool-button[aria-pressed="true"] {
background: #dceee6;
color: #0e6b59;
}
.stage-legend {
position: absolute;
z-index: 5;
left: 15px;
bottom: 14px;
display: flex;
align-items: center;
gap: 12px;
padding: 8px 10px;
border: 1px solid rgba(255, 255, 255, 0.7);
border-radius: 10px;
background: rgba(255, 254, 250, 0.9);
backdrop-filter: blur(10px);
color: #59665f;
font-size: 10px;
font-weight: 650;
}
.legend-item {
display: flex;
align-items: center;
gap: 5px;
}
.legend-line,
.legend-dot {
width: 17px;
height: 4px;
border-radius: 4px;
}
.legend-line.old {
background: var(--red);
}
.legend-line.new {
background: var(--green);
}
.legend-dot {
width: 8px;
height: 8px;
border-radius: 50%;
background: var(--gold);
}
.review-panel {
min-width: 0;
max-height: 744px;
overflow: auto;
padding: 22px;
border: 1px solid var(--line);
border-radius: 18px;
background: var(--panel);
box-shadow: var(--shadow);
}
.panel-kicker {
display: flex;
justify-content: space-between;
align-items: center;
gap: 10px;
color: var(--green);
font-size: 10px;
font-weight: 850;
letter-spacing: 0.11em;
text-transform: uppercase;
}
.panel-count {
color: #8b958e;
letter-spacing: 0.04em;
}
.review-panel h3 {
margin: 11px 0 7px;
font-size: 27px;
line-height: 1.08;
letter-spacing: -0.035em;
}
.task-summary {
margin: 15px 0 18px;
padding: 13px 14px;
border: 1px solid #dce3db;
border-radius: 12px;
background: #f5f7f2;
}
.task-label {
margin-bottom: 5px;
color: #768179;
font-size: 9px;
font-weight: 850;
letter-spacing: 0.11em;
text-transform: uppercase;
}
.task-summary p {
margin: 0;
color: #33443b;
font-size: 13px;
font-weight: 650;
line-height: 1.45;
}
.finding {
position: relative;
margin-top: 10px;
padding: 14px 14px 13px 16px;
border-radius: 12px;
}
.finding::before {
content: "";
position: absolute;
inset: 0 auto 0 0;
width: 4px;
border-radius: 12px 0 0 12px;
}
.finding.old {
background: var(--red-soft);
}
.finding.old::before {
background: var(--red);
}
.finding.new {
background: var(--blue-soft);
}
.finding.new::before {
background: var(--blue);
}
.finding.result {
background: var(--green-soft);
}
.finding.result::before {
background: var(--green);
}
.finding-title {
display: flex;
align-items: center;
gap: 7px;
margin-bottom: 6px;
color: #293b32;
font-size: 10px;
font-weight: 850;
letter-spacing: 0.08em;
text-transform: uppercase;
}
.finding p {
margin: 0;
color: #49584f;
font-size: 12px;
line-height: 1.52;
}
.resolution-arrow {
display: grid;
place-items: center;
width: 25px;
height: 25px;
margin: 9px 0 0 5px;
border: 1px solid #d7ded6;
border-radius: 50%;
background: white;
color: var(--green);
font-size: 15px;
font-weight: 800;
}
.caveat {
margin-top: 14px;
padding-top: 13px;
border-top: 1px solid #e2e6df;
}
.caveat strong {
display: block;
margin-bottom: 4px;
color: #6a756e;
font-size: 9px;
letter-spacing: 0.1em;
text-transform: uppercase;
}
.caveat p {
margin: 0;
color: #727b75;
font-size: 11px;
line-height: 1.5;
}
.panel-footer {
display: flex;
align-items: flex-start;
gap: 8px;
margin-top: 16px;
color: #7a827d;
font-size: 10px;
line-height: 1.45;
}
.panel-footer svg {
width: 14px;
height: 14px;
flex: 0 0 auto;
margin-top: 1px;
}
.evidence-strip {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 12px;
margin-top: 18px;
}
.evidence-card {
padding: 15px 16px;
border: 1px solid var(--line);
border-radius: 14px;
background: rgba(255, 254, 250, 0.72);
}
.evidence-card .number {
display: inline-grid;
place-items: center;
width: 24px;
height: 24px;
margin-bottom: 9px;
border-radius: 7px;
background: #e5ebe4;
color: #526159;
font-size: 10px;
font-weight: 850;
}
.evidence-card h4 {
margin: 0 0 5px;
font-size: 12px;
}
.evidence-card p {
margin: 0;
color: var(--muted);
font-size: 11px;
line-height: 1.5;
}
.page-note {
margin: 16px 2px 0;
color: #7a827d;
font-size: 10px;
line-height: 1.5;
}
@media (max-width: 1100px) {
.workspace {
grid-template-columns: minmax(0, 1fr) 340px;
}
.scenario-tabs {
grid-template-columns: repeat(3, 1fr);
}
.stage {
height: 600px;
}
.view-head {
top: 11px;
left: 11px;
padding: 7px 9px 7px 7px;
}
.view-badge {
width: 25px;
height: 25px;
}
.view-subtitle {
display: none;
}
}
@media (max-width: 820px) {
.header-inner,
main {
padding-left: 16px;
padding-right: 16px;
}
.header-meta .meta-pill:not(.limit) {
display: none;
}
.intro {
display: block;
}
.intro-note {
max-width: none;
margin-top: 13px;
}
.workspace {
grid-template-columns: 1fr;
}
.review-panel {
max-height: none;
}
.stage {
height: 930px;
}
#viewInitial {
inset: 0 0 50% 0;
border-right: 0;
border-bottom: 1px solid rgba(36, 58, 47, 0.24);
}
#viewRevised {
inset: 50% 0 0 0;
}
.stage-legend {
left: 11px;
bottom: 11px;
}
.stage-tools {
right: 11px;
bottom: 11px;
}
.evidence-strip {
grid-template-columns: 1fr;
}
}
@media (max-width: 500px) {
.brand p {
display: none;
}
.header-inner {
padding-top: 14px;
padding-bottom: 14px;
}
.intro h2 {
font-size: 27px;
}
.scenario-tabs {
grid-template-columns: repeat(2, 1fr);
}
.stage {
height: 890px;
}
.stage-legend {
display: none;
}
.stage-tools {
left: 11px;
right: auto;
}
.view-head {
transform: scale(0.92);
transform-origin: top left;
}
.scene-label {
max-width: 125px;
font-size: 9px;
}
}
@media (prefers-reduced-motion: reduce) {
*,
*::before,
*::after {
scroll-behavior: auto !important;
transition-duration: 0.01ms !important;
animation-duration: 0.01ms !important;
}
}
</style>
</head>
<body>
<header class="app-header">
<div class="header-inner">
<div class="brand">
<div class="brand-mark" aria-hidden="true">
<svg viewBox="0 0 24 24" fill="none">
<path d="M3 20V9l9-6 9 6v11" stroke="#d9eee4" stroke-width="1.8" stroke-linejoin="round"/>
<path d="M7 20v-6h10v6M7 10h.01M12 10h.01M17 10h.01" stroke="#d9eee4" stroke-width="2.1" stroke-linecap="round"/>
</svg>
</div>
<div>
<h1>Community Center</h1>
<p>Design revision review · feedback translated into testable layout changes</p>
</div>
</div>
<div class="header-meta">
<span class="meta-pill">6 repeated task scenarios</span>
<span class="meta-pill limit">Scenario evidence, not a universal approval</span>
</div>
</div>
</header>
<main>
<section class="intro">
<div>
<h2>One task. Two layouts.</h2>
<p>
The same arrival, destination, and decision points are replayed in the initial and revised
community-center plans. Colored traces show how each revision addresses a specific observed failure.
</p>
</div>
<aside class="intro-note">
This comparison demonstrates six scripted outcomes after one feedback round. It does not claim that the revised
plan satisfies every user, operating condition, or accessibility requirement.
</aside>
</section>
<section class="workspace">
<div class="visual-column">
<nav class="scenario-bar" aria-label="Choose a task scenario">
<div class="scenario-tabs" id="scenarioTabs" role="tablist"></div>
</nav>
<div class="stage" id="stage">
<div id="canvasHost"></div>
<div class="view view-initial" id="viewInitial">
<div class="view-head">
<span class="view-badge">A</span>
<div>
<div class="view-title">Initial layout</div>
<div class="view-subtitle">Conditions observed during the task</div>
</div>
</div>
<div class="labels" id="labelsInitial"></div>
</div>
<div class="view view-revised" id="viewRevised">
<div class="view-head">
<span class="view-badge">B</span>
<div>
<div class="view-title">Revised layout</div>
<div class="view-subtitle">Feedback response tested in the same task</div>
</div>
</div>
<div class="labels" id="labelsRevised"></div>
</div>
<div class="stage-legend" aria-hidden="true">
<span class="legend-item"><span class="legend-line old"></span>Initial route</span>
<span class="legend-item"><span class="legend-line new"></span>Revised route</span>
<span class="legend-item"><span class="legend-dot"></span>Task issue / link</span>
</div>
<div class="stage-tools">
<button class="tool-button" id="pathToggle" type="button" aria-pressed="true">Paths on</button>
<button class="tool-button" id="resetCamera" type="button">Reset view</button>
</div>
</div>
</div>
<aside class="review-panel" id="reviewPanel" aria-live="polite"></aside>
</section>
<section class="evidence-strip" aria-label="Review method and limits">
<article class="evidence-card">
<span class="number">01</span>
<h4>Same explicit task</h4>
<p>Each side uses the same starting point, destination, and decision sequence. The plans are not being compared through a generic aesthetic preference.</p>
</article>
<article class="evidence-card">
<span class="number">02</span>
<h4>Specific revision, specific failure</h4>
<p>Each change is mapped to the condition that prompted it: blocked arrival, hidden information, an uneven threshold, a confusing route, hidden staff, or remote stroller parking.</p>
</article>
<article class="evidence-card">
<span class="number">03</span>
<h4>Bounded conclusion</h4>
<p>A green outcome means the tested path is clearer or more continuous in this model. Dimensions, regulations, peak operations, and diverse user needs still require separate review.</p>
</article>
</section>
<p class="page-note">
Method note: scenarios are illustrative reconstructions of user-feedback themes. The voxel models are comparative
diagrams, not surveyed construction documents. No route shown here has been certified for accessibility or
emergency egress.
</p>
</main>
<script type="module">
import * as THREE from "https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
const scenarios = [
{
id: "arrival",
number: "01",
tab: "Bus arrival",
title: "Find the entrance from the bus",
task: "Start at the eastbound bus stop, identify the public entrance, and reach it without crossing the service lane.",
initial: "The stop was on the far west side of the site. A loading canopy and parked carts interrupted the footpath, and the entrance was not visible on arrival.",
revision: "Move the stop to the frontage, relocate loading activity to the west edge, and provide a continuous level approach to the marked entrance.",
result: "This removes the service-lane detour and restores a direct arrival sightline for the tested route.",
caveat: "Only one stop and one operating condition were tested. Weather, traffic, and evening visibility remain outside this comparison.",
labelsInitial: [
{ text: "Remote bus stop", position: [-10, 1.8, 7.6], tone: "problem" },
{ text: "Loading canopy blocks path", position: [-5.5, 2.6, 5.7], tone: "problem" }
],
labelsRevised: [
{ text: "Frontage bus stop", position: [-1.6, 1.8, 7.7], tone: "success" },
{ text: "Clear entrance sightline", position: [0, 2.2, 4.9], tone: "success" }
],
markerInitial: [-5.4, 0, 5.8],
markerRevised: [-0.5, 0, 5.3],
routeInitial: [[-10, 7.6], [-8.5, 6.7], [-5.4, 5.8], [0, 5.0]],
routeRevised: [[-1.6, 7.7], [-0.3, 6.1], [0, 4.9]]
},
{
id: "schedule",
number: "02",
tab: "Today's schedule",
title: "Find today’s program information",
task: "Ask about the 4:00 pm youth art workshop, find its time on the schedule, then locate the activity room.",
initial: "The noticeboard was tucked behind parcel shelving in the west lobby. Visitors passed the activity room before seeing the information and had no room-linked overview.",
revision: "Relocate the schedule beside the welcome hub and pair the public board with a direct, room-coded sign to the activity area.",
result: "Information and destination are now encountered in sequence, reducing the need to backtrack or ask for directions.",
caveat: "The diagram does not verify that information is current, translated, readable at the intended distance, or accessible in every format.",
labelsInitial: [
{ text: "Noticeboard behind shelving", position: [-7.2, 2.3, 2.2], tone: "problem" },
{ text: "Activity room passed first", position: [4.7, 1.7, -2.6], tone: "problem" }
],
labelsRevised: [
{ text: "Schedule at welcome hub", position: [-1.8, 2.2, 3.7], tone: "success" },
{ text: "Room-coded direction", position: [2.2, 2, 2.6], tone: "success" }
],
markerInitial: [-7.2, 0, 2.5],
markerRevised: [-1.8, 0, 3.7],
routeInitial: [[0, 5.0], [-2.6, 4.5], [-5.8, 3.6], [-7.2, 2.5]],
routeRevised: [[0, 5.0], [-0.8, 4.3], [-1.8, 3.7]]
},
{
id: "wc",
number: "03",
tab: "Accessible WC",
title: "Reach the accessible toilet",
task: "As a wheelchair user, enter from the public entrance and find the accessible toilet without reversing or negotiating a level change.",
initial: "The accessible toilet was behind an east-wing partition, while the approach ended at two steps and a narrow turn. The route was not legible from the entrance.",
revision: "Bring the accessible toilet forward, remove the stepped threshold, and connect it to the entrance with a continuous paved path and visible sign.",
result: "The tested approach removes the level change and replaces a concealed destination with a visible, direct link.",
caveat: "The apparent turning space is illustrative. Door widths, gradients, transfer space, fixtures, and building-code compliance have not been audited.",
labelsInitial: [
{ text: "Hidden WC sign", position: [4.4, 1.8, 1.1], tone: "problem" },
{ text: "Two-step threshold", position: [6.2, 1.2, 3.6], tone: "problem" }
],
labelsRevised: [
{ text: "Visible accessible WC", position: [6.3, 2.1, 1.7], tone: "success" },
{ text: "Flush, continuous approach", position: [4.8, 0.9, 3.6], tone: "success" }
],
markerInitial: [6.2, 0, 3.6],
markerRevised: [5.2, 0, 3.5],
routeInitial: [[0, 5.0], [3.5, 4.6], [4.4, 3.6], [6.2, 3.6]],
routeRevised: [[0, 5.0], [3.2, 4.7], [5.2, 3.5], [6.3, 2.4]]
},
{
id: "meeting",
number: "04",
tab: "Meeting room",
title: "Join the tenant meeting",
task: "As a first-time visitor, follow signs from the entrance to the 6:00 pm tenant meeting in the west multipurpose room.",
initial: "An opaque central partition extended into the lobby, forcing a dogleg around the end of the wall before the meeting-room sign became visible.",
revision: "Remove the projecting partition, open the central spine, and place a clear sign where the direct turn to the meeting room is visible.",
result: "The same destination is reached with a shorter, more understandable sequence of turns.",
caveat: "A clear route does not confirm that doors, furniture, acoustics, or evening signage work for every visitor.",
labelsInitial: [
{ text: "Opaque partition", position: [0.7, 2.1, -1.2], tone: "problem" },
{ text: "Long dogleg", position: [0.8, 0.8, 0.3], tone: "problem" }
],
labelsRevised: [
{ text: "Open central spine", position: [0, 1.2, 1.0], tone: "success" },
{ text: "Direct meeting-room turn", position: [-1.8, 1.8, -1.0], tone: "success" }
],
markerInitial: [0.7, 0, 0.5],
markerRevised: [-1.2, 0, 0.3],
routeInitial: [[0, 5.0], [0, 2.1], [0.8, 0.5], [0.8, -1.2], [-2.2, -1.2], [-4.7, -1.2]],
routeRevised: [[0, 5.0], [0, 2.0], [-1.4, 0.8], [-2.2, -1.2], [-4.7, -1.2]]
},
{
id: "staff",
number: "05",
tab: "Staff help",
title: "Ask staff about a room booking",
task: "Enter without an appointment, find a staff member, and ask how to reserve the community room.",
initial: "The staffed desk was located in a back office behind multiple partitions. Nothing at the entrance indicated where staff could be found.",
revision: "Place the staff desk within the open welcome hub and add a visible information marker and booking display facing the entrance.",
result: "A person can now identify a staffed help point before entering the circulation area.",
caveat: "This assumes the desk is staffed during the test period. Hours, privacy, language support, and queued demand are not evaluated.",
labelsInitial: [
{ text: "Hidden back-office desk", position: [6.4, 1.8, -4.5], tone: "problem" },
{ text: "No help point at entrance", position: [0.2, 1.8, 4.9], tone: "problem" }
],
labelsRevised: [
{ text: "Staff visible from entrance", position: [2.1, 2, 2.8], tone: "success" },
{ text: "Information + booking desk", position: [2.2, 1.1, 2.8], tone: "success" }
],
markerInitial: [5.8, 0, -3.6],
markerRevised: [2.2, 0, 2.8],
routeInitial: [[0, 5.0], [3.1, 4.3], [5.2, 2.3], [5.2, -1.0], [5.8, -3.6]],
routeRevised: [[0, 5.0], [1.4, 4.1], [2.2, 2.8]]
},
{
id: "family",
number: "06",
tab: "Stroller + family",
title: "Reach the family waiting area",
task: "Arrive with a stroller, park without blocking traffic, and reach the family waiting area on a continuous route.",
initial: "Stroller parking was positioned along the vehicle edge with no protected bay. The waiting nook was unmarked and separated from the arrival path.",
revision: "Add a covered stroller bay beside the entrance and move the family waiting area directly behind it on the same level route.",
result: "Parking, the entrance, and the waiting destination now form one legible sequence for the tested arrival.",
caveat: "The result does not address stroller capacity, caregiver privacy, changing facilities, child-safe traffic management, or simultaneous peak use.",
labelsInitial: [
{ text: "Stroller bay at road edge", position: [-8.1, 1.1, 6.4], tone: "problem" },
{ text: "Unmarked waiting nook", position: [-4.8, 1.8, 1.8], tone: "problem" }
],
labelsRevised: [
{ text: "Covered stroller bay", position: [-3.3, 1.6, 5.3], tone: "success" },
{ text: "Family area on same route", position: [-4.3, 1.9, 1.9], tone: "success" }
],
markerInitial: [-8.1, 0, 6.4],
markerRevised: [-3.3, 0, 5.3],
routeInitial: [[0, 5.0], [-3.0, 5.2], [-6.0, 5.8], [-8.1, 6.4]],
routeRevised: [[0, 5.0], [-1.8, 5.0], [-3.3, 5.3]]
}
];
const COLORS = {
ground: 0xaec7a6,
groundDark: 0x87aa86,
road: 0x59625f,
sidewalk: 0xded8c8,
floor: 0xf0eadc,
wall: 0xf4f0e4,
wallEdge: 0x9aab9b,
wood: 0xb9895e,
woodLight: 0xd0a879,
blue: 0x5a8192,
blueDark: 0x395d6d,
yellow: 0xe1ae48,
red: 0xc85746,
green: 0x147b69,
routeOld: 0xdf6b55,
routeNew: 0x0e8f7b,
tree: 0x527f5f,
treeLight: 0x6f9b6d,
white: 0xfffdf6,
charcoal: 0x3c4743
};
const stage = document.getElementById("stage");
const canvasHost = document.getElementById("canvasHost");
const viewInitial = document.getElementById("viewInitial");
const viewRevised = document.getElementById("viewRevised");
const labelsInitial = document.getElementById("labelsInitial");
const labelsRevised = document.getElementById("labelsRevised");
const reviewPanel = document.getElementById("reviewPanel");
const tabsElement = document.getElementById("scenarioTabs");
let currentScenario = scenarios[0];
let pathsVisible = true;
let dragging = false;
let lastPointerX = 0;
let lastPointerY = 0;
const cameraState = {
azimuth: 0.08,
polar: 0.70,
zoom: 1.0
};
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.tabIndex = 0;
renderer.domElement.setAttribute(
"aria-label",
"Interactive 3D comparison of initial and revised community center layouts. Drag to orbit, scroll to zoom."
);
canvasHost.appendChild(renderer.domElement);
const camera = new THREE.OrthographicCamera(-16, 16, 12, -12, 0.1, 120);
const raycaster = new THREE.Raycaster();
const pointer = new THREE.Vector2();
function standardMaterial(color, options = {}) {
return new THREE.MeshStandardMaterial({
color,
roughness: options.roughness ?? 0.82,
metalness: options.metalness ?? 0,
transparent: options.transparent ?? false,
opacity: options.opacity ?? 1,
emissive: options.emissive ?? 0x000000,
emissiveIntensity: options.emissiveIntensity ?? 0,
depthWrite: options.depthWrite ?? true,
side: options.side ?? THREE.FrontSide
});
}
function box(parent, x, y, z, width, height, depth, color, options = {}) {
const geometry = new THREE.BoxGeometry(width, height, depth);
const material = options.material || standardMaterial(color, options);
const mesh = new THREE.Mesh(geometry, material);
mesh.position.set(x, y, z);
if (options.rotationY) mesh.rotation.y = options.rotationY;
if (options.rotationX) mesh.rotation.x = options.rotationX;
if (options.rotationZ) mesh.rotation.z = options.rotationZ;
mesh.castShadow = options.castShadow ?? true;
mesh.receiveShadow = options.receiveShadow ?? true;
parent.add(mesh);
return mesh;
}
function cylinder(parent, x, y, z, radius, height, color, options = {}) {
const mesh = new THREE.Mesh(
new THREE.CylinderGeometry(radius, radius, height, options.segments || 8),
options.material || standardMaterial(color, options)
);
mesh.position.set(x, y, z);
mesh.castShadow = options.castShadow ?? true;
mesh.receiveShadow = options.receiveShadow ?? true;
parent.add(mesh);
return mesh;
}
function cylinderBetween(parent, a, b, radius, color, opacity = 1) {
const start = new THREE.Vector3(a[0], a[1], a[2]);
const end = new THREE.Vector3(b[0], b[1], b[2]);
const direction = new THREE.Vector3().subVectors(end, start);
const length = direction.length();
const midpoint = new THREE.Vector3().addVectors(start, end).multiplyScalar(0.5);
const geometry = new THREE.CylinderGeometry(radius, radius, length, 7);
const material = standardMaterial(color, {
transparent: opacity < 1,
opacity,
roughness: 0.55,
emissive: color,
emissiveIntensity: 0.12,
depthWrite: false
});
const mesh = new THREE.Mesh(geometry, material);
mesh.position.copy(midpoint);
mesh.quaternion.setFromUnitVectors(
new THREE.Vector3(0, 1, 0),
direction.clone().normalize()
);
mesh.castShadow = false;
mesh.receiveShadow = false;
parent.add(mesh);
return mesh;
}
function addPerson(parent, x, z, color = 0x557a87, scale = 1) {
const group = new THREE.Group();
group.position.set(x, 0, z);
group.scale.setScalar(scale);
box(group, 0, 0.58, 0, 0.34, 0.72, 0.3, color);
box(group, 0, 1.08, 0, 0.35, 0.34, 0.34, 0xd8b08d);
box(group, -0.23, 0.22, 0, 0.16, 0.44, 0.2, 0x354149);
box(group, 0.23, 0.22, 0, 0.16, 0.44, 0.2, 0x354149);
parent.add(group);
return group;
}
function addTree(parent, x, z, size = 1) {
cylinder(parent, x, 0.55 * size, z, 0.18 * size, 1.1 * size, 0x876446);
box(parent, x, 1.55 * size, z, 1.35 * size, 1.45 * size, 1.25 * size, COLORS.tree);
box(parent, x + 0.35 * size, 1.85 * size, z + 0.08 * size, 0.9 * size, 0.95 * size, 0.9 * size, COLORS.treeLight);
}
function addBusStop(parent, x, z, busX = x) {
const group = new THREE.Group();
group.position.set(x, 0, z);
parent.add(group);
box(group, -1.0, 1.25, 0, 0.12, 2.5, 0.12, 0x53635d);
box(group, 1.0, 1.25, 0, 0.12, 2.5, 0.12, 0x53635d);
box(group, 0, 2.48, 0, 2.35, 0.18, 1.35, 0x426d63);
box(group, 0, 1.3, -0.48, 1.8, 1.5, 0.1, 0xaec9c0, { transparent: true, opacity: 0.65 });
box(group, 0, 0.58, 0.15, 1.8, 0.15, 0.42, 0xad7b51);
box(group, 1.35, 1.75, 0, 0.42, 0.75, 0.12, 0xf2c756);
parent.add(group);
box(parent, busX, 0.92, 9.95, 4.6, 1.35, 1.5, 0xe1ae48);
box(parent, busX, 1.18, 10.73, 3.75, 0.55, 0.06, COLORS.blueDark);
box(parent, busX, 0.55, 10.75, 3.7, 0.15, 0.08, 0xf7e9b9);
for (const side of [-1, 1]) {
box(parent, busX + side * 1.75, 0.53, 9.95, 0.42, 0.32, 1.5, 0x36423e);
}
}
function addBoard(parent, x, z, revised = false) {
const width = revised ? 2.1 : 1.65;
box(parent, x - width * 0.36, 0.65, z, 0.12, 1.3, 0.12, 0x66756d);
box(parent, x + width * 0.36, 0.65, z, 0.12, 1.3, 0.12, 0x66756d);
box(parent, x, 1.55, z, width, 1.05, 0.16, revised ? 0x2b6459 : 0x766c5f);
const tileColors = [0xe6b14d, 0x71a28c, 0xe7e0cb, 0x6b8fa0];
for (let i = 0; i < 4; i++) {
box(
parent,
x - width * 0.34 + (i % 2) * width * 0.34,
1.32 + Math.floor(i / 2) * 0.42,
z + 0.11,
width * 0.26,
0.26,
0.05,
tileColors[i]
);
}
}
function addDesk(parent, x, z, revised = false) {
box(parent, x, 0.65, z, revised ? 2.3 : 1.8, 1.1, 0.85, revised ? 0x2e7467 : 0x8a7160);
box(parent, x, 1.23, z, revised ? 2.45 : 1.95, 0.12, 0.95, 0xe7deca);
if (revised) {
box(parent, x + 0.35, 1.65, z - 0.03, 0.75, 0.55, 0.09, 0x344e47);
box(parent, x + 0.35, 1.65, z + 0.03, 0.62, 0.4, 0.035, 0x83b8a7);
box(parent, x - 0.75, 1.55, z + 0.1, 0.48, 0.48, 0.08, 0xf2c758);
}
addPerson(parent, x, z - 0.95, revised ? 0x38766c : 0x6f6170, 0.95);
}
function addMeetingFurniture(parent) {
box(parent, -4.8, 0.82, -2.7, 4.2, 0.18, 1.35, COLORS.woodLight);
for (const x of [-6.2, -4.8, -3.4]) {
box(parent, x, 0.43, -3.7, 0.65, 0.7, 0.55, 0x6f8b83);
box(parent, x, 0.43, -1.7, 0.65, 0.7, 0.55, 0x6f8b83);
}
box(parent, -7.7, 1.1, -2.7, 1.3, 1.5, 0.18, 0x3f5c54);
box(parent, -7.58, 1.25, -2.59, 0.9, 0.55, 0.04, 0xc9d8cf);
}
function addActivityFurniture(parent) {
for (const z of [-4.5, -2.3]) {
box(parent, 4.8, 0.78, z, 3.2, 0.18, 1.05, COLORS.woodLight);
box(parent, 4.8, 0.38, z, 0.35, 0.7, 0.35, 0x7b6a55);
for (const x of [3.8, 5.8]) {
box(parent, x, 0.42, z + 0.85, 0.55, 0.65, 0.5, 0xc16f58);
}
}
}
function addToiletRoom(parent, x, z, revised = false) {
box(parent, x, 0.13, z, 4.3, 0.12, 4.4, revised ? 0xd8ece8 : 0xdbe7eb);
box(parent, x - 2.15, 0.9, z, 0.2, 1.8, 4.4, COLORS.wall);
box(parent, x, 0.9, z - 2.15, 4.3, 1.8, 0.2, COLORS.wall);
box(parent, x + 1.0, 0.55, z - 1.2, 0.75, 0.9, 1.1, 0xf7f6ef);
box(parent, x + 0.65, 0.72, z - 1.2, 0.65, 0.36, 0.75, 0xffffff);
box(parent, x - 1.15, 0.55, z + 0.95, 0.9, 0.15, 0.6, 0xf7f6ef);
box(parent, x - 1.15, 0.88, z + 1.2, 0.12, 0.85, 0.12, 0x63726e);
if (revised) {
const ring = new THREE.Mesh(
new THREE.TorusGeometry(1.05, 0.045, 6, 32),
standardMaterial(COLORS.green, { roughness: 0.55, emissive: COLORS.green, emissiveIntensity: 0.08 })
);
ring.rotation.x = Math.PI / 2;
ring.position.set(x - 0.55, 0.23, z + 0.15);
parent.add(ring);
} else {
box(parent, x + 0.15, 0.22, z + 1.85, 1.5, 0.32, 0.48, 0x9d6958);
box(parent, x + 0.15, 0.48, z + 2.0, 1.5, 0.22, 0.36, 0xb27c65);
}
}
function addLighting(scene) {
scene.add(new THREE.HemisphereLight(0xf7f3df, 0x6c8972, 2.1));
const sun = new THREE.DirectionalLight(0xfff0d2, 3.1);
sun.position.set(-12, 25, 16);
sun.castShadow = true;
sun.shadow.mapSize.set(1024, 1024);
sun.shadow.camera.left = -20;
sun.shadow.camera.right = 20;
sun.shadow.camera.top = 18;
sun.shadow.camera.bottom = -18;
sun.shadow.camera.near = 1;
sun.shadow.camera.far = 65;
sun.shadow.bias = -0.0005;
scene.add(sun);
const fill = new THREE.DirectionalLight(0xc8ddff, 0.65);
fill.position.set(15, 10, -10);
scene.add(fill);
}
function buildScene(revised) {
const scene = new THREE.Scene();
scene.background = new THREE.Color(revised ? 0xe9f0e6 : 0xf1e9e2);
scene.fog = new THREE.Fog(revised ? 0xe9f0e6 : 0xf1e9e2, 42, 78);
addLighting(scene);
const root = new THREE.Group();
scene.add(root);
box(root, 0, -0.4, 0, 31, 0.7, 23, COLORS.ground);
box(root, 0, -0.02, 9.45, 30.5, 0.12, 2.6, COLORS.road);
box(root, 0, 0.06, 7.45, 30.5, 0.16, 1.1, COLORS.sidewalk);
box(root, 0, 0.06, 6.15, 30.5, 0.14, 1.05, 0xd2cbbb);
for (let x = -13; x < 14; x += 2.7) {
box(root, x, 0.08, 9.45, 1.25, 0.035, 0.09, 0xe3d6a5, { castShadow: false });
}
box(root, 0, 0.11, -0.85, 18.4, 0.18, 11.7, COLORS.floor);
box(root, 0, 1.42, -6.67, 18.4, 2.65, 0.28, COLORS.wall);
box(root, -9.08, 1.05, -0.85, 0.28, 1.9, 11.7, COLORS.wall);
box(root, 9.08, 1.05, -0.85, 0.28, 1.9, 11.7, COLORS.wall);
box(root, -5.25, 0.7, 4.92, 7.5, 1.2, 0.25, COLORS.wall);
box(root, 5.55, 0.7, 4.92, 7.0, 1.2, 0.25, COLORS.wall);
box(root, 0, 0.22, 5.03, 3.7, 0.18, 1.15, 0xccb990);
box(root, 0, 2.65, 5.12, 4.1, 0.18, 1.35, revised ? 0x357768 : 0x8c7763);
box(root, -1.9, 1.35, 4.95, 0.14, 2.3, 0.14, 0x56655e);
box(root, 1.9, 1.35, 4.95, 0.14, 2.3, 0.14, 0x56655e);
box(root, -4.85, 0.22, -3.0, 7.25, 0.12, 6.55, revised ? 0xd8e8dd : 0xe1dfcd);
box(root, 4.85, 0.22, -3.0, 7.25, 0.12, 6.55, revised ? 0xeee1c8 : 0xe9dfc9);
box(root, 6.35, 0.22, -4.7, 4.5, 0.12, 3.25, 0xdad9e7);
if (revised) {
box(root, -4.8, 0.22, 1.95, 6.15, 0.12, 4.25, 0xe5ded2);
box(root, -1.9, 0.75, 1.85, 0.2, 1.5, 4.1, COLORS.wall);
box(root, -7.65, 0.75, 1.85, 0.2, 1.5, 4.1, COLORS.wall);
box(root, -4.8, 0.75, -0.25, 6.15, 1.5, 0.2, COLORS.wall);
box(root, 0, 0.92, -2.85, 0.2, 1.65, 6.75, COLORS.wall);
box(root, 4.85, 0.92, -2.85, 0.2, 1.65, 6.75, COLORS.wall);
box(root, 0, 0.2, 0.95, 2.5, 0.12, 5.5, 0xc6dcd1);
box(root, -1.35, 0.2, 0.3, 1.3, 0.12, 3.9, 0xc6dcd1);
addDesk(root, 0, 3.25, true);
addBoard(root, -1.85, 3.7, true);
addToiletRoom(root, 6.35, 1.8, true);
box(root, -4.1, 0.52, 2.0, 2.1, 0.55, 0.8, 0x718f82);
box(root, -4.1, 0.92, 2.35, 2.1, 0.8, 0.18, 0x718f82);
box(root, -3.25, 0.55, 5.15, 2.0, 0.14, 1.05, 0x79968a);
box(root, -3.25, 1.65, 5.65, 2.2, 0.16, 1.35, 0x376c60);
box(root, -4.2, 0.95, 5.65, 0.1, 1.55, 0.1, 0x56655e);
box(root, -2.3, 0.95, 5.65, 0.1, 1.55, 0.1, 0x56655e);
addBusStop(root, -1.6, 7.82, -1.6);
box(root, -8.2, 1.18, 5.85, 3.2, 2.15, 2.0, 0x8a9285);
box(root, -8.2, 0.48, 4.7, 3.2, 0.18, 0.7, 0x626d64);
addPerson(root, -0.9, 6.7, 0x6c8e7f, 1.0);
addPerson(root, 1.0, 4.5, 0x6c8e7f, 0.92);
addPerson(root, 4.8, -2.0, 0xd07c62, 0.88);
} else {
box(root, 0.7, 0.9, -3.05, 0.25, 1.6, 6.65, COLORS.wall);
box(root, 4.85, 0.9, -2.95, 0.25, 1.6, 6.45, COLORS.wall);
box(root, 4.35, 0.9, 2.05, 0.22, 1.6, 4.25, COLORS.wall);
box(root, 6.35, 0.9, -0.15, 4.2, 1.6, 0.22, COLORS.wall);
addBoard(root, -7.2, 1.7, false);
box(root, -7.2, 0.78, 2.75, 3.0, 1.3, 0.8, 0x9c8d73);
for (let i = 0; i < 3; i++) {
box(root, -8.2 + i * 1.0, 1.15, 2.3, 0.75, 0.75, 0.65, 0xb4a17f);
}
addDesk(root, 6.35, -4.65, false);
addToiletRoom(root, 6.35, 1.75, false);
box(root, -5.35, 1.35, 5.72, 5.1, 2.5, 2.35, 0x867d6e);
box(root, -5.35, 0.56, 4.45, 5.1, 0.22, 0.55, 0x655f54);
for (let i = 0; i < 3; i++) {
box(root, -5.7 + i * 1.35, 0.75, 4.05, 0.9, 1.0, 0.75, 0x758078);
}
addBusStop(root, -10.1, 7.82, -10.1);
box(root, -8.15, 0.48, 6.4, 1.85, 0.12, 1.05, 0x859488);
box(root, -8.15, 0.82, 6.65, 0.95, 0.55, 0.5, 0x5b6f65);
box(root, -7.55, 0.55, 6.4, 0.12, 0.8, 0.12, 0x47564f);
box(root, -4.8, 0.52, 1.85, 2.0, 0.55, 0.8, 0x9b927d);
addPerson(root, -8.9, 6.4, 0x6b7f8d, 1.0);
addPerson(root, 1.0, 4.5, 0x8b7464, 0.92);
}
addMeetingFurniture(root);
addActivityFurniture(root);
const treePositions = [
[-12.5, 4.6, 0.9], [-13.0, 1.5, 1.1], [-12.4, -4.8, 1.0],
[12.5, 4.9, 1.05], [13.0, 0.8, 0.88], [12.4, -5.4, 1.1],
[-10.4, -8.6, 1.0], [8.7, -8.8, 1.05]
];
treePositions.forEach(([x, z, s]) => addTree(root, x, z, s));
const routeGroups = {};
const markers = {};
scenarios.forEach((scenario) => {
const group = new THREE.Group();
root.add(group);
const points = (revised ? scenario.routeRevised : scenario.routeInitial).map(
([x, z]) => [x, 0.31, z]
);
for (let i = 0; i < points.length - 1; i++) {
cylinderBetween(group, points[i], points[i + 1], 0.075, revised ? COLORS.routeNew : COLORS.routeOld, 0.9);
}
points.forEach((point, index) => {
if (index === 0 || index === points.length - 1) {
const node = new THREE.Mesh(
new THREE.SphereGeometry(0.14, 10, 8),
standardMaterial(revised ? COLORS.routeNew : COLORS.routeOld, {
roughness: 0.45,
emissive: revised ? COLORS.routeNew : COLORS.routeOld,
emissiveIntensity: 0.18
})
);
node.position.set(point[0], point[1], point[2]);
group.add(node);
}
});
group.visible = false;
routeGroups[scenario.id] = group;
const marker = new THREE.Group();
const [mx, , mz] = revised ? scenario.markerRevised : scenario.markerInitial;
marker.position.set(mx, 0, mz);
root.add(marker);
const color = revised ? COLORS.green : COLORS.red;
const ring = new THREE.Mesh(
new THREE.TorusGeometry(0.42, 0.055, 6, 20),
standardMaterial(color, { roughness: 0.5, emissive: color, emissiveIntensity: 0.1 })
);
ring.rotation.x = Math.PI / 2;
ring.position.y = 0.28;
ring.userData.pulse = true;
marker.add(ring);
cylinder(marker, 0, 0.7, 0, 0.055, 1.1, 0x4b5751);
box(marker, 0, 1.35, 0, 0.65, 0.65, 0.16, color);
if (revised) {
const checkA = box(marker, -0.07, 1.35, 0.1, 0.11, 0.34, 0.05, 0xffffff, { rotationZ: -0.78 });
const checkB = box(marker, 0.12, 1.27, 0.11, 0.11, 0.48, 0.05, 0xffffff, { rotationZ: 0.66 });
checkA.castShadow = false;
checkB.castShadow = false;
} else {
box(marker, 0, 1.45, 0.1, 0.1, 0.28, 0.05, 0xffffff);
box(marker, 0, 1.22, 0.1, 0.1, 0.1, 0.05, 0xffffff);
}
marker.visible = false;
markers[scenario.id] = marker;
});
return {
scene,
root,
routeGroups,
markers,
labels: []
};
}
const initialEntry = buildScene(false);
const revisedEntry = buildScene(true);
function createScenarioButtons() {
scenarios.forEach((scenario) => {
const button = document.createElement("button");
button.className = "scenario-tab";
button.type = "button";
button.id = `tab-${scenario.id}`;
button.dataset.scenario = scenario.id;
button.setAttribute("role", "tab");
button.setAttribute("aria-controls", "reviewPanel");
button.setAttribute("aria-selected", "false");
button.innerHTML = `
<span class="tab-number">${scenario.number}</span>
<span class="tab-name">${scenario.tab}</span>
`;
button.addEventListener("click", () => selectScenario(scenario.id));
tabsElement.appendChild(button);
});
}
function renderPanel(scenario) {
reviewPanel.innerHTML = `
<div class="panel-kicker">
<span>Scenario ${scenario.number}</span>
<span class="panel-count">${scenario.number} / ${String(scenarios.length).padStart(2, "0")}</span>
</div>
<h3>${scenario.title}</h3>
<div class="task-summary">
<div class="task-label">Same task in both layouts</div>
<p>${scenario.task}</p>
</div>
<article class="finding old">
<div class="finding-title">Initial · observed failure</div>
<p>${scenario.initial}</p>
</article>
<div class="resolution-arrow" aria-hidden="true">↓</div>
<article class="finding new">
<div class="finding-title">Revision · feedback response</div>
<p>${scenario.revision}</p>
</article>
<article class="finding result">
<div class="finding-title">Task result · resolved in this test</div>
<p>${scenario.result}</p>
</article>
<div class="caveat">
<strong>What this does not establish</strong>
<p>${scenario.caveat}</p>
</div>
<div class="panel-footer">
<svg viewBox="0 0 24 24" fill="none" aria-hidden="true">
<circle cx="12" cy="12" r="9" stroke="currentColor" stroke-width="1.7"/>
<path d="M12 10v6M12 7.2v.2" stroke="currentColor" stroke-width="1.9" stroke-linecap="round"/>
</svg>
<span>“Resolved” describes the selected scripted task in this diagram, not the complete safety, access, or operational performance of the design.</span>
</div>
`;
}
function rebuildLabels(entry, labelHost, labelData) {
labelHost.replaceChildren();
entry.labels = labelData.map((item) => {
const element = document.createElement("div");
element.className = `scene-label ${item.tone || ""}`;
element.textContent = item.text;
labelHost.appendChild(element);
return {
element,
position: new THREE.Vector3(item.position[0], item.position[1], item.position[2])
};
});
}
function updateSceneState() {
Object.entries(initialEntry.routeGroups).forEach(([id, group]) => {
group.visible = pathsVisible && id === currentScenario.id;
initialEntry.markers[id].visible = id === currentScenario.id;
});
Object.entries(revisedEntry.routeGroups).forEach(([id, group]) => {
group.visible = pathsVisible && id === currentScenario.id;
revisedEntry.markers[id].visible = id === currentScenario.id;
});
rebuildLabels(initialEntry, labelsInitial, currentScenario.labelsInitial);
rebuildLabels(revisedEntry, labelsRevised, currentScenario.labelsRevised);
document.querySelectorAll(".scenario-tab").forEach((tab) => {
const selected = tab.dataset.scenario === currentScenario.id;
tab.setAttribute("aria-selected", String(selected));
tab.tabIndex = selected ? 0 : -1;
});
renderPanel(currentScenario);
}
function selectScenario(id) {
const scenario = scenarios.find((item) => item.id === id);
if (!scenario) return;
currentScenario = scenario;
updateSceneState();
}
createScenarioButtons();
updateSceneState();
tabsElement.addEventListener("keydown", (event) => {
if (!["ArrowLeft", "ArrowRight", "ArrowUp", "ArrowDown", "Home", "End"].includes(event.key)) return;
event.preventDefault();
let index = scenarios.findIndex((item) => item.id === currentScenario.id);
if (event.key === "ArrowRight" || event.key === "ArrowDown") index = (index + 1) % scenarios.length;
if (event.key === "ArrowLeft" || event.key === "ArrowUp") index = (index - 1 + scenarios.length) % scenarios.length;
if (event.key === "Home") index = 0;
if (event.key === "End") index = scenarios.length - 1;
selectScenario(scenarios[index].id);
document.getElementById(`tab-${scenarios[index].id}`).focus();
});
document.getElementById("pathToggle").addEventListener("click", (event) => {
pathsVisible = !pathsVisible;
event.currentTarget.setAttribute("aria-pressed", String(pathsVisible));
event.currentTarget.textContent = pathsVisible ? "Paths on" : "Paths off";
updateSceneState();
});
function resetCamera() {
cameraState.azimuth = 0.08;
cameraState.polar = 0.70;
cameraState.zoom = 1.0;
}
document.getElementById("resetCamera").addEventListener("click", resetCamera);
renderer.domElement.addEventListener("pointerdown", (event) => {
if (event.button !== 0) return;
dragging = true;
lastPointerX = event.clientX;
lastPointerY = event.clientY;
renderer.domElement.setPointerCapture(event.pointerId);
});
renderer.domElement.addEventListener("pointermove", (event) => {
if (!dragging) return;
const dx = event.clientX - lastPointerX;
const dy = event.clientY - lastPointerY;
lastPointerX = event.clientX;
lastPointerY = event.clientY;
cameraState.azimuth -= dx * 0.006;
cameraState.polar = THREE.MathUtils.clamp(cameraState.polar + dy * 0.0045, 0.42, 1.12);
});
function endDrag(event) {
dragging = false;
if (event.pointerId !== undefined && renderer.domElement.hasPointerCapture(event.pointerId)) {
renderer.domElement.releasePointerCapture(event.pointerId);
}
}
renderer.domElement.addEventListener("pointerup", endDrag);
renderer.domElement.addEventListener("pointercancel", endDrag);
renderer.domElement.addEventListener("dblclick", resetCamera);
renderer.domElement.addEventListener("wheel", (event) => {
event.preventDefault();
cameraState.zoom = THREE.MathUtils.clamp(
cameraState.zoom * Math.exp(-event.deltaY * 0.001),
0.72,
1.6
);
}, { passive: false });
renderer.domElement.addEventListener("keydown", (event) => {
const step = 0.08;
if (event.key === "ArrowLeft") cameraState.azimuth += step;
else if (event.key === "ArrowRight") cameraState.azimuth -= step;
else if (event.key === "ArrowUp") cameraState.polar = Math.max(0.42, cameraState.polar - step);
else if (event.key === "ArrowDown") cameraState.polar = Math.min(1.12, cameraState.polar + step);
else if (event.key === "+" || event.key === "=") cameraState.zoom = Math.min(1.6, cameraState.zoom + 0.08);
else if (event.key === "-") cameraState.zoom = Math.max(0.72, cameraState.zoom - 0.08);
else if (event.key === "Home") resetCamera();
else return;
event.preventDefault();
});
function resizeRenderer() {
const width = Math.max(1, stage.clientWidth);
const height = Math.max(1, stage.clientHeight);
renderer.setSize(width, height, false);
}
const resizeObserver = new ResizeObserver(resizeRenderer);
resizeObserver.observe(stage);
resizeRenderer();
function configureCamera(aspect) {
const halfHeight = Math.max(10.5, 16 / Math.max(aspect, 0.45));
camera.left = -halfHeight * aspect;
camera.right = halfHeight * aspect;
camera.top = halfHeight;
camera.bottom = -halfHeight;
camera.zoom = cameraState.zoom;
camera.updateProjectionMatrix();
const radius = 36;
const horizontal = radius * Math.sin(cameraState.polar);
camera.position.set(
Math.sin(cameraState.azimuth) * horizontal,
radius * Math.cos(cameraState.polar),
Math.cos(cameraState.azimuth) * horizontal
);
camera.lookAt(0, 0, 0.7);
camera.updateMatrixWorld();
}
function positionLabels(entry, viewElement) {
const rect = viewElement.getBoundingClientRect();
entry.labels.forEach((label) => {
const projected = label.position.clone().project(camera);
const visible = projected.z >= -1 && projected.z <= 1 &&
projected.x > -1.12 && projected.x < 1.12 &&
projected.y > -1.12 && projected.y < 1.12;
label.element.style.display = visible ? "block" : "none";
if (!visible) return;
const x = (projected.x * 0.5 + 0.5) * rect.width;
const y = (-projected.y * 0.5 + 0.5) * rect.height;
label.element.style.left = `${x}px`;
label.element.style.top = `${y}px`;
});
}
function renderView(entry, viewElement, stageRect) {
const rect = viewElement.getBoundingClientRect();
const x = rect.left - stageRect.left;
const y = stageRect.bottom - rect.bottom;
configureCamera(rect.width / Math.max(rect.height, 1));
renderer.setViewport(x, y, rect.width, rect.height);
renderer.setScissor(x, y, rect.width, rect.height);
renderer.render(entry.scene, camera);
positionLabels(entry, viewElement);
}
const reducedMotion = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
const clock = new THREE.Clock();
function animate() {
const elapsed = clock.getElapsedTime();
const stageRect = stage.getBoundingClientRect();
renderer.setScissorTest(false);
renderer.clear();
renderer.setScissorTest(true);
renderView(initialEntry, viewInitial, stageRect);
renderView(revisedEntry, viewRevised, stageRect);
if (!reducedMotion) {
[initialEntry, revisedEntry].forEach((entry) => {
const marker = entry.markers[currentScenario.id];
if (marker) {
marker.traverse((object) => {
if (object.userData.pulse) {
const pulse = 1 + Math.sin(elapsed * 3.1) * 0.11;
object.scale.setScalar(pulse);
}
});
}
});
}
renderer.setScissorTest(false);
}
renderer.setAnimationLoop(animate);
</script>
</body>
</html>
```