Prompt specification
Build or customize the Three.js 3D scene "Rail platform clock and luggage trolley" 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: Rail platform clock and luggage trolley
Category: Art & Culture · Style: Procedural Solid / Shader 3D
License: MIT · Reference: https://three3d.app/scene/rail-platform-clock-and-luggage-trolley-x2593
Scene Description Prompt:
Please create one self-contained HTML file with Three.js from cdnjs showing a station clock and luggage trolley associated with migration to industrial towns. Build a period station clock beside a luggage trolley and platform edge. Show human-scale proportions and separate passenger belongings from freight-handling equipment. Stylized solid forms.
Working Three.js Starter (rail-platform-clock-and-luggage-trolley-x2593):
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>North Works Station — A Period Travel Scene</title>
<style>
:root {
--ink: #202b2d;
--paper: #efe5cd;
--brass: #b38a45;
--leather: #865039;
--steel: #687779;
}
* {
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: #c8c1af;
color: var(--ink);
font-family: Georgia, "Times New Roman", serif;
}
#scene {
position: fixed;
inset: 0;
}
canvas {
display: block;
touch-action: none;
}
.title-card {
position: fixed;
top: 24px;
left: 24px;
z-index: 10;
width: min(390px, calc(100vw - 48px));
padding: 18px 20px 17px;
border: 1px solid rgba(32, 43, 45, 0.25);
border-left: 5px solid var(--brass);
background: rgba(239, 229, 205, 0.92);
box-shadow: 0 14px 35px rgba(31, 38, 38, 0.18);
backdrop-filter: blur(8px);
}
.eyebrow {
margin-bottom: 7px;
color: #755b34;
font: 700 10px/1.2 Arial, sans-serif;
letter-spacing: 0.22em;
text-transform: uppercase;
}
h1 {
margin: 0 0 8px;
font-size: clamp(25px, 3vw, 36px);
font-weight: 600;
line-height: 1;
}
.title-card p {
margin: 0;
color: #485351;
font: 13px/1.5 Arial, sans-serif;
}
.legend {
position: fixed;
right: 24px;
bottom: 24px;
z-index: 10;
width: 255px;
padding: 15px 17px;
border: 1px solid rgba(32, 43, 45, 0.22);
background: rgba(239, 229, 205, 0.91);
box-shadow: 0 12px 30px rgba(31, 38, 38, 0.16);
backdrop-filter: blur(8px);
}
.legend strong {
display: block;
margin-bottom: 10px;
font: 700 10px/1.2 Arial, sans-serif;
letter-spacing: 0.17em;
text-transform: uppercase;
}
.legend-item {
display: flex;
align-items: center;
gap: 10px;
margin: 8px 0;
color: #46514f;
font: 12px/1.3 Arial, sans-serif;
}
.swatch {
width: 12px;
height: 12px;
flex: 0 0 12px;
border: 1px solid rgba(20, 30, 30, 0.25);
border-radius: 50%;
}
.swatch.clock {
background: #26393a;
}
.swatch.belongings {
background: var(--leather);
}
.swatch.freight {
background: var(--steel);
}
.swatch.person {
background: #496a6b;
}
.legend-note {
margin-top: 11px;
padding-top: 10px;
border-top: 1px solid rgba(32, 43, 45, 0.16);
color: #6d685d;
font: italic 11px/1.45 Georgia, serif;
}
.controls {
position: fixed;
top: 24px;
right: 24px;
z-index: 10;
display: flex;
align-items: center;
gap: 10px;
}
#reset {
padding: 10px 13px;
border: 1px solid rgba(32, 43, 45, 0.25);
background: rgba(239, 229, 205, 0.93);
color: var(--ink);
font: 700 10px/1 Arial, sans-serif;
letter-spacing: 0.12em;
text-transform: uppercase;
cursor: pointer;
box-shadow: 0 8px 18px rgba(31, 38, 38, 0.12);
}
#reset:hover {
background: #fff5dc;
}
.hint {
padding: 9px 11px;
background: rgba(32, 43, 45, 0.78);
color: #f4e9cf;
font: 10px/1 Arial, sans-serif;
letter-spacing: 0.06em;
}
#loading {
position: fixed;
inset: 0;
z-index: 30;
display: grid;
place-items: center;
background: #c8c1af;
color: #344241;
font: 700 11px/1 Arial, sans-serif;
letter-spacing: 0.2em;
text-transform: uppercase;
}
@media (max-width: 720px) {
.title-card {
top: 14px;
left: 14px;
width: min(330px, calc(100vw - 28px));
padding: 14px 16px;
}
.title-card p {
display: none;
}
.controls {
top: auto;
right: 14px;
bottom: 14px;
}
.legend {
right: auto;
left: 14px;
bottom: 14px;
width: 210px;
padding: 12px 14px;
}
.legend-note {
display: none;
}
.hint {
display: none;
}
}
</style>
</head>
<body>
<div id="scene"></div>
<section class="title-card" aria-label="Scene title">
<div class="eyebrow">Platform study · 1908</div>
<h1>North Works Station</h1>
<p>
A period station clock, a traveler’s luggage trolley, and the industrial
railway carrying families toward the works.
</p>
</section>
<div class="controls">
<div class="hint">Drag to orbit · Scroll to zoom</div>
<button id="reset" type="button">Reset view</button>
</div>
<aside class="legend" aria-label="Object key">
<strong>Object key</strong>
<div class="legend-item">
<span class="swatch clock"></span>
<span>Cast-iron station clock</span>
</div>
<div class="legend-item">
<span class="swatch belongings"></span>
<span>Passenger trolley and personal luggage</span>
</div>
<div class="legend-item">
<span class="swatch freight"></span>
<span>Separate steel freight-handling truck</span>
</div>
<div class="legend-item">
<span class="swatch person"></span>
<span>Traveler · approximately 1.75 m tall</span>
</div>
<div class="legend-note">
Warm leather and canvas identify the traveler’s belongings; cool steel,
larger wheels, and a stenciled works crate identify freight equipment.
</div>
</aside>
<div id="loading">Preparing North Works Station…</div>
<script type="module">
import * as THREE from
"https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
// ------------------------------------------------------------
// Renderer, scene, lighting
// ------------------------------------------------------------
const container = document.getElementById("scene");
const renderer = new THREE.WebGLRenderer({
antialias: true,
powerPreference: "high-performance"
});
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1.08;
renderer.domElement.setAttribute("aria-label", "Interactive Three.js station scene");
container.appendChild(renderer.domElement);
const scene = new THREE.Scene();
scene.background = new THREE.Color(0xc8c1af);
scene.fog = new THREE.Fog(0xc8c1af, 20, 54);
const camera = new THREE.PerspectiveCamera(
42,
window.innerWidth / window.innerHeight,
0.1,
100
);
const hemisphere = new THREE.HemisphereLight(0xf7efd6, 0x42413c, 2.15);
scene.add(hemisphere);
const keyLight = new THREE.DirectionalLight(0xffeed0, 3.8);
keyLight.position.set(-8, 13, 9);
keyLight.castShadow = true;
keyLight.shadow.mapSize.set(2048, 2048);
keyLight.shadow.camera.left = -18;
keyLight.shadow.camera.right = 18;
keyLight.shadow.camera.top = 15;
keyLight.shadow.camera.bottom = -15;
keyLight.shadow.camera.near = 1;
keyLight.shadow.camera.far = 42;
keyLight.shadow.bias = -0.00025;
scene.add(keyLight);
const coolFill = new THREE.DirectionalLight(0xaec7cf, 1.0);
coolFill.position.set(10, 7, -9);
scene.add(coolFill);
// ------------------------------------------------------------
// Geometry helpers
// ------------------------------------------------------------
function material(color, roughness = 0.78, metalness = 0) {
return new THREE.MeshStandardMaterial({
color,
roughness,
metalness
});
}
function addMesh(geometry, mat, parent = scene) {
const object = new THREE.Mesh(geometry, mat);
object.castShadow = true;
object.receiveShadow = true;
parent.add(object);
return object;
}
function box(parent, size, mat, position = [0, 0, 0], rotation = [0, 0, 0]) {
const object = addMesh(
new THREE.BoxGeometry(size[0], size[1], size[2]),
mat,
parent
);
object.position.set(...position);
object.rotation.set(...rotation);
return object;
}
function cylinder(
parent,
radiusTop,
radiusBottom,
height,
mat,
position = [0, 0, 0],
rotation = [0, 0, 0],
segments = 20
) {
const object = addMesh(
new THREE.CylinderGeometry(
radiusTop,
radiusBottom,
height,
segments
),
mat,
parent
);
object.position.set(...position);
object.rotation.set(...rotation);
return object;
}
function ball(parent, radius, mat, position = [0, 0, 0], scale = null) {
const object = addMesh(
new THREE.SphereGeometry(radius, 18, 12),
mat,
parent
);
object.position.set(...position);
if (scale) {
object.scale.set(...scale);
}
return object;
}
function torus(
parent,
radius,
tube,
mat,
position = [0, 0, 0],
rotation = [0, 0, 0]
) {
const object = addMesh(
new THREE.TorusGeometry(radius, tube, 10, 32),
mat,
parent
);
object.position.set(...position);
object.rotation.set(...rotation);
return object;
}
function tube(parent, start, end, radius, mat) {
const a = new THREE.Vector3(...start);
const b = new THREE.Vector3(...end);
const direction = new THREE.Vector3().subVectors(b, a);
const length = direction.length();
const object = addMesh(
new THREE.CylinderGeometry(radius, radius, length, 12),
mat,
parent
);
object.position.copy(a).add(b).multiplyScalar(0.5);
object.quaternion.setFromUnitVectors(
new THREE.Vector3(0, 1, 0),
direction.normalize()
);
return object;
}
function makeCanvasTexture(width, height, draw) {
const canvas = document.createElement("canvas");
canvas.width = width;
canvas.height = height;
const context = canvas.getContext("2d");
draw(context, width, height);
const texture = new THREE.CanvasTexture(canvas);
texture.colorSpace = THREE.SRGBColorSpace;
texture.anisotropy = Math.min(
4,
renderer.capabilities.getMaxAnisotropy()
);
return texture;
}
function signPlane(parent, width, height, texture, position) {
const mat = new THREE.MeshStandardMaterial({
map: texture,
roughness: 0.88,
metalness: 0
});
const plane = addMesh(
new THREE.PlaneGeometry(width, height),
mat,
parent
);
plane.position.set(...position);
plane.castShadow = false;
return plane;
}
// Shared palette
const M = {
platform: material(0x716b5f),
platformEdge: material(0x4a4a44),
pavingLine: material(0x4d4b44),
yellow: material(0xc4a45b, 0.72),
darkIron: material(0x263637, 0.55, 0.38),
blackIron: material(0x171d1e, 0.64, 0.25),
brass: material(0xb58a43, 0.42, 0.65),
oldBrass: material(0x8c692f, 0.55, 0.48),
wood: material(0x805235),
woodLight: material(0xa06e43),
woodDark: material(0x503725),
leather: material(0x7b4935),
leatherLight: material(0x965e3e),
navy: material(0x344d55),
canvas: material(0xb59b72),
kraft: material(0xaa8452),
steel: material(0x657274, 0.54, 0.55),
darkSteel: material(0x3e4d50, 0.6, 0.48),
rubber: material(0x202423, 0.92),
cream: material(0xe8d9b5),
red: material(0x873d30),
coat: material(0x49686a),
skin: material(0xba8b68),
hat: material(0x9b7545),
brick: material(0x79594a),
factory: material(0x77776f),
chimney: material(0x80675b),
smoke: material(0x9d9b91),
black: material(0x1d2424)
};
// ------------------------------------------------------------
// Platform, edge, tracks, and industrial backdrop
// ------------------------------------------------------------
const world = new THREE.Group();
scene.add(world);
const ground = box(
world,
[100, 0.25, 100],
material(0x8c8779),
[0, -0.79, 0]
);
ground.castShadow = false;
box(
world,
[26, 0.7, 11],
M.platform,
[0, -0.35, -1.5]
);
// Fine paving joints.
for (let x = -12; x <= 12; x += 2) {
const seam = box(
world,
[0.018, 0.012, 10.7],
M.pavingLine,
[x, 0.008, -1.5]
);
seam.castShadow = false;
}
for (let z = -6; z <= 3; z += 1.5) {
const seam = box(
world,
[25.7, 0.012, 0.018],
M.pavingLine,
[0, 0.009, z]
);
seam.castShadow = false;
}
// Platform coping and painted safety line.
box(
world,
[26.1, 0.18, 0.42],
M.platformEdge,
[0, -0.02, 3.78]
);
box(
world,
[25.6, 0.025, 0.10],
M.yellow,
[0, 0.025, 3.48]
);
for (let x = -12; x <= 12; x += 1) {
const joint = box(
world,
[0.028, 0.025, 0.37],
M.black,
[x, 0.03, 3.78]
);
joint.castShadow = false;
}
// Track bed in the foreground.
box(
world,
[44, 0.2, 6.4],
material(0x55554e),
[0, -0.67, 7.2]
);
for (let x = -20; x <= 20; x += 1.25) {
box(
world,
[0.23, 0.16, 3.05],
M.woodDark,
[x, -0.48, 7.25]
);
}
box(world, [44, 0.16, 0.12], M.darkSteel, [0, -0.33, 6.15]);
box(world, [44, 0.16, 0.12], M.darkSteel, [0, -0.33, 8.35]);
// Canopy at the rear of the platform.
const canopy = new THREE.Group();
world.add(canopy);
box(
canopy,
[25, 0.22, 3.4],
M.darkIron,
[0, 4.18, -5.45],
[-0.035, 0, 0]
);
box(
canopy,
[25, 0.13, 0.18],
M.oldBrass,
[0, 3.89, -3.8]
);
for (const x of [-9.5, -3.2, 3.2, 9.5]) {
cylinder(canopy, 0.11, 0.14, 3.85, M.darkIron, [x, 1.93, -5.85]);
cylinder(canopy, 0.24, 0.28, 0.14, M.darkIron, [x, 0.08, -5.85]);
cylinder(canopy, 0.19, 0.19, 0.13, M.oldBrass, [x, 0.42, -5.85]);
cylinder(canopy, 0.18, 0.18, 0.12, M.oldBrass, [x, 3.67, -5.85]);
tube(
canopy,
[x, 3.15, -5.85],
[x + (x < 0 ? 1.2 : -1.2), 3.88, -4.85],
0.045,
M.darkIron
);
}
// Station board.
const stationSignTexture = makeCanvasTexture(1024, 256, (ctx, w, h) => {
ctx.fillStyle = "#243c3d";
ctx.fillRect(0, 0, w, h);
ctx.strokeStyle = "#b89450";
ctx.lineWidth = 8;
ctx.strokeRect(14, 14, w - 28, h - 28);
ctx.textAlign = "center";
ctx.fillStyle = "#eadbb9";
ctx.font = "bold 76px Georgia";
ctx.fillText("NORTH WORKS", w / 2, 112);
ctx.fillStyle = "#c9b783";
ctx.font = "27px Arial";
ctx.fillText("PASSENGERS • FREIGHT • 1908", w / 2, 182);
});
signPlane(
canopy,
4.8,
1.2,
stationSignTexture,
[-6.2, 2.92, -4.03]
);
// Platform lamp.
const lamp = new THREE.Group();
lamp.position.set(-8.4, 0, 2.1);
world.add(lamp);
cylinder(lamp, 0.055, 0.09, 2.7, M.darkIron, [0, 1.35, 0]);
cylinder(lamp, 0.2, 0.25, 0.12, M.darkIron, [0, 0.07, 0]);
box(lamp, [0.34, 0.42, 0.34], M.darkIron, [0, 2.77, 0]);
const lanternMaterial = new THREE.MeshStandardMaterial({
color: 0xf2d58c,
emissive: 0xd29c37,
emissiveIntensity: 1.0,
roughness: 0.4
});
box(lamp, [0.26, 0.31, 0.26], lanternMaterial, [0, 2.77, 0]);
box(lamp, [0.46, 0.07, 0.46], M.darkIron, [0, 3.01, 0]);
// Distant factory district.
const factories = new THREE.Group();
factories.position.z = -16;
world.add(factories);
box(factories, [8, 3.6, 4], M.factory, [-10, 1.7, 0]);
box(factories, [6, 2.7, 3.5], M.brick, [-3, 1.25, -0.4]);
box(factories, [10, 4.3, 5], M.factory, [7, 2.05, 0.7]);
// Sawtooth factory roofs.
for (let i = 0; i < 4; i++) {
const roof = cylinder(
factories,
0,
2.15,
2.1,
M.darkSteel,
[-2.7 + i * 2.4, 4.7, 0.5],
[0, 0, 0],
4
);
roof.scale.z = 0.8;
}
cylinder(factories, 0.42, 0.55, 6.4, M.chimney, [10.2, 5.1, 0.1]);
cylinder(factories, 0.48, 0.48, 0.25, M.darkSteel, [10.2, 8.36, 0.1]);
const smokeMaterial = new THREE.MeshStandardMaterial({
color: 0xa3a197,
roughness: 1,
transparent: true,
opacity: 0.55
});
ball(factories, 0.75, smokeMaterial, [10.25, 8.9, 0.1], [1, 0.8, 0.8]);
ball(factories, 0.92, smokeMaterial, [10.65, 9.45, 0.1], [1, 0.8, 0.8]);
ball(factories, 1.15, smokeMaterial, [11.2, 10.05, 0.1], [1, 0.8, 0.8]);
// A simple water tower in the industrial skyline.
for (const x of [-8.5, -6.5]) {
cylinder(factories, 0.12, 0.16, 4.3, M.darkSteel, [x, 2.15, -2.2]);
}
cylinder(factories, 1.05, 1.05, 1.7, M.darkSteel, [-7.5, 4.9, -2.2]);
cylinder(factories, 0, 1.18, 0.55, M.darkSteel, [-7.5, 5.98, -2.2]);
// ------------------------------------------------------------
// Period station clock
// ------------------------------------------------------------
const clock = new THREE.Group();
clock.position.set(-3.75, 0, -1.15);
world.add(clock);
// Stepped cast-iron base.
cylinder(clock, 0.32, 0.39, 0.18, M.blackIron, [0, 0.09, 0]);
cylinder(clock, 0.25, 0.31, 0.16, M.darkIron, [0, 0.26, 0]);
cylinder(clock, 0.16, 0.23, 0.22, M.darkIron, [0, 0.43, 0]);
// Tall post and decorative collars.
cylinder(clock, 0.095, 0.12, 2.03, M.darkIron, [0, 1.47, 0]);
cylinder(clock, 0.15, 0.15, 0.08, M.oldBrass, [0, 0.64, 0]);
cylinder(clock, 0.15, 0.15, 0.08, M.oldBrass, [0, 2.31, 0]);
// Clock housing.
const clockBody = cylinder(
clock,
0.75,
0.75,
0.27,
M.darkIron,
[0, 3.06, 0],
[Math.PI / 2, 0, 0],
48
);
torus(clock, 0.69, 0.045, M.oldBrass, [0, 3.06, 0.15]);
torus(clock, 0.69, 0.045, M.oldBrass, [0, 3.06, -0.15]);
// Small crown above the case.
cylinder(clock, 0.12, 0.19, 0.18, M.darkIron, [0, 3.83, 0]);
ball(clock, 0.12, M.oldBrass, [0, 3.95, 0]);
const clockFaceTexture = makeCanvasTexture(512, 512, (ctx, w, h) => {
ctx.fillStyle = "#e8d9b5";
ctx.fillRect(0, 0, w, h);
ctx.strokeStyle = "#253738";
ctx.lineWidth = 10;
ctx.beginPath();
ctx.arc(w / 2, h / 2, 242, 0, Math.PI * 2);
ctx.stroke();
ctx.fillStyle = "#253738";
ctx.textAlign = "center";
ctx.textBaseline = "middle";
ctx.font = "bold 31px Georgia";
for (let number = 1; number <= 12; number++) {
const angle = (number / 12) * Math.PI * 2 - Math.PI / 2;
const x = w / 2 + Math.cos(angle) * 194;
const y = h / 2 + Math.sin(angle) * 194;
ctx.fillText(String(number), x, y);
}
ctx.fillStyle = "#8c692f";
ctx.font = "italic 18px Georgia";
ctx.fillText("NORTH WORKS", w / 2, h / 2 + 93);
});
const clockFaceMaterial = new THREE.MeshStandardMaterial({
map: clockFaceTexture,
roughness: 0.86
});
const clockFace = addMesh(
new THREE.CircleGeometry(0.655, 64),
clockFaceMaterial,
clock
);
clockFace.position.set(0, 3.06, 0.148);
clockFace.castShadow = false;
// Raised hour markers.
for (let i = 0; i < 12; i++) {
const angle = (i / 12) * Math.PI * 2;
const major = i % 3 === 0;
const marker = box(
clock,
[major ? 0.047 : 0.027, major ? 0.13 : 0.085, 0.028],
M.blackIron,
[
Math.sin(angle) * 0.585,
3.06 + Math.cos(angle) * 0.585,
0.185
],
[0, 0, -angle]
);
marker.castShadow = false;
}
// Hands fixed at 10:10 for a clear period-station composition.
const hourPivot = new THREE.Group();
hourPivot.position.set(0, 3.06, 0.205);
clock.add(hourPivot);
box(
hourPivot,
[0.058, 0.37, 0.035],
M.blackIron,
[0, 0.15, 0]
);
const minutePivot = new THREE.Group();
minutePivot.position.set(0, 3.06, 0.225);
minutePivot.rotation.z = -Math.PI / 3;
clock.add(minutePivot);
box(
minutePivot,
[0.038, 0.52, 0.028],
M.blackIron,
[0, 0.225, 0]
);
const secondPivot = new THREE.Group();
secondPivot.position.set(0, 3.06, 0.246);
secondPivot.rotation.z = -Math.PI * 0.74;
clock.add(secondPivot);
box(
secondPivot,
[0.018, 0.57, 0.018],
M.red,
[0, 0.235, 0]
);
ball(clock, 0.065, M.oldBrass, [0, 3.06, 0.27]);
const datePlaqueTexture = makeCanvasTexture(512, 160, (ctx, w, h) => {
ctx.fillStyle = "#26393a";
ctx.fillRect(0, 0, w, h);
ctx.strokeStyle = "#b89450";
ctx.lineWidth = 7;
ctx.strokeRect(8, 8, w - 16, h - 16);
ctx.fillStyle = "#eadbb9";
ctx.textAlign = "center";
ctx.textBaseline = "middle";
ctx.font = "bold 64px Georgia";
ctx.fillText("1908", w / 2, h / 2);
});
signPlane(clock, 0.62, 0.19, datePlaqueTexture, [0, 2.11, 0.11]);
// ------------------------------------------------------------
// Passenger luggage trolley
// ------------------------------------------------------------
const trolley = new THREE.Group();
trolley.position.set(0.45, 0, -0.05);
trolley.rotation.y = -0.12;
world.add(trolley);
// Wooden slat deck.
box(trolley, [1.86, 0.10, 1.06], M.woodDark, [0, 0.37, 0]);
for (let i = 0; i < 7; i++) {
box(
trolley,
[1.78, 0.075, 0.115],
i % 2 === 0 ? M.woodLight : M.wood,
[0, 0.445, -0.43 + i * 0.143]
);
}
// Steel underframe.
box(trolley, [1.72, 0.12, 0.13], M.darkSteel, [0, 0.29, -0.42]);
box(trolley, [1.72, 0.12, 0.13], M.darkSteel, [0, 0.29, 0.42]);
// Four rubber wheels with brass hubs.
for (const x of [-0.72, 0.72]) {
for (const z of [-0.41, 0.41]) {
cylinder(
trolley,
0.185,
0.185,
0.11,
M.rubber,
[x, 0.19, z],
[0, 0, Math.PI / 2],
20
);
torus(
trolley,
0.115,
0.025,
M.brass,
[x + (x < 0 ? -0.062 : 0.062), 0.19, z],
[0, Math.PI / 2, 0]
);
}
}
// Brass luggage guards.
const postPositions = [
[-0.81, -0.45],
[0.81, -0.45],
[-0.81, 0.45],
[0.81, 0.45]
];
for (const [x, z] of postPositions) {
cylinder(trolley, 0.035, 0.035, 0.67, M.brass, [x, 0.81, z]);
ball(trolley, 0.052, M.oldBrass, [x, 1.15, z]);
}
tube(trolley, [-0.81, 1.13, -0.45], [0.81, 1.13, -0.45], 0.034, M.brass);
tube(trolley, [-0.81, 1.13, 0.45], [0.81, 1.13, 0.45], 0.034, M.brass);
tube(trolley, [-0.81, 1.13, -0.45], [-0.81, 1.13, 0.45], 0.034, M.brass);
tube(trolley, [0.81, 1.13, -0.45], [0.81, 1.13, 0.45], 0.034, M.brass);
// Push handle at one end.
tube(trolley, [-0.91, 0.44, -0.37], [-1.08, 1.25, -0.37], 0.035, M.brass);
tube(trolley, [-0.91, 0.44, 0.37], [-1.08, 1.25, 0.37], 0.035, M.brass);
tube(trolley, [-1.08, 1.25, -0.37], [-1.08, 1.25, 0.37], 0.04, M.wood);
// Warm passenger belongings: leather trunk.
const trunk = new THREE.Group();
trunk.position.set(-0.28, 0.77, 0.02);
trolley.add(trunk);
box(trunk, [1.03, 0.48, 0.41], M.leather, [0, 0, 0]);
box(trunk, [1.05, 0.11, 0.43], M.leatherLight, [0, 0.245, 0]);
// Straps and brass corner fittings.
for (const x of [-0.32, 0.32]) {
box(trunk, [0.075, 0.53, 0.018], M.woodDark, [x, 0.01, 0.216]);
box(trunk, [0.075, 0.53, 0.018], M.woodDark, [x, 0.01, -0.216]);
}
for (const x of [-0.46, 0.46]) {
for (const y of [-0.19, 0.18]) {
box(trunk, [0.10, 0.06, 0.025], M.oldBrass, [x, y, 0.22]);
}
}
// Luggage label links the personal effects to the industrial town.
const luggageLabelTexture = makeCanvasTexture(512, 220, (ctx, w, h) => {
ctx.fillStyle = "#d9c594";
ctx.fillRect(0, 0, w, h);
ctx.strokeStyle = "#68452f";
ctx.lineWidth = 10;
ctx.strokeRect(10, 10, w - 20, h - 20);
ctx.fillStyle = "#513a2b";
ctx.textAlign = "center";
ctx.font = "bold 48px Georgia";
ctx.fillText("H. VALE", w / 2, 88);
ctx.font = "bold 33px Arial";
ctx.fillText("NORTH WORKS", w / 2, 145);
ctx.font = "25px Arial";
ctx.fillText("PLATFORM 3", w / 2, 188);
});
signPlane(trunk, 0.36, 0.16, luggageLabelTexture, [0.02, 0.015, 0.23]);
// Smaller suitcase.
const suitcase = new THREE.Group();
suitcase.position.set(0.47, 0.78, 0.22);
trolley.add(suitcase);
box(suitcase, [0.62, 0.40, 0.28], M.navy, [0, 0, 0]);
box(suitcase, [0.64, 0.07, 0.30], M.leather, [0, 0.205, 0]);
for (const x of [-0.20, 0.20]) {
box(suitcase, [0.055, 0.42, 0.018], M.woodDark, [x, 0, 0.151]);
}
torus(suitcase, 0.085, 0.017, M.woodDark, [0, 0.29, 0], [0, 0, 0]);
// Hatbox.
cylinder(
trolley,
0.245,
0.245,
0.25,
M.canvas,
[0.2, 0.62, -0.27]
);
torus(
trolley,
0.247,
0.018,
M.woodDark,
[0.2, 0.75, -0.27],
[Math.PI / 2, 0, 0]
);
// Rolled blanket.
const blanket = addMesh(
new THREE.CapsuleGeometry(0.12, 0.48, 6, 12),
M.navy,
trolley
);
blanket.position.set(-0.61, 0.64, -0.29);
blanket.rotation.z = Math.PI / 2;
// Small wrapped parcel.
box(trolley, [0.38, 0.31, 0.31], M.kraft, [0.62, 0.65, -0.27]);
box(trolley, [0.045, 0.325, 0.325], M.woodDark, [0.62, 0.65, -0.27]);
box(trolley, [0.395, 0.325, 0.04], M.woodDark, [0.62, 0.65, -0.27]);
// ------------------------------------------------------------
// Separate industrial freight-handling truck
// ------------------------------------------------------------
const freight = new THREE.Group();
freight.position.set(6.1, 0, -0.62);
freight.rotation.y = 0.13;
world.add(freight);
box(freight, [1.92, 0.16, 1.18], M.darkSteel, [0, 0.4, 0]);
box(freight, [1.72, 0.08, 0.96], M.steel, [0, 0.51, 0]);
for (const x of [-0.7, 0.7]) {
for (const z of [-0.43, 0.43]) {
cylinder(
freight,
0.235,
0.235,
0.14,
M.rubber,
[x, 0.25, z],
[0, 0, Math.PI / 2],
20
);
torus(
freight,
0.15,
0.028,
M.steel,
[x + (x < 0 ? -0.08 : 0.08), 0.25, z],
[0, Math.PI / 2, 0]
);
}
}
// Tall steel push frame, deliberately unlike the brass passenger cart.
tube(freight, [0.89, 0.47, -0.46], [1.02, 1.72, -0.46], 0.045, M.steel);
tube(freight, [0.89, 0.47, 0.46], [1.02, 1.72, 0.46], 0.045, M.steel);
tube(freight, [1.02, 1.72, -0.46], [1.02, 1.72, 0.46], 0.055, M.steel);
tube(freight, [-0.9, 0.45, -0.46], [-0.9, 1.08, -0.46], 0.04, M.steel);
tube(freight, [-0.9, 0.45, 0.46], [-0.9, 1.08, 0.46], 0.04, M.steel);
tube(freight, [-0.9, 1.08, -0.46], [-0.9, 1.08, 0.46], 0.04, M.steel);
// Industrial shipping crate.
const crate = new THREE.Group();
crate.position.set(-0.12, 1.08, 0);
freight.add(crate);
box(crate, [1.13, 1.03, 0.83], M.wood, [0, 0, 0]);
for (const y of [-0.34, 0, 0.34]) {
box(crate, [1.18, 0.10, 0.87], M.woodLight, [0, y, 0]);
}
for (const x of [-0.42, 0.42]) {
box(crate, [0.10, 1.06, 0.88], M.woodDark, [x, 0, 0]);
}
const crateStencilTexture = makeCanvasTexture(768, 384, (ctx, w, h) => {
ctx.clearRect(0, 0, w, h);
ctx.strokeStyle = "rgba(62, 61, 48, 0.75)";
ctx.lineWidth = 9;
ctx.strokeRect(24, 24, w - 48, h - 48);
ctx.fillStyle = "rgba(62, 61, 48, 0.82)";
ctx.textAlign = "center";
ctx.font = "bold 66px Arial";
ctx.fillText("WORKS", w / 2, 126);
ctx.font = "bold 42px Arial";
ctx.fillText("LOT 42", w / 2, 195);
ctx.font = "31px Arial";
ctx.fillText("FREIGHT ONLY", w / 2, 268);
ctx.fillText("NORTH INDUSTRIAL", w / 2, 316);
});
const stencilMaterial = new THREE.MeshStandardMaterial({
map: crateStencilTexture,
transparent: true,
roughness: 0.95,
depthWrite: false
});
const stencil = addMesh(
new THREE.PlaneGeometry(0.87, 0.47),
stencilMaterial,
crate
);
stencil.position.set(0, 0, 0.427);
stencil.castShadow = false;
// ------------------------------------------------------------
// Traveler: a human-scale reference
// ------------------------------------------------------------
const traveler = new THREE.Group();
traveler.position.set(3.25, 0, 0.55);
traveler.rotation.y = -0.22;
world.add(traveler);
// Boots and trousers.
for (const x of [-0.105, 0.105]) {
box(traveler, [0.16, 0.11, 0.31], M.black, [x, 0.06, 0.045]);
cylinder(traveler, 0.075, 0.095, 0.67, M.darkIron, [x, 0.45, 0]);
}
// Long period coat.
cylinder(traveler, 0.235, 0.31, 0.73, M.coat, [0, 1.10, 0]);
box(traveler, [0.34, 0.12, 0.25], M.darkIron, [0, 0.81, 0]);
// Neck and head.
cylinder(traveler, 0.075, 0.075, 0.12, M.skin, [0, 1.50, 0]);
ball(traveler, 0.145, M.skin, [0, 1.63, 0], [0.92, 1.08, 0.94]);
// Hat and brim.
cylinder(traveler, 0.225, 0.225, 0.035, M.hat, [0, 1.75, 0]);
cylinder(traveler, 0.135, 0.15, 0.13, M.hat, [0, 1.82, 0]);
cylinder(traveler, 0.151, 0.151, 0.035, M.woodDark, [0, 1.78, 0]);
// Scarf.
torus(
traveler,
0.115,
0.045,
M.red,
[0, 1.47, 0],
[Math.PI / 2, 0, 0]
);
// Bent arms, with a travel document in one hand.
tube(traveler, [-0.23, 1.36, 0], [-0.34, 1.08, 0.02], 0.075, M.coat);
tube(traveler, [-0.34, 1.08, 0.02], [-0.27, 0.86, 0.06], 0.064, M.coat);
ball(traveler, 0.068, M.skin, [-0.27, 0.84, 0.06]);
tube(traveler, [0.23, 1.36, 0], [0.36, 1.08, 0.02], 0.075, M.coat);
tube(traveler, [0.36, 1.08, 0.02], [0.47, 0.88, 0.08], 0.064, M.coat);
ball(traveler, 0.068, M.skin, [0.47, 0.86, 0.08]);
box(
traveler,
[0.16, 0.025, 0.23],
M.cream,
[0.48, 0.80, 0.08],
[0, -0.2, 0.05]
);
// A small canvas shoulder bundle emphasizes passenger travel.
const shoulderBundle = new THREE.Group();
shoulderBundle.position.set(-0.08, 1.05, -0.23);
traveler.add(shoulderBundle);
box(shoulderBundle, [0.36, 0.43, 0.18], M.canvas);
torus(shoulderBundle, 0.19, 0.025, M.woodDark, [0, 0.08, 0.1]);
tube(
traveler,
[-0.19, 1.35, -0.12],
[0.12, 1.19, 0.05],
0.023,
M.woodDark
);
// ------------------------------------------------------------
// Direct camera controls — no external control modules
// ------------------------------------------------------------
const target = new THREE.Vector3(0.65, 1.25, -0.45);
const spherical = new THREE.Spherical();
const initialRadius = window.innerWidth < 720 ? 23 : 16.4;
function resetCamera() {
spherical.set(initialRadius, 1.12, 0.62);
updateCamera();
}
function updateCamera() {
camera.position.setFromSpherical(spherical).add(target);
camera.lookAt(target);
}
let dragging = false;
let previousX = 0;
let previousY = 0;
renderer.domElement.addEventListener("pointerdown", (event) => {
dragging = true;
previousX = event.clientX;
previousY = event.clientY;
renderer.domElement.setPointerCapture(event.pointerId);
});
renderer.domElement.addEventListener("pointermove", (event) => {
if (!dragging) return;
const deltaX = event.clientX - previousX;
const deltaY = event.clientY - previousY;
previousX = event.clientX;
previousY = event.clientY;
spherical.theta -= deltaX * 0.006;
spherical.phi -= deltaY * 0.005;
spherical.theta = THREE.MathUtils.clamp(
spherical.theta,
-0.42,
1.25
);
spherical.phi = THREE.MathUtils.clamp(
spherical.phi,
0.58,
1.42
);
updateCamera();
});
function endDrag(event) {
dragging = false;
if (
renderer.domElement.hasPointerCapture &&
renderer.domElement.hasPointerCapture(event.pointerId)
) {
renderer.domElement.releasePointerCapture(event.pointerId);
}
}
renderer.domElement.addEventListener("pointerup", endDrag);
renderer.domElement.addEventListener("pointercancel", endDrag);
renderer.domElement.addEventListener(
"wheel",
(event) => {
event.preventDefault();
const factor = Math.exp(event.deltaY * 0.001);
spherical.radius = THREE.MathUtils.clamp(
spherical.radius * factor,
9,
27
);
updateCamera();
},
{ passive: false }
);
document.getElementById("reset").addEventListener("click", resetCamera);
window.addEventListener("resize", () => {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.setSize(window.innerWidth, window.innerHeight);
});
resetCamera();
renderer.render(scene, camera);
document.getElementById("loading").remove();
renderer.setAnimationLoop(() => {
renderer.render(scene, camera);
});
</script>
</body>
</html>
```