Prompt specification
Build or customize the Three.js 3D scene "Travel trunk with ship label holder" 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: Travel trunk with ship label holder
Category: Art & Culture · Style: Procedural Solid / Shader 3D
License: MIT · Reference: https://three3d.app/scene/travel-trunk-with-ship-label-holder-x2581
Scene Description Prompt:
Build a self-contained HTML scene with Three.js from cdnjs featuring a period immigrant travel trunk associated with Ellis Island. Model a period travel trunk with straps and a removable label holder. Use fictional identifying text and distinguish ordinary belongings from assumptions about a particular migrant. Stylized solid forms.
Working Three.js Starter (travel-trunk-with-ship-label-holder-x2581):
```html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Ellis Island Travel Trunk — Fictional Object Study</title>
<style>
:root {
--paper: #eee8dc;
--ink: #29251f;
--muted: #6c655b;
--rust: #984b32;
--line: rgba(49, 42, 34, 0.18);
--panel: rgba(245, 241, 232, 0.94);
}
* {
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: #d8d1c4;
color: var(--ink);
font-family: Inter, ui-sans-serif, system-ui, -apple-system,
BlinkMacSystemFont, "Segoe UI", sans-serif;
}
#scene {
position: fixed;
inset: 0;
}
#scene canvas {
display: block;
width: 100%;
height: 100%;
touch-action: none;
outline: none;
}
.masthead {
position: fixed;
top: 30px;
left: 34px;
z-index: 3;
max-width: 520px;
pointer-events: none;
text-shadow: 0 1px 18px rgba(255, 255, 255, 0.4);
}
.eyebrow {
margin: 0 0 9px;
color: var(--rust);
font-size: 11px;
font-weight: 800;
letter-spacing: 0.19em;
text-transform: uppercase;
}
h1 {
margin: 0;
font-family: Georgia, "Times New Roman", serif;
font-size: clamp(37px, 4.4vw, 67px);
font-weight: 500;
line-height: 0.97;
letter-spacing: -0.035em;
}
.dek {
max-width: 465px;
margin: 17px 0 0;
color: #514a41;
font-size: 14px;
line-height: 1.55;
}
.panel {
position: fixed;
z-index: 4;
top: 24px;
right: 24px;
width: min(365px, calc(100vw - 48px));
max-height: calc(100vh - 48px);
overflow: auto;
padding: 23px;
border: 1px solid rgba(66, 54, 40, 0.16);
border-radius: 4px;
background: var(--panel);
box-shadow: 0 18px 60px rgba(56, 44, 31, 0.14);
backdrop-filter: blur(13px);
}
.panel h2 {
margin: 0 0 12px;
font-family: Georgia, "Times New Roman", serif;
font-size: 27px;
font-weight: 500;
}
.panel p {
margin: 0;
color: var(--muted);
font-size: 12.5px;
line-height: 1.55;
}
.meta {
display: grid;
grid-template-columns: 92px 1fr;
gap: 7px 11px;
margin: 18px 0;
padding: 15px 0;
border-top: 1px solid var(--line);
border-bottom: 1px solid var(--line);
font-size: 11.5px;
line-height: 1.35;
}
.meta dt {
color: #8b8174;
font-weight: 700;
letter-spacing: 0.04em;
text-transform: uppercase;
}
.meta dd {
margin: 0;
color: #3d3831;
font-weight: 650;
}
.section {
margin-top: 18px;
}
.section-title {
display: flex;
align-items: center;
gap: 8px;
margin: 0 0 8px;
font-size: 11px;
font-weight: 850;
letter-spacing: 0.095em;
text-transform: uppercase;
}
.section-title::before {
width: 7px;
height: 7px;
flex: 0 0 auto;
border-radius: 50%;
background: #64765a;
content: "";
}
.section.interpretive .section-title::before {
background: var(--rust);
}
ul {
margin: 0;
padding-left: 17px;
color: var(--muted);
font-size: 12px;
line-height: 1.55;
}
li + li {
margin-top: 4px;
}
.controls {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 8px;
margin-top: 21px;
padding-top: 18px;
border-top: 1px solid var(--line);
}
button {
min-height: 39px;
padding: 9px 11px;
border: 1px solid rgba(65, 50, 35, 0.24);
border-radius: 3px;
background: rgba(255, 255, 255, 0.48);
color: #352f28;
cursor: pointer;
font: inherit;
font-size: 11.5px;
font-weight: 750;
transition:
background 150ms ease,
border-color 150ms ease,
transform 150ms ease;
}
button:hover {
border-color: rgba(65, 50, 35, 0.5);
background: rgba(255, 255, 255, 0.78);
}
button:active {
transform: translateY(1px);
}
button.active {
border-color: #78412f;
background: #78412f;
color: #fff9ed;
}
button.wide {
grid-column: 1 / -1;
}
.fine-print {
margin-top: 14px !important;
padding-top: 13px;
border-top: 1px solid var(--line);
font-size: 10.5px !important;
}
.scene-note {
position: fixed;
z-index: 3;
left: 34px;
bottom: 27px;
display: flex;
align-items: center;
gap: 12px;
color: rgba(52, 45, 36, 0.7);
font-size: 10.5px;
font-weight: 700;
letter-spacing: 0.055em;
text-transform: uppercase;
pointer-events: none;
}
.scene-note::before {
width: 25px;
height: 1px;
background: currentColor;
content: "";
}
.status {
position: fixed;
z-index: 5;
left: 50%;
bottom: 25px;
padding: 9px 13px;
border: 1px solid rgba(63, 51, 38, 0.14);
border-radius: 3px;
background: rgba(246, 241, 231, 0.88);
color: #4d453b;
font-size: 10.5px;
font-weight: 750;
letter-spacing: 0.04em;
transform: translateX(-50%);
pointer-events: none;
transition: opacity 200ms ease;
}
@media (max-width: 820px) {
.masthead {
top: 20px;
left: 20px;
max-width: calc(100vw - 40px);
}
.dek {
display: none;
}
.panel {
top: auto;
right: 12px;
bottom: 12px;
left: 12px;
width: auto;
max-height: 43vh;
padding: 18px;
}
.panel h2 {
font-size: 23px;
}
.scene-note {
display: none;
}
.status {
bottom: calc(43vh + 25px);
}
}
</style>
</head>
<body>
<main id="scene" aria-label="Interactive three-dimensional reconstruction of a period travel trunk"></main>
<header class="masthead">
<p class="eyebrow">Interpretive Object Study · c. 1900–1910</p>
<h1>Ellis Island<br />Travel Trunk</h1>
<p class="dek">
A stylized reconstruction of a wood-framed, canvas-covered travel trunk.
The identification and arrangement shown here are fictional, not an archival record.
</p>
</header>
<aside class="panel" aria-label="Object information and controls">
<p class="eyebrow">Fictional reconstruction</p>
<h2>Travel Trunk No. 07</h2>
<p>
The form evokes luggage carried through Ellis Island and other U.S. arrival
ports around 1900–1910. It is not a replica of a documented migrant’s trunk.
</p>
<dl class="meta">
<dt>Structure</dt>
<dd>Wood, canvas, leather straps, brass hardware</dd>
<dt>Identifier</dt>
<dd>Ella Novak — fictional</dd>
<dt>Label date</dt>
<dd>New York, 1907 — fictional</dd>
<dt>Evidence</dt>
<dd>No known owner or voyage</dd>
</dl>
<section class="section">
<h3 class="section-title">Generic period belongings</h3>
<p>
The open trunk contains a folded wool blanket, canvas satchel, notebook,
and tin cup. These are illustrative objects commonly associated with the
period, not a verified personal inventory.
</p>
</section>
<section class="section interpretive">
<h3 class="section-title">Interpretive assumptions</h3>
<ul>
<li>The name, date, and label wording are invented.</li>
<li>The packing arrangement does not establish travel priorities.</li>
<li>No conclusion is made about purpose, family ties, or sentiment.</li>
</ul>
</section>
<div class="controls">
<button id="lidButton" type="button">Open lid</button>
<button id="holderButton" type="button">Remove label holder</button>
<button id="resetButton" class="wide" type="button">Reset view</button>
</div>
<p class="fine-print">
Drag to orbit · Scroll or pinch to zoom · Space toggles the lid ·
L toggles the removable label holder
</p>
</aside>
<div class="scene-note">Drag to orbit · Scroll to zoom</div>
<div class="status" id="status">Label holder attached</div>
<script type="module">
import * as THREE from
"https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
const container = document.querySelector("#scene");
const renderer = new THREE.WebGLRenderer({
antialias: true,
alpha: false,
powerPreference: "high-performance"
});
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1.05;
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
container.appendChild(renderer.domElement);
renderer.domElement.tabIndex = 0;
renderer.domElement.setAttribute(
"aria-label",
"Three-dimensional period travel trunk. Drag to orbit and scroll to zoom."
);
const scene = new THREE.Scene();
scene.background = new THREE.Color("#d8d1c4");
scene.fog = new THREE.Fog("#d8d1c4", 15, 30);
const camera = new THREE.PerspectiveCamera(
38,
window.innerWidth / window.innerHeight,
0.1,
100
);
// ---------------------------------------------------------------------
// Direct camera controls: no examples/addons are used.
// ---------------------------------------------------------------------
const cameraState = {
yaw: 0.62,
pitch: 0.40,
radius: 10.4,
targetYaw: 0.62,
targetPitch: 0.40,
targetRadius: 10.4,
target: new THREE.Vector3(0, 1.72, 0)
};
function updateCamera() {
const s = cameraState;
s.yaw += (s.targetYaw - s.yaw) * 0.10;
s.pitch += (s.targetPitch - s.pitch) * 0.10;
s.radius += (s.targetRadius - s.radius) * 0.10;
const horizontal = Math.cos(s.pitch) * s.radius;
camera.position.set(
s.target.x + Math.sin(s.yaw) * horizontal,
s.target.y + Math.sin(s.pitch) * s.radius,
s.target.z + Math.cos(s.yaw) * horizontal
);
camera.lookAt(s.target);
}
const pointers = new Map();
let previousPinch = 0;
renderer.domElement.addEventListener("pointerdown", (event) => {
renderer.domElement.setPointerCapture(event.pointerId);
pointers.set(event.pointerId, {
x: event.clientX,
y: event.clientY
});
});
renderer.domElement.addEventListener("pointermove", (event) => {
if (!pointers.has(event.pointerId)) return;
const previous = pointers.get(event.pointerId);
const dx = event.clientX - previous.x;
const dy = event.clientY - previous.y;
pointers.set(event.pointerId, {
x: event.clientX,
y: event.clientY
});
if (pointers.size === 1) {
cameraState.targetYaw -= dx * 0.006;
cameraState.targetPitch = THREE.MathUtils.clamp(
cameraState.targetPitch + dy * 0.005,
0.12,
0.88
);
} else if (pointers.size === 2) {
const values = [...pointers.values()];
const distance = Math.hypot(
values[0].x - values[1].x,
values[0].y - values[1].y
);
if (previousPinch) {
cameraState.targetRadius = THREE.MathUtils.clamp(
cameraState.targetRadius + (previousPinch - distance) * 0.018,
6.2,
15
);
}
previousPinch = distance;
}
});
function releasePointer(event) {
pointers.delete(event.pointerId);
if (pointers.size < 2) previousPinch = 0;
}
renderer.domElement.addEventListener("pointerup", releasePointer);
renderer.domElement.addEventListener("pointercancel", releasePointer);
renderer.domElement.addEventListener(
"wheel",
(event) => {
event.preventDefault();
cameraState.targetRadius = THREE.MathUtils.clamp(
cameraState.targetRadius + event.deltaY * 0.008,
6.2,
15
);
},
{ passive: false }
);
function resetCamera() {
cameraState.targetYaw = 0.62;
cameraState.targetPitch = 0.40;
cameraState.targetRadius = 10.4;
cameraState.target.set(0, 1.72, 0);
}
// ---------------------------------------------------------------------
// Materials
// ---------------------------------------------------------------------
const material = {
canvas: new THREE.MeshStandardMaterial({
color: "#8b6b4c",
roughness: 0.88,
metalness: 0.02
}),
canvasLight: new THREE.MeshStandardMaterial({
color: "#9b7957",
roughness: 0.9
}),
darkCanvas: new THREE.MeshStandardMaterial({
color: "#554333",
roughness: 0.94
}),
wood: new THREE.MeshStandardMaterial({
color: "#493427",
roughness: 0.8
}),
leather: new THREE.MeshStandardMaterial({
color: "#30251f",
roughness: 0.66
}),
lining: new THREE.MeshStandardMaterial({
color: "#493a30",
roughness: 0.98
}),
brass: new THREE.MeshStandardMaterial({
color: "#ad8744",
roughness: 0.38,
metalness: 0.72
}),
iron: new THREE.MeshStandardMaterial({
color: "#413c36",
roughness: 0.52,
metalness: 0.55
}),
blanket: new THREE.MeshStandardMaterial({
color: "#a99b80",
roughness: 1
}),
blanketEdge: new THREE.MeshStandardMaterial({
color: "#84775f",
roughness: 1
}),
satchel: new THREE.MeshStandardMaterial({
color: "#74614d",
roughness: 0.95
}),
paper: new THREE.MeshStandardMaterial({
color: "#d4c7aa",
roughness: 0.9
}),
tin: new THREE.MeshStandardMaterial({
color: "#92948f",
roughness: 0.4,
metalness: 0.72
}),
plinth: new THREE.MeshStandardMaterial({
color: "#b9b0a1",
roughness: 0.92
}),
floor: new THREE.MeshStandardMaterial({
color: "#cfc7b8",
roughness: 1
})
};
function box(parent, size, position, mat, castShadow = true) {
const mesh = new THREE.Mesh(
new THREE.BoxGeometry(size[0], size[1], size[2]),
mat
);
mesh.position.set(position[0], position[1], position[2]);
mesh.castShadow = castShadow;
mesh.receiveShadow = true;
parent.add(mesh);
return mesh;
}
function cylinder(
parent,
radiusTop,
radiusBottom,
height,
position,
mat,
segments = 24
) {
const mesh = new THREE.Mesh(
new THREE.CylinderGeometry(
radiusTop,
radiusBottom,
height,
segments
),
mat
);
mesh.position.set(position[0], position[1], position[2]);
mesh.castShadow = true;
mesh.receiveShadow = true;
parent.add(mesh);
return mesh;
}
function rivet(parent, x, y, z, axis = "z") {
const mesh = new THREE.Mesh(
new THREE.CylinderGeometry(0.055, 0.055, 0.05, 12),
material.brass
);
mesh.position.set(x, y, z);
if (axis === "x") mesh.rotation.z = Math.PI / 2;
if (axis === "z") mesh.rotation.x = Math.PI / 2;
mesh.castShadow = true;
parent.add(mesh);
}
function rectangularBuckle(parent, x, y, z, width = 0.38, height = 0.47) {
const depth = 0.075;
const bar = 0.055;
box(parent, [width, bar, depth], [x, y + height / 2, z], material.brass);
box(parent, [width, bar, depth], [x, y - height / 2, z], material.brass);
box(parent, [bar, height, depth], [x - width / 2, y, z], material.brass);
box(parent, [bar, height, depth], [x + width / 2, y, z], material.brass);
box(parent, [0.065, height * 0.72, depth], [x, y, z + 0.025], material.brass);
}
// ---------------------------------------------------------------------
// Lighting and display architecture
// ---------------------------------------------------------------------
scene.add(new THREE.HemisphereLight("#fff7e8", "#74695d", 2.2));
const key = new THREE.DirectionalLight("#fff0d5", 4.2);
key.position.set(6, 10, 7);
key.castShadow = true;
key.shadow.mapSize.set(2048, 2048);
key.shadow.camera.left = -8;
key.shadow.camera.right = 8;
key.shadow.camera.top = 9;
key.shadow.camera.bottom = -6;
key.shadow.camera.near = 0.5;
key.shadow.camera.far = 30;
key.shadow.bias = -0.00025;
scene.add(key);
const fill = new THREE.DirectionalLight("#c9d5df", 1.4);
fill.position.set(-7, 4, 1);
scene.add(fill);
const rim = new THREE.PointLight("#e2a36f", 12, 18, 2);
rim.position.set(-4, 6, -4);
scene.add(rim);
const floor = new THREE.Mesh(
new THREE.PlaneGeometry(50, 50),
material.floor
);
floor.rotation.x = -Math.PI / 2;
floor.position.y = -0.2;
floor.receiveShadow = true;
scene.add(floor);
const plinth = new THREE.Group();
scene.add(plinth);
box(plinth, [8.8, 0.36, 4.8], [0, 0, 0], material.plinth);
box(
plinth,
[8.55, 0.05, 4.55],
[0, 0.205, 0],
new THREE.MeshStandardMaterial({
color: "#c7beb0",
roughness: 0.95
})
);
// A restrained architectural suggestion of an institutional hall.
const architecture = new THREE.Group();
architecture.position.set(0, 0, -6.4);
scene.add(architecture);
const architectureMat = new THREE.MeshStandardMaterial({
color: "#c5bcae",
roughness: 1
});
box(architecture, [0.52, 7.4, 0.7], [-5.2, 3.5, 0], architectureMat);
box(architecture, [0.52, 7.4, 0.7], [5.2, 3.5, 0], architectureMat);
box(architecture, [10.9, 0.52, 0.7], [0, 7.05, 0], architectureMat);
box(architecture, [0.35, 5.8, 0.35], [-2.2, 3.2, 0.05], architectureMat);
box(architecture, [0.35, 5.8, 0.35], [2.2, 3.2, 0.05], architectureMat);
box(architecture, [4.75, 0.35, 0.35], [0, 6.02, 0.05], architectureMat);
// ---------------------------------------------------------------------
// Trunk
// ---------------------------------------------------------------------
const trunk = new THREE.Group();
scene.add(trunk);
const body = new THREE.Group();
trunk.add(body);
const W = 4.6;
const D = 2.6;
const bottomY = 0.36;
const topY = 2.53;
// Hollow trunk body assembled from solid panels.
box(body, [W, 0.18, D], [0, bottomY, 0], material.wood);
box(body, [W, topY - bottomY, 0.16], [0, 1.445, 1.29], material.canvas);
box(body, [W, topY - bottomY, 0.16], [0, 1.445, -1.29], material.canvas);
box(body, [0.16, topY - bottomY, D], [-2.3, 1.445, 0], material.canvas);
box(body, [0.16, topY - bottomY, D], [2.3, 1.445, 0], material.canvas);
// Interior lining and floor.
box(body, [4.22, 0.055, 2.24], [0, 0.49, 0], material.lining);
box(body, [0.07, 1.95, 2.26], [-2.18, 1.45, 0], material.darkCanvas);
box(body, [0.07, 1.95, 2.26], [2.18, 1.45, 0], material.darkCanvas);
// Wooden vertical ribs on the front and back.
for (const x of [-2.08, 0, 2.08]) {
box(body, [0.15, 2.08, 0.075], [x, 1.44, 1.405], material.wood);
box(body, [0.15, 2.08, 0.075], [x, 1.44, -1.405], material.wood);
}
// Leather straps wrapping down the front and back.
for (const x of [-1.43, 1.43]) {
box(body, [0.29, 2.18, 0.09], [x, 1.43, 1.46], material.leather);
box(body, [0.29, 2.18, 0.09], [x, 1.43, -1.46], material.leather);
// Side portions make the bands read as wrapped around the trunk.
box(body, [0.09, 0.29, 2.72], [-2.43, 1.43, 0], material.leather);
box(body, [0.09, 0.29, 2.72], [2.43, 1.43, 0], material.leather);
rectangularBuckle(body, x, 1.42, 1.535);
}
// Brass corner caps and rivets.
const cornerPositions = [
[-2.08, 0.58, 1.43],
[2.08, 0.58, 1.43],
[-2.08, 2.30, 1.43],
[2.08, 2.30, 1.43]
];
for (const [x, y, z] of cornerPositions) {
box(body, [0.36, 0.27, 0.12], [x, y, z], material.wood);
rivet(body, x, y + 0.19, 1.51);
}
for (const x of [-2.08, 2.08]) {
rivet(body, x, 0.58, 1.51);
rivet(body, x, 2.30, 1.51);
}
// Central lock plate and hasp.
box(body, [0.48, 0.48, 0.09], [0, 2.26, 1.49], material.brass);
box(body, [0.31, 0.22, 0.06], [0, 2.24, 1.56], material.iron);
rivet(body, -0.13, 2.42, 1.57);
rivet(body, 0.13, 2.42, 1.57);
// Lid hinged along the rear edge.
const lidPivot = new THREE.Group();
lidPivot.position.set(0, 2.53, -1.3);
trunk.add(lidPivot);
box(
lidPivot,
[4.68, 0.34, 2.64],
[0, 0.08, 1.32],
material.canvas
);
// Dark underside panel.
box(
lidPivot,
[4.22, 0.065, 2.18],
[0, -0.125, 1.32],
material.lining
);
// Lid ribs, top straps, and underside straps.
for (const x of [-2.08, 0, 2.08]) {
box(
lidPivot,
[0.15, 0.055, 2.55],
[x, 0.275, 1.32],
material.wood
);
}
for (const x of [-1.43, 1.43]) {
box(
lidPivot,
[0.29, 0.065, 2.62],
[x, 0.305, 1.32],
material.leather
);
box(
lidPivot,
[0.29, 0.06, 2.18],
[x, -0.19, 1.32],
material.leather
);
box(
lidPivot,
[0.29, 0.40, 0.09],
[x, 0.10, 2.61],
material.leather
);
}
// Hinge barrels.
for (const x of [-1.65, 0, 1.65]) {
const hinge = cylinder(
lidPivot,
0.115,
0.115,
0.42,
[x, 0.02, 0.02],
material.iron,
16
);
hinge.rotation.z = Math.PI / 2;
}
// ---------------------------------------------------------------------
// Generic period belongings
// ---------------------------------------------------------------------
const belongings = new THREE.Group();
body.add(belongings);
// Folded wool blanket.
const blanketGroup = new THREE.Group();
blanketGroup.position.set(-0.93, 0.76, 0.35);
blanketGroup.rotation.y = -0.06;
belongings.add(blanketGroup);
box(
blanketGroup,
[1.78, 0.27, 1.58],
[0, 0, 0],
material.blanket
);
box(
blanketGroup,
[1.66, 0.22, 1.48],
[0.07, 0.22, -0.02],
material.blanketEdge
);
box(
blanketGroup,
[1.54, 0.18, 1.37],
[-0.05, 0.40, 0.02],
material.blanket
);
// Canvas satchel.
const satchel = new THREE.Group();
satchel.position.set(0.33, 0.84, -0.55);
satchel.rotation.y = 0.10;
belongings.add(satchel);
box(satchel, [1.15, 0.68, 0.52], [0, 0, 0], material.satchel);
box(satchel, [1.18, 0.24, 0.56], [0, 0.20, 0], material.canvasLight);
box(satchel, [0.18, 0.48, 0.57], [0, 0.03, 0], material.leather);
const satchelHandle = new THREE.Mesh(
new THREE.TorusGeometry(0.26, 0.035, 10, 28, Math.PI),
material.leather
);
satchelHandle.position.set(0, 0.36, 0);
satchelHandle.rotation.z = Math.PI;
satchelHandle.castShadow = true;
satchel.add(satchelHandle);
// Notebook and loose papers.
const notebook = new THREE.Group();
notebook.position.set(1.12, 0.64, 0.73);
notebook.rotation.y = -0.12;
belongings.add(notebook);
box(notebook, [0.83, 0.17, 1.02], [0, 0, 0], material.leather);
box(notebook, [0.75, 0.13, 0.94], [0, 0.015, 0], material.paper);
box(notebook, [0.84, 0.035, 0.18], [0, 0.10, -0.33], material.leather);
// Tin cup.
const cup = new THREE.Group();
cup.position.set(1.54, 0.78, -0.52);
belongings.add(cup);
cylinder(cup, 0.27, 0.22, 0.48, [0, 0, 0], material.tin, 28);
cylinder(cup, 0.235, 0.235, 0.025, [0, -0.23, 0], material.tin, 28);
const cupHandle = new THREE.Mesh(
new THREE.TorusGeometry(0.19, 0.035, 10, 28),
material.tin
);
cupHandle.position.set(0.28, 0.015, 0);
cupHandle.castShadow = true;
cup.add(cupHandle);
// ---------------------------------------------------------------------
// Removable label holder
// ---------------------------------------------------------------------
function createLabelTexture() {
const canvas = document.createElement("canvas");
canvas.width = 768;
canvas.height = 384;
const ctx = canvas.getContext("2d");
ctx.fillStyle = "#e8ddc3";
ctx.fillRect(0, 0, canvas.width, canvas.height);
ctx.strokeStyle = "#6b5844";
ctx.lineWidth = 7;
ctx.strokeRect(17, 17, canvas.width - 34, canvas.height - 34);
ctx.strokeStyle = "#a89677";
ctx.lineWidth = 2;
ctx.strokeRect(29, 29, canvas.width - 58, canvas.height - 58);
ctx.textAlign = "center";
ctx.fillStyle = "#8b3f2c";
ctx.font = "700 28px Arial, sans-serif";
ctx.fillText("FICTIONAL RECONSTRUCTION", 384, 75);
ctx.fillStyle = "#342c23";
ctx.font = "600 70px Georgia, serif";
ctx.fillText("ELLA NOVAK", 384, 172);
ctx.font = "600 31px Georgia, serif";
ctx.fillText("NEW YORK • 1907", 384, 229);
ctx.fillStyle = "#6c5c48";
ctx.font = "22px Arial, sans-serif";
ctx.fillText("NOT A RECORDED PERSON OR LABEL", 384, 298);
const texture = new THREE.CanvasTexture(canvas);
texture.colorSpace = THREE.SRGBColorSpace;
texture.anisotropy = Math.min(
renderer.capabilities.getMaxAnisotropy(),
8
);
return texture;
}
const holder = new THREE.Group();
scene.add(holder);
box(holder, [2.08, 1.08, 0.11], [0, 0, 0], material.wood);
box(holder, [2.13, 0.10, 0.14], [0, 0.54, 0.015], material.brass);
box(holder, [2.13, 0.10, 0.14], [0, -0.54, 0.015], material.brass);
const labelMaterial = new THREE.MeshBasicMaterial({
map: createLabelTexture(),
toneMapped: false
});
const labelCard = new THREE.Mesh(
new THREE.PlaneGeometry(1.85, 0.83),
labelMaterial
);
labelCard.position.set(0, -0.015, 0.061);
holder.add(labelCard);
// Attachment loops and clips.
for (const x of [-0.72, 0.72]) {
box(holder, [0.20, 0.29, 0.07], [x, 0.67, 0.05], material.leather);
box(holder, [0.12, 0.24, 0.08], [x, 0.45, 0.09], material.brass);
}
const attachedPosition = new THREE.Vector3(0, 1.45, 1.56);
const detachedPosition = new THREE.Vector3(3.35, 1.27, 1.0);
holder.position.copy(attachedPosition);
// Small support revealed when the holder is removed.
const holderStand = new THREE.Group();
holderStand.visible = false;
scene.add(holderStand);
box(
holderStand,
[2.25, 0.43, 1.25],
[3.35, 0.43, 1.0],
new THREE.MeshStandardMaterial({
color: "#b8aa94",
roughness: 0.95
})
);
// ---------------------------------------------------------------------
// Display plaque
// ---------------------------------------------------------------------
function createPlaqueTexture() {
const canvas = document.createElement("canvas");
canvas.width = 1200;
canvas.height = 180;
const ctx = canvas.getContext("2d");
ctx.fillStyle = "#ddd3bf";
ctx.fillRect(0, 0, canvas.width, canvas.height);
ctx.strokeStyle = "#7a6650";
ctx.lineWidth = 4;
ctx.strokeRect(12, 12, canvas.width - 24, canvas.height - 24);
ctx.textAlign = "center";
ctx.fillStyle = "#49382b";
ctx.font = "600 34px Georgia, serif";
ctx.fillText("PERIOD TRUNK STUDY · ELLIS ISLAND CONTEXT", 600, 73);
ctx.fillStyle = "#805540";
ctx.font = "700 24px Arial, sans-serif";
ctx.fillText("FICTIONAL IDENTIFIER AND RECONSTRUCTION", 600, 121);
const texture = new THREE.CanvasTexture(canvas);
texture.colorSpace = THREE.SRGBColorSpace;
texture.anisotropy = Math.min(
renderer.capabilities.getMaxAnisotropy(),
8
);
return texture;
}
const plaque = new THREE.Mesh(
new THREE.PlaneGeometry(4.25, 0.64),
new THREE.MeshBasicMaterial({
map: createPlaqueTexture(),
toneMapped: false
})
);
plaque.position.set(0, 0.02, 2.415);
scene.add(plaque);
// ---------------------------------------------------------------------
// Interaction state
// ---------------------------------------------------------------------
const lidButton = document.querySelector("#lidButton");
const holderButton = document.querySelector("#holderButton");
const resetButton = document.querySelector("#resetButton");
const status = document.querySelector("#status");
let lidOpen = false;
let holderDetached = false;
let lidTargetAngle = 0;
let lidCurrentAngle = 0;
function toggleLid() {
lidOpen = !lidOpen;
lidTargetAngle = lidOpen ? -1.76 : 0;
lidButton.textContent = lidOpen ? "Close lid" : "Open lid";
lidButton.classList.toggle("active", lidOpen);
status.textContent = lidOpen
? "Open view: generic period belongings"
: "Closed view: case and travel hardware";
}
function toggleHolder() {
holderDetached = !holderDetached;
holderButton.textContent = holderDetached
? "Attach label holder"
: "Remove label holder";
holderButton.classList.toggle("active", holderDetached);
status.textContent = holderDetached
? "Label holder removed — identifier is fictional"
: "Label holder attached";
}
lidButton.addEventListener("click", toggleLid);
holderButton.addEventListener("click", toggleHolder);
resetButton.addEventListener("click", resetCamera);
window.addEventListener("keydown", (event) => {
if (
event.target instanceof HTMLButtonElement ||
event.target instanceof HTMLInputElement
) {
return;
}
if (event.code === "Space") {
event.preventDefault();
toggleLid();
} else if (event.key.toLowerCase() === "l") {
toggleHolder();
} else if (event.key.toLowerCase() === "r") {
resetCamera();
}
});
// ---------------------------------------------------------------------
// Animation
// ---------------------------------------------------------------------
const clock = new THREE.Clock();
function animate() {
const delta = Math.min(clock.getDelta(), 0.05);
lidCurrentAngle += (lidTargetAngle - lidCurrentAngle) * (1 - Math.exp(-5 * delta));
lidPivot.rotation.x = lidCurrentAngle;
const targetHolderPosition = holderDetached
? detachedPosition
: attachedPosition;
holder.position.lerp(
targetHolderPosition,
1 - Math.exp(-5.5 * delta)
);
const targetHolderY = holderDetached ? -0.34 : 0;
const targetHolderX = holderDetached ? -0.055 : 0;
const targetHolderZ = holderDetached ? 0.025 : 0;
holder.rotation.y += (targetHolderY - holder.rotation.y) * (1 - Math.exp(-5 * delta));
holder.rotation.x += (targetHolderX - holder.rotation.x) * (1 - Math.exp(-5 * delta));
holder.rotation.z += (targetHolderZ - holder.rotation.z) * (1 - Math.exp(-5 * delta));
holderStand.visible =
holderDetached || holder.position.distanceTo(detachedPosition) > 0.18;
updateCamera();
renderer.render(scene, camera);
requestAnimationFrame(animate);
}
function resize() {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
}
window.addEventListener("resize", resize);
updateCamera();
animate();
</script>
</body>
</html>
```