Prompt specification
Build or customize the Three.js 3D scene "Inclusive station waiting area" 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: Inclusive station waiting area
Category: Architecture & Cities · Style: Procedural Solid / Shader 3D
License: MIT · Reference: https://three3d.app/scene/inclusive-station-waiting-area-x0411
Scene Description Prompt:
Create a single self-contained HTML file using Three.js from cdnjs that shows captioned public announcements. Compose a waiting room with benches, departure displays, and platform doors; visitors respond to matching visual announcements while the selected route remains highlighted on the floor. Stylized solid forms.
Working Three.js Starter (inclusive-station-waiting-area-x0411):
```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="#142338" />
<title>North Terminal — Public Announcements</title>
<style>
:root {
--accent: #3478e5;
--accent-soft: rgba(52, 120, 229, 0.14);
--ink: #142338;
--paper: #f7f4ec;
}
* {
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: #d8d3c8;
color: var(--ink);
font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
"Segoe UI", sans-serif;
}
button {
font: inherit;
}
#scene {
position: fixed;
inset: 0;
}
#scene canvas {
display: block;
width: 100%;
height: 100%;
outline: none;
touch-action: none;
cursor: grab;
}
#scene canvas:active {
cursor: grabbing;
}
.brand {
position: fixed;
z-index: 4;
top: 24px;
left: 26px;
display: flex;
align-items: center;
gap: 13px;
pointer-events: none;
}
.brand-mark {
display: grid;
width: 47px;
height: 47px;
place-items: center;
border-radius: 14px;
background: var(--ink);
color: #fff;
font-size: 13px;
font-weight: 850;
letter-spacing: -0.04em;
box-shadow: 0 9px 25px rgba(20, 35, 56, 0.18);
}
.brand-copy {
padding: 9px 13px 10px;
border: 1px solid rgba(255, 255, 255, 0.58);
border-radius: 13px;
background: rgba(247, 244, 236, 0.82);
backdrop-filter: blur(12px);
box-shadow: 0 8px 28px rgba(20, 35, 56, 0.09);
}
.brand-copy strong {
display: block;
font-size: 12px;
letter-spacing: 0.15em;
text-transform: uppercase;
}
.brand-copy span {
display: block;
margin-top: 2px;
color: #68717c;
font-size: 11px;
letter-spacing: 0.04em;
}
.panel {
position: fixed;
z-index: 5;
top: 22px;
right: 22px;
width: 316px;
max-height: calc(100vh - 44px);
overflow: auto;
padding: 21px;
border: 1px solid rgba(255, 255, 255, 0.72);
border-radius: 22px;
background: rgba(247, 244, 236, 0.91);
box-shadow: 0 18px 50px rgba(20, 35, 56, 0.16);
backdrop-filter: blur(18px);
}
.panel-header {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 12px;
margin-bottom: 18px;
}
.eyebrow {
color: #7a8189;
font-size: 10px;
font-weight: 800;
letter-spacing: 0.16em;
text-transform: uppercase;
}
h1 {
margin: 5px 0 0;
font-size: 23px;
line-height: 1.05;
letter-spacing: -0.04em;
}
.live {
display: inline-flex;
align-items: center;
gap: 6px;
flex: none;
padding: 6px 8px;
border-radius: 999px;
background: #e6eee7;
color: #356b4c;
font-size: 9px;
font-weight: 850;
letter-spacing: 0.11em;
text-transform: uppercase;
}
.live::before {
width: 6px;
height: 6px;
border-radius: 50%;
background: #47a36c;
content: "";
box-shadow: 0 0 0 4px rgba(71, 163, 108, 0.12);
}
.route-list {
display: grid;
gap: 9px;
}
.route-card {
--route: #3478e5;
position: relative;
display: grid;
grid-template-columns: 39px 1fr auto;
align-items: center;
gap: 11px;
width: 100%;
padding: 12px;
border: 1px solid #dedbd2;
border-radius: 15px;
background: rgba(255, 255, 255, 0.46);
color: var(--ink);
text-align: left;
cursor: pointer;
transition: border-color 160ms ease, background 160ms ease,
transform 160ms ease, box-shadow 160ms ease;
}
.route-card:hover {
transform: translateY(-1px);
border-color: color-mix(in srgb, var(--route) 55%, #d9d7cf);
background: #fffefb;
}
.route-card[aria-pressed="true"] {
border-color: var(--route);
background: var(--accent-soft);
box-shadow: inset 4px 0 0 var(--route), 0 6px 18px rgba(20, 35, 56, 0.07);
}
.route-icon {
display: grid;
width: 38px;
height: 38px;
place-items: center;
border-radius: 12px;
background: color-mix(in srgb, var(--route) 14%, white);
color: var(--route);
}
.route-icon.circle::before {
width: 17px;
height: 17px;
border-radius: 50%;
background: var(--route);
content: "";
}
.route-icon.square::before {
width: 17px;
height: 17px;
border-radius: 3px;
background: var(--route);
content: "";
}
.route-icon.triangle::before {
width: 0;
height: 0;
border-right: 10px solid transparent;
border-bottom: 18px solid var(--route);
border-left: 10px solid transparent;
content: "";
}
.route-name {
display: block;
font-size: 13px;
font-weight: 820;
}
.route-detail {
display: block;
margin-top: 3px;
color: #737a83;
font-size: 10px;
line-height: 1.25;
}
.route-time {
color: #737a83;
font-size: 10px;
font-variant-numeric: tabular-nums;
font-weight: 750;
}
.panel-actions {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 8px;
margin-top: 13px;
}
.action {
min-height: 39px;
padding: 9px 10px;
border: 0;
border-radius: 11px;
background: var(--ink);
color: white;
font-size: 10px;
font-weight: 800;
letter-spacing: 0.06em;
text-transform: uppercase;
cursor: pointer;
transition: transform 150ms ease, background 150ms ease;
}
.action:hover {
transform: translateY(-1px);
background: #223650;
}
.action.secondary {
border: 1px solid #d8d5cd;
background: rgba(255, 255, 255, 0.6);
color: #3e4854;
}
.action.secondary:hover {
background: white;
}
.panel-note {
margin: 16px 0 0;
padding-top: 14px;
border-top: 1px solid #dedbd2;
color: #777e86;
font-size: 10px;
line-height: 1.55;
}
.panel-note strong {
color: #4b5560;
}
.caption {
--accent: #3478e5;
position: fixed;
z-index: 5;
right: 360px;
bottom: 24px;
left: 26px;
display: grid;
grid-template-columns: 56px 1fr auto;
align-items: center;
gap: 15px;
max-width: 920px;
min-height: 88px;
padding: 14px 18px 14px 14px;
border: 1px solid rgba(255, 255, 255, 0.74);
border-radius: 20px;
background: rgba(20, 35, 56, 0.94);
color: white;
box-shadow: 0 17px 44px rgba(20, 35, 56, 0.24);
backdrop-filter: blur(16px);
}
.caption-icon {
display: grid;
width: 56px;
height: 56px;
place-items: center;
border-radius: 16px;
background: color-mix(in srgb, var(--accent) 23%, transparent);
color: var(--accent);
border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
}
.caption-icon.circle::before {
width: 21px;
height: 21px;
border-radius: 50%;
background: var(--accent);
content: "";
}
.caption-icon.square::before {
width: 21px;
height: 21px;
border-radius: 3px;
background: var(--accent);
content: "";
}
.caption-icon.triangle::before {
width: 0;
height: 0;
border-right: 12px solid transparent;
border-bottom: 22px solid var(--accent);
border-left: 12px solid transparent;
content: "";
}
.caption-kicker {
color: var(--accent);
font-size: 9px;
font-weight: 850;
letter-spacing: 0.16em;
text-transform: uppercase;
}
.caption-text {
margin-top: 4px;
font-size: clamp(13px, 1.3vw, 17px);
font-weight: 650;
line-height: 1.35;
}
.caption-platform {
align-self: stretch;
display: grid;
min-width: 84px;
place-items: center;
padding-left: 14px;
border-left: 1px solid rgba(255, 255, 255, 0.14);
color: #bcc7d4;
font-size: 9px;
line-height: 1.45;
letter-spacing: 0.1em;
text-align: center;
text-transform: uppercase;
}
.caption-platform strong {
display: block;
color: white;
font-size: 19px;
letter-spacing: -0.03em;
}
#loading {
position: fixed;
z-index: 20;
inset: 0;
display: grid;
place-items: center;
background: #e8e3d8;
color: var(--ink);
font-size: 12px;
font-weight: 800;
letter-spacing: 0.12em;
text-transform: uppercase;
transition: opacity 350ms ease;
}
#loading.hidden {
opacity: 0;
pointer-events: none;
}
@media (max-width: 900px) {
.brand {
top: 13px;
left: 13px;
}
.brand-copy {
padding: 8px 10px;
}
.brand-copy span {
display: none;
}
.panel {
top: auto;
right: 12px;
bottom: 12px;
width: min(290px, calc(100vw - 24px));
max-height: 43vh;
padding: 15px;
border-radius: 18px;
}
.panel-header {
margin-bottom: 11px;
}
h1 {
font-size: 19px;
}
.route-card {
padding: 9px;
}
.panel-note {
display: none;
}
.caption {
right: 12px;
bottom: auto;
left: 12px;
top: 76px;
grid-template-columns: 42px 1fr;
gap: 10px;
min-height: 74px;
padding: 10px;
border-radius: 16px;
}
.caption-icon {
width: 42px;
height: 42px;
border-radius: 12px;
}
.caption-platform {
display: none;
}
.caption-text {
font-size: 12px;
}
}
@media (prefers-reduced-motion: reduce) {
*,
*::before,
*::after {
scroll-behavior: auto !important;
transition-duration: 0.01ms !important;
}
}
</style>
</head>
<body>
<div id="scene"></div>
<header class="brand" aria-label="North Terminal">
<div class="brand-mark">NT</div>
<div class="brand-copy">
<strong>North Terminal</strong>
<span>Public information · Concourse 04</span>
</div>
</header>
<aside class="panel" aria-label="Departure announcement controls">
<div class="panel-header">
<div>
<div class="eyebrow">Live departures</div>
<h1>Choose an announcement</h1>
</div>
<div class="live">Live</div>
</div>
<div class="route-list">
<button class="route-card" data-route="A" aria-pressed="false">
<span class="route-icon circle" aria-hidden="true"></span>
<span>
<span class="route-name">Gate A</span>
<span class="route-detail">Coral circle · Platform 2</span>
</span>
<span class="route-time">08:40</span>
</button>
<button class="route-card" data-route="B" aria-pressed="true">
<span class="route-icon square" aria-hidden="true"></span>
<span>
<span class="route-name">Gate B</span>
<span class="route-detail">Blue square · Platform 5</span>
</span>
<span class="route-time">08:45</span>
</button>
<button class="route-card" data-route="C" aria-pressed="false">
<span class="route-icon triangle" aria-hidden="true"></span>
<span>
<span class="route-name">Gate C</span>
<span class="route-detail">Amber triangle · Platform 8</span>
</span>
<span class="route-time">08:55</span>
</button>
</div>
<div class="panel-actions">
<button class="action" id="nextAnnouncement">Next announcement</button>
<button class="action secondary" id="replayAnnouncement">Replay response</button>
</div>
<p class="panel-note">
<strong>Controls:</strong> drag to orbit, scroll or pinch to zoom, and click a
gate display to select it. Passengers carrying the matching symbol will
proceed along the illuminated floor route.
</p>
</aside>
<section class="caption" id="caption" aria-live="polite" aria-atomic="true">
<div class="caption-icon square" id="captionIcon" aria-hidden="true"></div>
<div>
<div class="caption-kicker" id="captionKicker">Public announcement · Gate B</div>
<div class="caption-text" id="captionText">
Blue square passengers, please proceed to Gate B. The blue route is illuminated.
</div>
</div>
<div class="caption-platform">
Platform
<strong id="captionPlatform">5</strong>
</div>
</section>
<div id="loading">Preparing the terminal…</div>
<script type="module">
import * as THREE from "https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
// -------------------------------------------------------------------------
// Scene setup
// -------------------------------------------------------------------------
const sceneHost = document.getElementById("scene");
const loading = document.getElementById("loading");
const scene = new THREE.Scene();
scene.background = new THREE.Color("#d8d3c8");
scene.fog = new THREE.Fog("#d8d3c8", 38, 68);
const renderer = new THREE.WebGLRenderer({ antialias: true });
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1.08;
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
sceneHost.appendChild(renderer.domElement);
renderer.domElement.tabIndex = 0;
renderer.domElement.setAttribute(
"aria-label",
"Interactive three-dimensional waiting room. Drag to orbit and scroll to zoom."
);
const camera = new THREE.PerspectiveCamera(
39,
window.innerWidth / window.innerHeight,
0.1,
120
);
const cameraTarget = new THREE.Vector3(0, 1.3, -0.8);
const cameraState = {
radius: 36,
theta: 0.56,
phi: 0.79
};
function updateCamera() {
const { radius, theta, phi } = cameraState;
camera.position.set(
cameraTarget.x + radius * Math.sin(phi) * Math.sin(theta),
cameraTarget.y + radius * Math.cos(phi),
cameraTarget.z + radius * Math.sin(phi) * Math.cos(theta)
);
camera.lookAt(cameraTarget);
}
updateCamera();
const hemisphere = new THREE.HemisphereLight("#fff8e8", "#8b958f", 2.15);
scene.add(hemisphere);
const sun = new THREE.DirectionalLight("#fff4d8", 3.15);
sun.position.set(-13, 23, 15);
sun.castShadow = true;
sun.shadow.mapSize.set(2048, 2048);
sun.shadow.camera.left = -22;
sun.shadow.camera.right = 22;
sun.shadow.camera.top = 20;
sun.shadow.camera.bottom = -18;
sun.shadow.camera.near = 1;
sun.shadow.camera.far = 60;
sun.shadow.bias = -0.00035;
scene.add(sun);
const fill = new THREE.DirectionalLight("#bcd5ff", 0.8);
fill.position.set(16, 10, -12);
scene.add(fill);
// -------------------------------------------------------------------------
// Shared materials
// -------------------------------------------------------------------------
const materials = {
floor: new THREE.MeshStandardMaterial({ color: "#d8d0bf", roughness: 0.92 }),
wall: new THREE.MeshStandardMaterial({ color: "#e7e6dc", roughness: 0.88 }),
wallLower: new THREE.MeshStandardMaterial({ color: "#b8c6bc", roughness: 0.85 }),
beam: new THREE.MeshStandardMaterial({ color: "#9ba9a2", roughness: 0.78 }),
wood: new THREE.MeshStandardMaterial({ color: "#ba8255", roughness: 0.76 }),
woodDark: new THREE.MeshStandardMaterial({ color: "#78563e", roughness: 0.8 }),
metal: new THREE.MeshStandardMaterial({ color: "#52616d", roughness: 0.48, metalness: 0.18 }),
dark: new THREE.MeshStandardMaterial({ color: "#17283c", roughness: 0.56 }),
door: new THREE.MeshStandardMaterial({ color: "#344758", roughness: 0.56 }),
recess: new THREE.MeshStandardMaterial({ color: "#101b28", roughness: 0.82 }),
cream: new THREE.MeshStandardMaterial({ color: "#f1eadb", roughness: 0.8 }),
green: new THREE.MeshStandardMaterial({ color: "#6e8f79", roughness: 0.86 })
};
function box(width, height, depth, material, x = 0, y = 0, z = 0, parent = scene) {
const mesh = new THREE.Mesh(
new THREE.BoxGeometry(width, height, depth),
material
);
mesh.position.set(x, y, z);
mesh.castShadow = true;
mesh.receiveShadow = true;
parent.add(mesh);
return mesh;
}
function cylinder(radiusTop, radiusBottom, height, material, x = 0, y = 0, z = 0, parent = scene, segments = 16) {
const mesh = new THREE.Mesh(
new THREE.CylinderGeometry(radiusTop, radiusBottom, height, segments),
material
);
mesh.position.set(x, y, z);
mesh.castShadow = true;
mesh.receiveShadow = true;
parent.add(mesh);
return mesh;
}
function sphere(radius, material, x = 0, y = 0, z = 0, parent = scene) {
const mesh = new THREE.Mesh(
new THREE.SphereGeometry(radius, 18, 12),
material
);
mesh.position.set(x, y, z);
mesh.castShadow = true;
mesh.receiveShadow = true;
parent.add(mesh);
return mesh;
}
// -------------------------------------------------------------------------
// Waiting-room architecture
// -------------------------------------------------------------------------
box(30, 0.32, 22, materials.floor, 0, -0.18, 0);
box(30, 7.3, 0.35, materials.wall, 0, 3.55, -9.6);
box(30, 1.55, 0.42, materials.wallLower, 0, 0.62, -9.36);
// Ceiling beams and columns.
box(29, 0.25, 0.4, materials.beam, 0, 7.25, -6.8);
box(29, 0.25, 0.4, materials.beam, 0, 7.25, 1.5);
[-13.2, 13.2].forEach((x) => {
cylinder(0.23, 0.3, 7.1, materials.beam, x, 3.45, -8.95, scene, 12);
});
// Subtle floor tile joints.
const tileVertices = [];
for (let x = -14; x <= 14; x += 2) {
tileVertices.push(x, 0.005, -10, x, 0.005, 10);
}
for (let z = -10; z <= 10; z += 2) {
tileVertices.push(-14, 0.005, z, 14, 0.005, z);
}
const tileGeometry = new THREE.BufferGeometry();
tileGeometry.setAttribute(
"position",
new THREE.Float32BufferAttribute(tileVertices, 3)
);
const tileLines = new THREE.LineSegments(
tileGeometry,
new THREE.LineBasicMaterial({
color: "#8e948e",
transparent: true,
opacity: 0.16
})
);
scene.add(tileLines);
// Waiting area marker.
const waitingRing = new THREE.Mesh(
new THREE.RingGeometry(1.65, 1.72, 64),
new THREE.MeshBasicMaterial({
color: "#7e8f89",
transparent: true,
opacity: 0.34,
side: THREE.DoubleSide
})
);
waitingRing.rotation.x = -Math.PI / 2;
waitingRing.position.set(0, 0.025, 5.1);
scene.add(waitingRing);
function makeBench(x, z, rotation = 0) {
const group = new THREE.Group();
group.position.set(x, 0, z);
group.rotation.y = rotation;
scene.add(group);
box(4.65, 0.17, 0.92, materials.wood, 0, 0.73, 0, group);
box(4.65, 0.72, 0.14, materials.wood, 0, 1.11, -0.39, group);
[-1.75, 1.75].forEach((legX) => {
box(0.18, 0.72, 0.65, materials.metal, legX, 0.34, 0, group);
});
box(0.12, 0.62, 0.12, materials.metal, 0, 0.89, -0.39, group);
return group;
}
makeBench(-6.3, 1.25);
makeBench(6.3, 1.25);
makeBench(-6.3, 5.4);
makeBench(6.3, 5.4);
function makePlanter(x, z) {
cylinder(0.58, 0.43, 0.75, materials.cream, x, 0.36, z);
cylinder(0.07, 0.1, 1.7, materials.woodDark, x, 1.25, z);
const leafMaterial = new THREE.MeshStandardMaterial({
color: "#5f8569",
roughness: 0.88
});
const leaf1 = sphere(0.65, leafMaterial, x, 2.05, z);
leaf1.scale.set(0.75, 1.15, 0.75);
const leaf2 = sphere(0.5, leafMaterial, x + 0.35, 1.75, z + 0.08);
leaf2.scale.set(0.65, 1.0, 0.65);
const leaf3 = sphere(0.5, leafMaterial, x - 0.34, 1.75, z - 0.05);
leaf3.scale.set(0.65, 1.0, 0.65);
}
makePlanter(-12.5, -5.9);
makePlanter(12.5, -5.9);
// -------------------------------------------------------------------------
// Canvas-based display textures
// -------------------------------------------------------------------------
function createDisplayTexture(width, height) {
const canvas = document.createElement("canvas");
canvas.width = width;
canvas.height = height;
const context = canvas.getContext("2d");
const texture = new THREE.CanvasTexture(canvas);
texture.colorSpace = THREE.SRGBColorSpace;
texture.anisotropy = Math.min(8, renderer.capabilities.getMaxAnisotropy());
return { canvas, context, texture };
}
function drawSymbol(context, symbol, x, y, size, color) {
context.save();
context.fillStyle = color;
context.strokeStyle = color;
context.lineWidth = Math.max(4, size * 0.12);
context.lineJoin = "round";
if (symbol === "circle") {
context.beginPath();
context.arc(x, y, size * 0.5, 0, Math.PI * 2);
context.fill();
} else if (symbol === "square") {
const half = size * 0.43;
context.beginPath();
context.roundRect(x - half, y - half, half * 2, half * 2, size * 0.09);
context.fill();
} else {
context.beginPath();
context.moveTo(x, y - size * 0.55);
context.lineTo(x - size * 0.52, y + size * 0.48);
context.lineTo(x + size * 0.52, y + size * 0.48);
context.closePath();
context.fill();
}
context.restore();
}
function makePanel(width, height, position, route = null, pickable = false) {
const group = new THREE.Group();
group.position.copy(position);
scene.add(group);
const frame = new THREE.Mesh(
new THREE.BoxGeometry(width + 0.18, height + 0.18, 0.18),
materials.metal
);
frame.castShadow = true;
group.add(frame);
const display = createDisplayTexture(1024, 512);
const plane = new THREE.Mesh(
new THREE.PlaneGeometry(width, height),
new THREE.MeshBasicMaterial({ map: display.texture })
);
plane.position.z = 0.101;
group.add(plane);
if (route && pickable) {
plane.userData.route = route;
pickables.push(plane);
}
return { group, ...display, plane };
}
const pickables = [];
// -------------------------------------------------------------------------
// Routes, gates, and platform doors
// -------------------------------------------------------------------------
const routes = {
A: {
id: "A",
gate: "Gate A",
platform: "2",
time: "08:40",
symbol: "circle",
color: "#ed6a61",
caption:
"Coral circle passengers, please proceed to Gate A. The coral route is illuminated."
},
B: {
id: "B",
gate: "Gate B",
platform: "5",
time: "08:45",
symbol: "square",
color: "#3478e5",
caption:
"Blue square passengers, please proceed to Gate B. The blue route is illuminated."
},
C: {
id: "C",
gate: "Gate C",
platform: "8",
time: "08:55",
symbol: "triangle",
color: "#eeb43b",
caption:
"Amber triangle passengers, please proceed to Gate C. The amber route is illuminated."
}
};
const gateX = { A: -8, B: 0, C: 8 };
const routeCurves = {};
const selectedRouteGroups = {};
const selectedMaterials = {};
const doors = {};
Object.entries(routes).forEach(([id, route]) => {
const curve = new THREE.CatmullRomCurve3(
[
new THREE.Vector3(id === "A" ? -1.7 : id === "B" ? 0.15 : 1.9, 0.065, 5.15),
new THREE.Vector3(id === "A" ? -2.2 : id === "B" ? 0 : 2.25, 0.065, 2.65),
new THREE.Vector3(id === "A" ? -5.1 : id === "B" ? 0 : 5.1, 0.065, 0.1),
new THREE.Vector3(gateX[id], 0.065, -4.9),
new THREE.Vector3(gateX[id], 0.065, -8.05)
],
false,
"catmullrom",
0.45
);
routeCurves[id] = curve;
const underlay = new THREE.Mesh(
new THREE.TubeGeometry(curve, 100, 0.045, 6, false),
new THREE.MeshBasicMaterial({
color: route.color,
transparent: true,
opacity: 0.16,
depthWrite: false
})
);
scene.add(underlay);
const selectedGroup = new THREE.Group();
scene.add(selectedGroup);
const pathMaterial = new THREE.MeshStandardMaterial({
color: route.color,
emissive: route.color,
emissiveIntensity: 0.48,
roughness: 0.36,
transparent: true,
opacity: 0.98
});
selectedMaterials[id] = pathMaterial;
const haloMaterial = new THREE.MeshBasicMaterial({
color: route.color,
transparent: true,
opacity: 0.16,
depthWrite: false
});
const halo = new THREE.Mesh(
new THREE.TubeGeometry(curve, 100, 0.22, 8, false),
haloMaterial
);
selectedGroup.add(halo);
const tube = new THREE.Mesh(
new THREE.TubeGeometry(curve, 120, 0.095, 8, false),
pathMaterial
);
tube.receiveShadow = true;
selectedGroup.add(tube);
const arrowGeometry = new THREE.ConeGeometry(0.19, 0.44, 3);
arrowGeometry.rotateX(Math.PI / 2);
const arrowMaterial = new THREE.MeshBasicMaterial({ color: "#ffffff" });
for (let t = 0.08; t < 0.97; t += 0.115) {
const point = curve.getPointAt(t);
const tangent = curve.getTangentAt(t);
const arrow = new THREE.Mesh(arrowGeometry, arrowMaterial);
arrow.position.copy(point);
arrow.position.y = 0.13;
arrow.scale.set(1, 0.07, 1);
arrow.rotation.y = Math.atan2(tangent.x, tangent.z);
selectedGroup.add(arrow);
}
const startMarker = new THREE.Mesh(
new THREE.RingGeometry(0.48, 0.66, 32),
new THREE.MeshBasicMaterial({
color: route.color,
side: THREE.DoubleSide
})
);
startMarker.rotation.x = -Math.PI / 2;
startMarker.position.copy(curve.getPointAt(0));
startMarker.position.y = 0.035;
selectedGroup.add(startMarker);
selectedRouteGroups[id] = selectedGroup;
});
function drawGateDisplay(display, route, active) {
const ctx = display.context;
const width = display.canvas.width;
const height = display.canvas.height;
ctx.clearRect(0, 0, width, height);
ctx.fillStyle = "#142338";
ctx.fillRect(0, 0, width, height);
ctx.fillStyle = route.color;
ctx.fillRect(0, 0, 20, height);
ctx.fillStyle = "#9cabb9";
ctx.font = "700 31px Arial, sans-serif";
ctx.textAlign = "left";
ctx.textBaseline = "alphabetic";
ctx.fillText(active ? "BOARDING NOW" : "DEPARTURE", 58, 58);
ctx.fillStyle = "#ffffff";
ctx.font = "800 82px Arial, sans-serif";
ctx.fillText(route.gate.toUpperCase(), 55, 156);
ctx.fillStyle = active ? route.color : "#d7dfe6";
ctx.font = "650 40px Arial, sans-serif";
ctx.fillText(
`${route.time} · PLATFORM ${route.platform}`,
58,
224
);
drawSymbol(ctx, route.symbol, width - 102, 112, 108, route.color);
display.texture.needsUpdate = true;
}
Object.entries(routes).forEach(([id, route]) => {
const x = gateX[id];
const doorGroup = new THREE.Group();
doorGroup.position.set(x, 0, -9.14);
scene.add(doorGroup);
box(3.65, 4.9, 0.18, materials.recess, 0, 2.4, 0, doorGroup);
box(0.22, 5.08, 0.36, materials.metal, -1.78, 2.45, 0.08, doorGroup);
box(0.22, 5.08, 0.36, materials.metal, 1.78, 2.45, 0.08, doorGroup);
box(3.78, 0.26, 0.36, materials.metal, 0, 4.92, 0.08, doorGroup);
const leftPanel = box(1.55, 4.62, 0.16, materials.door, -0.79, 2.32, 0.13, doorGroup);
const rightPanel = box(1.55, 4.62, 0.16, materials.door, 0.79, 2.32, 0.13, doorGroup);
const accentMaterial = new THREE.MeshBasicMaterial({ color: route.color });
box(0.12, 3.5, 0.035, accentMaterial, -0.16, 2.4, 0.225, leftPanel);
box(0.12, 3.5, 0.035, accentMaterial, 0.16, 2.4, 0.225, rightPanel);
const platformGlow = box(
3.3,
0.12,
0.05,
new THREE.MeshBasicMaterial({ color: route.color }),
0,
0.08,
0.16,
doorGroup
);
doors[id] = {
group: doorGroup,
leftPanel,
rightPanel,
open: 0,
targetOpen: 0
};
const gateDisplay = makePanel(
3.55,
1.55,
new THREE.Vector3(x, 5.55, -8.94),
id,
true
);
drawGateDisplay(gateDisplay, route, false);
doors[id].display = gateDisplay;
});
// Central public announcement display.
const announcementDisplay = makePanel(
12.8,
3.05,
new THREE.Vector3(0, 6.35, -4.55)
);
[-4.35, 4.35].forEach((x) => {
cylinder(0.045, 0.045, 1.4, materials.metal, x, 8.05, -4.55, scene, 10);
});
function drawAnnouncementDisplay(route) {
const ctx = announcementDisplay.context;
const width = announcementDisplay.canvas.width;
const height = announcementDisplay.canvas.height;
ctx.clearRect(0, 0, width, height);
ctx.fillStyle = "#142338";
ctx.fillRect(0, 0, width, height);
ctx.fillStyle = route.color;
ctx.fillRect(0, 0, 22, height);
ctx.fillStyle = route.color;
ctx.font = "800 29px Arial, sans-serif";
ctx.textAlign = "left";
ctx.fillText("PUBLIC ANNOUNCEMENT • LIVE", 62, 58);
ctx.fillStyle = "#ffffff";
ctx.font = "850 82px Arial, sans-serif";
ctx.fillText(`${route.gate.toUpperCase()} / ${route.symbol.toUpperCase()}`, 58, 159);
ctx.fillStyle = "#cbd4dd";
ctx.font = "500 35px Arial, sans-serif";
ctx.fillText(
`Matching passengers may now proceed to Platform ${route.platform}`,
62,
222
);
ctx.fillStyle = "#8796a7";
ctx.font = "500 26px Arial, sans-serif";
ctx.fillText(
"Please follow the illuminated floor route.",
62,
275
);
drawSymbol(ctx, route.symbol, width - 130, 130, 150, route.color);
announcementDisplay.texture.needsUpdate = true;
}
// -------------------------------------------------------------------------
// Stylized visitors
// -------------------------------------------------------------------------
const visitors = [];
const skinMaterials = [
new THREE.MeshStandardMaterial({ color: "#dca782", roughness: 0.86 }),
new THREE.MeshStandardMaterial({ color: "#a86e4e", roughness: 0.86 }),
new THREE.MeshStandardMaterial({ color: "#efbea0", roughness: 0.86 }),
new THREE.MeshStandardMaterial({ color: "#7d513b", roughness: 0.86 })
];
const shirtMaterials = [
new THREE.MeshStandardMaterial({ color: "#718c78", roughness: 0.9 }),
new THREE.MeshStandardMaterial({ color: "#c87962", roughness: 0.9 }),
new THREE.MeshStandardMaterial({ color: "#748aa7", roughness: 0.9 }),
new THREE.MeshStandardMaterial({ color: "#d1b268", roughness: 0.9 })
];
const trouserMaterial = new THREE.MeshStandardMaterial({
color: "#334252",
roughness: 0.9
});
function makeToken(symbol, color) {
const group = new THREE.Group();
const material = new THREE.MeshBasicMaterial({ color, side: THREE.DoubleSide });
let geometry;
if (symbol === "circle") {
geometry = new THREE.CircleGeometry(0.19, 32);
} else if (symbol === "square") {
geometry = new THREE.PlaneGeometry(0.33, 0.33);
} else {
const shape = new THREE.Shape();
shape.moveTo(0, 0.2);
shape.lineTo(-0.18, -0.14);
shape.lineTo(0.18, -0.14);
shape.closePath();
geometry = new THREE.ShapeGeometry(shape);
}
const token = new THREE.Mesh(geometry, material);
group.add(token);
return group;
}
function createVisitor(routeId, index, waitingPosition) {
const route = routes[routeId];
const group = new THREE.Group();
group.position.copy(waitingPosition);
scene.add(group);
const skin = skinMaterials[index % skinMaterials.length];
const shirt = shirtMaterials[index % shirtMaterials.length];
const torso = cylinder(
0.25,
0.32,
0.7,
shirt,
0,
1.05,
0,
group,
12
);
const head = sphere(0.245, skin, 0, 1.62, 0, group);
head.scale.set(0.95, 1.07, 0.95);
cylinder(0.075, 0.08, 0.65, trouserMaterial, -0.13, 0.36, 0, group, 10);
cylinder(0.075, 0.08, 0.65, trouserMaterial, 0.13, 0.36, 0, group, 10);
const leftArm = cylinder(0.065, 0.075, 0.66, shirt, -0.32, 1.04, 0, group, 10);
const rightArm = cylinder(0.065, 0.075, 0.66, shirt, 0.32, 1.04, 0, group, 10);
leftArm.rotation.z = -0.08;
rightArm.rotation.z = 0.08;
const token = makeToken(route.symbol, route.color);
token.position.set(0, 1.1, 0.27);
group.add(token);
const shadow = new THREE.Mesh(
new THREE.CircleGeometry(0.34, 24),
new THREE.MeshBasicMaterial({
color: "#26313b",
transparent: true,
opacity: 0.15,
depthWrite: false
})
);
shadow.rotation.x = -Math.PI / 2;
shadow.position.y = 0.015;
group.add(shadow);
visitors.push({
routeId,
group,
torso,
head,
leftArm,
rightArm,
waitingPosition: waitingPosition.clone(),
path: null,
progress: 0,
state: "waiting",
boardingTime: 0,
phase: index * 1.37
});
}
createVisitor("A", 0, new THREE.Vector3(-2.1, 0, 4.8));
createVisitor("A", 1, new THREE.Vector3(-2.9, 0, 5.65));
createVisitor("B", 2, new THREE.Vector3(-0.45, 0, 4.85));
createVisitor("B", 3, new THREE.Vector3(0.78, 0, 5.63));
createVisitor("C", 4, new THREE.Vector3(2.0, 0, 4.82));
createVisitor("C", 5, new THREE.Vector3(3.0, 0, 5.66));
// A few static seated-looking passengers add life to the concourse.
const seatedVisitors = [
[-7.6, 1.25, "#7d6b93"],
[6.9, 5.4, "#4f7e78"],
[-5.4, 5.4, "#bb795d"]
];
seatedVisitors.forEach(([x, z, color], index) => {
const person = new THREE.Group();
person.position.set(x, 0, z);
scene.add(person);
const shirt = new THREE.MeshStandardMaterial({ color, roughness: 0.9 });
const skin = skinMaterials[(index + 1) % skinMaterials.length];
cylinder(0.23, 0.29, 0.64, shirt, 0, 1.02, 0, person, 12);
sphere(0.23, skin, 0, 1.52, 0, person);
cylinder(0.07, 0.08, 0.6, trouserMaterial, -0.12, 0.38, 0.15, person, 10);
cylinder(0.07, 0.08, 0.6, trouserMaterial, 0.12, 0.38, 0.15, person, 10);
});
// -------------------------------------------------------------------------
// Announcement selection and visitor responses
// -------------------------------------------------------------------------
const routeButtons = [...document.querySelectorAll(".route-card")];
const caption = document.getElementById("caption");
const captionIcon = document.getElementById("captionIcon");
const captionKicker = document.getElementById("captionKicker");
const captionText = document.getElementById("captionText");
const captionPlatform = document.getElementById("captionPlatform");
let activeRoute = "B";
const routeOrder = ["A", "B", "C"];
function setCaption(route) {
document.documentElement.style.setProperty("--accent", route.color);
document.documentElement.style.setProperty(
"--accent-soft",
`${route.color}24`
);
captionIcon.className = `caption-icon ${route.symbol}`;
captionKicker.textContent = `Public announcement · ${route.gate}`;
captionText.textContent = route.caption;
captionPlatform.textContent = route.platform;
}
function respondToAnnouncement(routeId) {
visitors.forEach((visitor) => {
if (visitor.routeId !== routeId) return;
visitor.group.visible = true;
visitor.group.position.copy(visitor.waitingPosition);
visitor.progress = 0;
visitor.state = "walking";
visitor.boardingTime = 0;
const routeCurve = routeCurves[routeId];
visitor.path = new THREE.CatmullRomCurve3([
visitor.waitingPosition.clone(),
routeCurve.getPointAt(0.18).clone(),
routeCurve.getPointAt(0.48).clone(),
routeCurve.getPointAt(0.78).clone(),
routeCurve.getPointAt(1).clone()
]);
});
}
function selectRoute(routeId, announce = true) {
activeRoute = routeId;
const route = routes[routeId];
Object.entries(selectedRouteGroups).forEach(([id, group]) => {
group.visible = id === routeId;
});
Object.entries(doors).forEach(([id, door]) => {
door.targetOpen = id === routeId ? 1 : 0;
drawGateDisplay(door.display, route, id === routeId);
});
routeButtons.forEach((button) => {
button.setAttribute(
"aria-pressed",
String(button.dataset.route === routeId)
);
});
drawAnnouncementDisplay(route);
setCaption(route);
if (announce) {
respondToAnnouncement(routeId);
}
}
routeButtons.forEach((button) => {
button.addEventListener("click", () => {
selectRoute(button.dataset.route);
});
});
document.getElementById("nextAnnouncement").addEventListener("click", () => {
const nextIndex = (routeOrder.indexOf(activeRoute) + 1) % routeOrder.length;
selectRoute(routeOrder[nextIndex]);
});
document.getElementById("replayAnnouncement").addEventListener("click", () => {
selectRoute(activeRoute);
});
// -------------------------------------------------------------------------
// Custom camera controls — no addon imports
// -------------------------------------------------------------------------
const pointer = {
active: false,
moved: false,
id: null,
x: 0,
y: 0
};
const activePointers = new Map();
let pinchDistance = 0;
renderer.domElement.addEventListener("pointerdown", (event) => {
activePointers.set(event.pointerId, {
x: event.clientX,
y: event.clientY
});
if (activePointers.size === 1) {
pointer.active = true;
pointer.moved = false;
pointer.id = event.pointerId;
pointer.x = event.clientX;
pointer.y = event.clientY;
renderer.domElement.setPointerCapture(event.pointerId);
} else if (activePointers.size === 2) {
const points = [...activePointers.values()];
pinchDistance = Math.hypot(
points[0].x - points[1].x,
points[0].y - points[1].y
);
}
});
renderer.domElement.addEventListener("pointermove", (event) => {
if (!activePointers.has(event.pointerId)) return;
activePointers.set(event.pointerId, {
x: event.clientX,
y: event.clientY
});
if (activePointers.size === 2) {
const points = [...activePointers.values()];
const distance = Math.hypot(
points[0].x - points[1].x,
points[0].y - points[1].y
);
if (pinchDistance > 0) {
cameraState.radius = THREE.MathUtils.clamp(
cameraState.radius - (distance - pinchDistance) * 0.025,
25,
47
);
updateCamera();
}
pinchDistance = distance;
pointer.moved = true;
return;
}
if (!pointer.active || event.pointerId !== pointer.id) return;
const dx = event.clientX - pointer.x;
const dy = event.clientY - pointer.y;
if (Math.abs(dx) + Math.abs(dy) > 3) {
pointer.moved = true;
}
cameraState.theta -= dx * 0.006;
cameraState.phi = THREE.MathUtils.clamp(
cameraState.phi - dy * 0.005,
0.48,
1.18
);
pointer.x = event.clientX;
pointer.y = event.clientY;
updateCamera();
});
renderer.domElement.addEventListener("pointerup", (event) => {
activePointers.delete(event.pointerId);
if (
pointer.active &&
pointer.id === event.pointerId &&
!pointer.moved
) {
pickScene(event);
}
if (activePointers.size < 2) {
pinchDistance = 0;
}
if (activePointers.size === 0) {
pointer.active = false;
pointer.id = null;
}
});
renderer.domElement.addEventListener("pointercancel", (event) => {
activePointers.delete(event.pointerId);
pointer.active = false;
pointer.id = null;
pinchDistance = 0;
});
renderer.domElement.addEventListener(
"wheel",
(event) => {
event.preventDefault();
cameraState.radius = THREE.MathUtils.clamp(
cameraState.radius + event.deltaY * 0.018,
25,
47
);
updateCamera();
},
{ passive: false }
);
renderer.domElement.addEventListener("keydown", (event) => {
if (event.key === "ArrowLeft") {
cameraState.theta -= 0.08;
} else if (event.key === "ArrowRight") {
cameraState.theta += 0.08;
} else if (event.key === "ArrowUp") {
cameraState.phi = Math.max(0.48, cameraState.phi - 0.06);
} else if (event.key === "ArrowDown") {
cameraState.phi = Math.min(1.18, cameraState.phi + 0.06);
} else if (event.key === "+" || event.key === "=") {
cameraState.radius = Math.max(25, cameraState.radius - 2);
} else if (event.key === "-") {
cameraState.radius = Math.min(47, cameraState.radius + 2);
} else {
return;
}
event.preventDefault();
updateCamera();
});
renderer.domElement.addEventListener("contextmenu", (event) => {
event.preventDefault();
});
const raycaster = new THREE.Raycaster();
const pointerNdc = new THREE.Vector2();
function pickScene(event) {
const rect = renderer.domElement.getBoundingClientRect();
pointerNdc.x = ((event.clientX - rect.left) / rect.width) * 2 - 1;
pointerNdc.y = -((event.clientY - rect.top) / rect.height) * 2 + 1;
raycaster.setFromCamera(pointerNdc, camera);
const intersections = raycaster.intersectObjects(pickables, false);
if (intersections.length) {
const routeId = intersections[0].object.userData.route;
if (routes[routeId]) {
selectRoute(routeId);
}
}
}
// -------------------------------------------------------------------------
// Animation
// -------------------------------------------------------------------------
const clock = new THREE.Clock();
let elapsed = 0;
function animate() {
requestAnimationFrame(animate);
const delta = Math.min(clock.getDelta(), 0.05);
elapsed += delta;
// The selected route gently pulses while remaining continuously visible.
selectedMaterials[activeRoute].emissiveIntensity =
0.42 + Math.sin(elapsed * 2.3) * 0.12;
// Platform doors slide open for the active announcement.
Object.entries(doors).forEach(([, door]) => {
door.open = THREE.MathUtils.damp(
door.open,
door.targetOpen,
4.8,
delta
);
const travel = door.open * 0.76;
door.leftPanel.position.x = -0.79 - travel;
door.rightPanel.position.x = 0.79 + travel;
});
// Matching visitors walk toward their gate.
visitors.forEach((visitor) => {
if (visitor.state === "walking" && visitor.path) {
visitor.progress = Math.min(
1,
visitor.progress + delta * 0.165
);
const position = visitor.path.getPointAt(visitor.progress);
const tangent = visitor.path.getTangentAt(visitor.progress);
visitor.group.position.x = position.x;
visitor.group.position.z = position.z;
visitor.group.position.y =
Math.abs(Math.sin(elapsed * 9 + visitor.phase)) * 0.025;
visitor.group.rotation.y = Math.atan2(tangent.x, tangent.z);
const swing = Math.sin(elapsed * 8.5 + visitor.phase) * 0.38;
visitor.leftArm.rotation.x = swing;
visitor.rightArm.rotation.x = -swing;
visitor.head.rotation.z = Math.sin(elapsed * 1.8 + visitor.phase) * 0.035;
if (visitor.progress >= 1) {
visitor.state = "boarding";
visitor.boardingTime = 0;
visitor.leftArm.rotation.x = 0;
visitor.rightArm.rotation.x = 0;
}
} else if (visitor.state === "boarding") {
visitor.boardingTime += delta;
visitor.group.position.y = Math.min(
visitor.boardingTime * 0.3,
0.4
);
if (visitor.boardingTime > 1.4) {
visitor.state = "gone";
visitor.group.visible = false;
}
} else {
visitor.leftArm.rotation.x = THREE.MathUtils.damp(
visitor.leftArm.rotation.x,
Math.sin(elapsed * 1.4 + visitor.phase) * 0.025,
4,
delta
);
visitor.rightArm.rotation.x = THREE.MathUtils.damp(
visitor.rightArm.rotation.x,
-Math.sin(elapsed * 1.4 + visitor.phase) * 0.025,
4,
delta
);
visitor.head.rotation.y = Math.sin(elapsed * 0.55 + visitor.phase) * 0.12;
}
});
renderer.render(scene, camera);
}
window.addEventListener("resize", () => {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.setSize(window.innerWidth, window.innerHeight);
});
// Begin with a live blue-square announcement.
selectRoute("B", false);
respondToAnnouncement("B");
animate();
requestAnimationFrame(() => {
loading.classList.add("hidden");
setTimeout(() => loading.remove(), 400);
});
</script>
</body>
</html>
```