Prompt specification
Build or customize the Three.js 3D scene "Print workshop producing repeated page copies" 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: Print workshop producing repeated page copies
Category: Art & Culture · Style: Procedural Solid / Shader 3D
License: MIT · Reference: https://three3d.app/scene/print-workshop-producing-repeated-page-copies-x2515
Scene Description Prompt:
Create a single self-contained HTML file using Three.js from cdnjs that shows reusable movable type for printing. Create a referenced workshop with composed forme, press, drying area, and sorted type. Follow one layout through several identical impressions before its letters return to storage. Low-poly.
Working Three.js Starter (print-workshop-producing-repeated-page-copies-x2515):
```html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>The Reusable Line — Movable Type Workshop</title>
<style>
:root {
--paper: #eee5d2;
--paper-dark: #d9ccb1;
--ink: #29241f;
--muted: #746b5f;
--accent: #b65f28;
--accent-light: #e1a36c;
--line: rgba(54, 45, 35, .22);
--glass: rgba(244, 237, 222, .91);
}
* { box-sizing: border-box; }
html, body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: #cfc4ad;
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;
width: 100%;
height: 100%;
display: block;
cursor: grab;
touch-action: none;
}
#scene:active { cursor: grabbing; }
.overlay {
position: fixed;
inset: 0;
pointer-events: none;
}
.masthead {
position: absolute;
top: 24px;
left: 28px;
width: min(430px, calc(100vw - 56px));
padding: 21px 23px 20px;
border: 1px solid var(--line);
background: var(--glass);
box-shadow: 0 18px 60px rgba(45, 34, 22, .13);
backdrop-filter: blur(12px);
}
.eyebrow {
display: flex;
align-items: center;
gap: 9px;
margin-bottom: 10px;
color: var(--accent);
font-size: 10px;
font-weight: 800;
letter-spacing: .19em;
text-transform: uppercase;
}
.eyebrow::before {
content: "";
width: 24px;
height: 2px;
background: var(--accent);
}
h1 {
margin: 0;
font-family: Georgia, "Times New Roman", serif;
font-size: clamp(28px, 3.1vw, 44px);
font-weight: 500;
line-height: .98;
letter-spacing: -.035em;
}
.masthead p {
margin: 14px 0 0;
max-width: 360px;
color: var(--muted);
font-size: 13px;
line-height: 1.55;
}
.edition {
display: inline-flex;
align-items: center;
gap: 7px;
margin-top: 16px;
padding: 6px 9px;
border: 1px solid rgba(182, 95, 40, .28);
color: #87502e;
background: rgba(182, 95, 40, .07);
font-size: 10px;
font-weight: 800;
letter-spacing: .12em;
text-transform: uppercase;
}
.edition b {
width: 6px;
height: 6px;
border-radius: 50%;
background: var(--accent);
box-shadow: 0 0 0 4px rgba(182, 95, 40, .12);
}
.status-card {
position: absolute;
top: 24px;
right: 28px;
width: min(330px, calc(100vw - 56px));
padding: 18px 19px;
border: 1px solid var(--line);
background: var(--glass);
box-shadow: 0 18px 60px rgba(45, 34, 22, .11);
backdrop-filter: blur(12px);
}
.status-top {
display: flex;
justify-content: space-between;
align-items: center;
gap: 10px;
margin-bottom: 12px;
color: var(--muted);
font-size: 10px;
font-weight: 800;
letter-spacing: .14em;
text-transform: uppercase;
}
.status-top span:last-child {
color: var(--accent);
}
#phaseTitle {
margin: 0 0 8px;
font-family: Georgia, "Times New Roman", serif;
font-size: 24px;
font-weight: 500;
line-height: 1.08;
}
#phaseCopy {
min-height: 60px;
margin: 0;
color: var(--muted);
font-size: 12px;
line-height: 1.55;
}
.progress {
height: 3px;
margin-top: 16px;
overflow: hidden;
background: rgba(43, 36, 29, .12);
}
#progressFill {
width: 0;
height: 100%;
background: var(--accent);
transform-origin: left;
}
.counter-row {
display: flex;
justify-content: space-between;
margin-top: 8px;
color: var(--muted);
font-size: 10px;
font-weight: 700;
letter-spacing: .08em;
text-transform: uppercase;
}
.bottom {
position: absolute;
left: 28px;
right: 28px;
bottom: 22px;
display: grid;
grid-template-columns: minmax(0, 1fr) auto;
align-items: end;
gap: 18px;
}
.timeline-wrap {
min-width: 0;
padding: 14px 15px 13px;
border: 1px solid var(--line);
background: var(--glass);
box-shadow: 0 12px 40px rgba(45, 34, 22, .12);
backdrop-filter: blur(12px);
}
.timeline {
display: flex;
align-items: stretch;
gap: 0;
overflow-x: auto;
scrollbar-width: none;
}
.timeline::-webkit-scrollbar { display: none; }
.phase-button {
position: relative;
flex: 1 0 auto;
min-width: 80px;
padding: 8px 13px 9px;
border: 0;
border-right: 1px solid rgba(54, 45, 35, .11);
color: #8b8173;
background: transparent;
cursor: pointer;
pointer-events: auto;
text-align: left;
transition: color .2s, background .2s;
}
.phase-button:last-child { border-right: 0; }
.phase-button:hover {
color: var(--ink);
background: rgba(182, 95, 40, .05);
}
.phase-button .number {
display: block;
margin-bottom: 4px;
font-size: 9px;
font-weight: 800;
letter-spacing: .12em;
}
.phase-button .name {
font-family: Georgia, "Times New Roman", serif;
font-size: 14px;
}
.phase-button.active {
color: var(--accent);
background: rgba(182, 95, 40, .08);
}
.phase-button.active::after {
content: "";
position: absolute;
right: 12px;
top: 10px;
width: 5px;
height: 5px;
border-radius: 50%;
background: var(--accent);
}
.controls {
display: flex;
gap: 7px;
padding: 9px;
border: 1px solid var(--line);
background: var(--glass);
box-shadow: 0 12px 40px rgba(45, 34, 22, .12);
backdrop-filter: blur(12px);
pointer-events: auto;
}
.control {
min-width: 42px;
height: 42px;
padding: 0 13px;
border: 1px solid rgba(54, 45, 35, .18);
color: var(--ink);
background: rgba(255, 251, 240, .58);
cursor: pointer;
transition: transform .15s, border-color .15s, background .15s;
}
.control:hover {
border-color: var(--accent);
background: #fff8e9;
transform: translateY(-1px);
}
.control.primary {
border-color: var(--ink);
color: #f8f0de;
background: var(--ink);
}
.control.primary:hover {
border-color: var(--accent);
background: #40372e;
}
.hint {
position: absolute;
left: 50%;
bottom: 132px;
transform: translateX(-50%);
padding: 7px 11px;
border: 1px solid rgba(54, 45, 35, .13);
color: rgba(48, 42, 34, .7);
background: rgba(244, 237, 222, .7);
font-size: 10px;
letter-spacing: .05em;
backdrop-filter: blur(8px);
white-space: nowrap;
}
#tooltip {
position: fixed;
z-index: 10;
display: none;
padding: 8px 10px;
border: 1px solid rgba(54, 45, 35, .2);
color: var(--ink);
background: rgba(248, 241, 224, .96);
box-shadow: 0 8px 24px rgba(45, 34, 22, .13);
font-size: 11px;
pointer-events: none;
}
#loading {
position: fixed;
inset: 0;
z-index: 20;
display: grid;
place-items: center;
color: var(--ink);
background: #d9cfba;
transition: opacity .5s;
}
#loading.hidden {
opacity: 0;
pointer-events: none;
}
.loading-inner {
text-align: center;
}
.loading-inner strong {
display: block;
margin-bottom: 8px;
font-family: Georgia, "Times New Roman", serif;
font-size: 28px;
font-weight: 500;
}
.loading-inner span {
color: var(--muted);
font-size: 10px;
font-weight: 800;
letter-spacing: .15em;
text-transform: uppercase;
}
@media (max-width: 820px) {
.masthead {
top: 14px;
left: 14px;
width: calc(100vw - 28px);
padding: 16px;
}
.masthead p { display: none; }
.edition { margin-top: 11px; }
.status-card {
top: 166px;
right: 14px;
width: 255px;
padding: 14px;
}
#phaseCopy { min-height: 0; }
.bottom {
left: 14px;
right: 14px;
bottom: 14px;
grid-template-columns: 1fr;
}
.controls {
justify-content: center;
}
.hint { display: none; }
.phase-button { min-width: 76px; }
}
</style>
</head>
<body>
<canvas id="scene" aria-label="Interactive low-poly letterpress workshop"></canvas>
<div class="overlay">
<header class="masthead">
<div class="eyebrow">Workshop study No. 03</div>
<h1>The Reusable Line</h1>
<p>
Follow one arrangement of movable type from the type case to the press,
through five identical impressions, and back into storage.
</p>
<div class="edition"><b></b> Type · Forme · Impression · Return</div>
</header>
<aside class="status-card">
<div class="status-top">
<span>Current operation</span>
<span id="phaseNumber">01 / 08</span>
</div>
<h2 id="phaseTitle">The workshop</h2>
<p id="phaseCopy">A composed forme, a hand press, drying sheets, and sorted type occupy one working room.</p>
<div class="progress"><div id="progressFill"></div></div>
<div class="counter-row">
<span id="timeLabel">00:00</span>
<span id="impressionLabel">Five impressions</span>
</div>
</aside>
<div class="hint">Drag to orbit · Scroll to zoom · Click a stage to jump</div>
<div class="bottom">
<div class="timeline-wrap">
<nav class="timeline" id="timeline" aria-label="Workshop stages"></nav>
</div>
<div class="controls">
<button class="control" id="restart" title="Restart">↺</button>
<button class="control primary" id="playPause" title="Pause or resume">Pause</button>
<button class="control" id="next" title="Next operation">Next</button>
<button class="control" id="cameraToggle" title="Toggle guided camera">Tour cam</button>
</div>
</div>
</div>
<div id="tooltip"></div>
<div id="loading">
<div class="loading-inner">
<strong>The Reusable Line</strong>
<span>Setting the type</span>
</div>
</div>
<script type="module">
import * as THREE from "https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
const canvas = document.getElementById("scene");
const loading = document.getElementById("loading");
const tooltip = document.getElementById("tooltip");
const phaseTitle = document.getElementById("phaseTitle");
const phaseCopy = document.getElementById("phaseCopy");
const phaseNumber = document.getElementById("phaseNumber");
const progressFill = document.getElementById("progressFill");
const timeLabel = document.getElementById("timeLabel");
const impressionLabel = document.getElementById("impressionLabel");
const timeline = document.getElementById("timeline");
const playPause = document.getElementById("playPause");
const cameraToggle = document.getElementById("cameraToggle");
const renderer = new THREE.WebGLRenderer({
canvas,
antialias: true,
alpha: false,
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.05;
const scene = new THREE.Scene();
scene.background = new THREE.Color(0xd4cbb8);
scene.fog = new THREE.Fog(0xd4cbb8, 19, 35);
const camera = new THREE.PerspectiveCamera(
42,
window.innerWidth / window.innerHeight,
0.1,
70
);
const cameraTarget = new THREE.Vector3(0, 1.5, -0.5);
const desiredTarget = cameraTarget.clone();
let cameraRadius = 13.5;
let desiredRadius = cameraRadius;
let cameraYaw = 0.66;
let cameraPitch = 0.55;
let guidedCamera = true;
const hemi = new THREE.HemisphereLight(0xf3e9d1, 0x6a5847, 2.25);
scene.add(hemi);
const sun = new THREE.DirectionalLight(0xffe6bc, 3.4);
sun.position.set(-7, 11, 7);
sun.castShadow = true;
sun.shadow.mapSize.set(2048, 2048);
sun.shadow.camera.left = -11;
sun.shadow.camera.right = 11;
sun.shadow.camera.top = 11;
sun.shadow.camera.bottom = -11;
sun.shadow.camera.near = 1;
sun.shadow.camera.far = 30;
sun.shadow.bias = -0.0004;
scene.add(sun);
const fill = new THREE.DirectionalLight(0xa8c0c2, 0.7);
fill.position.set(7, 5, -4);
scene.add(fill);
const materials = {
floor: new THREE.MeshStandardMaterial({
color: 0x85694c, roughness: .91, flatShading: true
}),
floorDark: new THREE.MeshStandardMaterial({
color: 0x4f3c2c, roughness: 1
}),
wall: new THREE.MeshStandardMaterial({
color: 0xbcb19c, roughness: .95, flatShading: true
}),
wallLower: new THREE.MeshStandardMaterial({
color: 0x7f806e, roughness: .93, flatShading: true
}),
wood: new THREE.MeshStandardMaterial({
color: 0x68462f, roughness: .82, flatShading: true
}),
woodLight: new THREE.MeshStandardMaterial({
color: 0x987047, roughness: .84, flatShading: true
}),
woodDark: new THREE.MeshStandardMaterial({
color: 0x422d22, roughness: .9, flatShading: true
}),
iron: new THREE.MeshStandardMaterial({
color: 0x353b3c, roughness: .58, metalness: .52, flatShading: true
}),
ironLight: new THREE.MeshStandardMaterial({
color: 0x666d6c, roughness: .5, metalness: .58, flatShading: true
}),
brass: new THREE.MeshStandardMaterial({
color: 0xa97d38, roughness: .45, metalness: .62, flatShading: true
}),
paper: new THREE.MeshStandardMaterial({
color: 0xeee2c3, roughness: .95, flatShading: true
}),
felt: new THREE.MeshStandardMaterial({
color: 0x334d43, roughness: 1, flatShading: true
}),
glass: new THREE.MeshStandardMaterial({
color: 0x91acb0, roughness: .25, metalness: .05,
transparent: true, opacity: .72, flatShading: true
}),
skin: new THREE.MeshStandardMaterial({
color: 0xc98967, roughness: .9, flatShading: true
}),
shirt: new THREE.MeshStandardMaterial({
color: 0x526c68, roughness: .93, flatShading: true
}),
apron: new THREE.MeshStandardMaterial({
color: 0x7c4b32, roughness: .95, flatShading: true
}),
trousers: new THREE.MeshStandardMaterial({
color: 0x373b3a, roughness: .95, flatShading: true
})
};
function box(w, h, d, material, x, y, z, parent = scene) {
const mesh = new THREE.Mesh(new THREE.BoxGeometry(w, h, d), 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, y, z, parent = scene, segments = 8) {
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, y, z, parent = scene, segments = 8) {
const mesh = new THREE.Mesh(
new THREE.IcosahedronGeometry(radius, 1),
material
);
mesh.position.set(x, y, z);
mesh.castShadow = true;
mesh.receiveShadow = true;
parent.add(mesh);
return mesh;
}
function canvasTexture(canvas, anisotropy = 8) {
const texture = new THREE.CanvasTexture(canvas);
texture.colorSpace = THREE.SRGBColorSpace;
texture.anisotropy = Math.min(anisotropy, renderer.capabilities.getMaxAnisotropy());
return texture;
}
function makeSign(text, width = 2.5, color = "#eee3cd", background = "#343332") {
const c = document.createElement("canvas");
c.width = 512;
c.height = 112;
const ctx = c.getContext("2d");
ctx.fillStyle = background;
ctx.fillRect(0, 0, c.width, c.height);
ctx.strokeStyle = "rgba(255,255,255,.2)";
ctx.lineWidth = 4;
ctx.strokeRect(8, 8, c.width - 16, c.height - 16);
ctx.fillStyle = color;
ctx.font = "700 42px Georgia";
ctx.textAlign = "center";
ctx.textBaseline = "middle";
ctx.fillText(text, c.width / 2, c.height / 2 + 2);
const material = new THREE.SpriteMaterial({
map: canvasTexture(c),
transparent: true,
depthWrite: false
});
const sprite = new THREE.Sprite(material);
sprite.scale.set(width, width * 112 / 512, 1);
return sprite;
}
function makeTypeFace(letter) {
const c = document.createElement("canvas");
c.width = 160;
c.height = 160;
const ctx = c.getContext("2d");
ctx.clearRect(0, 0, 160, 160);
ctx.fillStyle = "#181817";
ctx.textAlign = "center";
ctx.textBaseline = "middle";
ctx.font = "900 92px Georgia";
ctx.save();
ctx.translate(80, 0);
ctx.scale(-1, 1);
ctx.fillText(letter, 80, 83);
ctx.restore();
const texture = canvasTexture(c);
const material = new THREE.MeshBasicMaterial({
map: texture,
transparent: true,
side: THREE.DoubleSide,
depthWrite: false
});
const face = new THREE.Mesh(new THREE.PlaneGeometry(.265, .275), material);
face.rotation.x = -Math.PI / 2;
face.position.y = .176;
return face;
}
function makePrintedPaperTexture() {
const c = document.createElement("canvas");
c.width = 1024;
c.height = 680;
const ctx = c.getContext("2d");
ctx.fillStyle = "#f0e6ca";
ctx.fillRect(0, 0, c.width, c.height);
for (let i = 0; i < 1400; i++) {
const x = (i * 73.71) % c.width;
const y = (i * 41.37) % c.height;
ctx.fillStyle = i % 3 ? "rgba(78,63,39,.025)" : "rgba(255,255,255,.05)";
ctx.fillRect(x, y, 1 + (i % 2), 1);
}
ctx.strokeStyle = "rgba(45,38,30,.12)";
ctx.lineWidth = 2;
ctx.strokeRect(45, 42, c.width - 90, c.height - 84);
ctx.fillStyle = "#29251f";
ctx.textAlign = "center";
ctx.textBaseline = "middle";
ctx.font = "900 126px Georgia";
ctx.fillText("TYPE", 512, 205);
ctx.font = "900 112px Georgia";
ctx.fillText("RE", 512, 365);
ctx.font = "900 112px Georgia";
ctx.fillText("USE", 512, 525);
return canvasTexture(c);
}
// Room shell.
box(16, .22, 12, materials.floor, 0, -.12, 0);
for (let z = -5.6; z <= 5.6; z += .78) {
box(15.7, .012, .025, materials.floorDark, 0, .004, z);
}
box(16.2, 7.2, .22, materials.wall, 0, 3.5, -6.1);
box(16.2, 2.25, .24, materials.wallLower, 0, 1.02, -5.98);
box(.24, 7.2, 12.2, materials.wall, -8.1, 3.5, 0);
box(.26, 2.25, 12, materials.wallLower, -7.98, 1.02, 0);
// Back-wall window.
box(3.1, 2.35, .09, materials.woodDark, 1.7, 4.55, -5.93);
box(2.82, 2.08, .08, materials.glass, 1.7, 4.55, -5.87);
box(.09, 2.14, .12, materials.woodDark, 1.7, 4.55, -5.8);
box(2.9, .09, .12, materials.woodDark, 1.7, 4.55, -5.8);
box(3.45, .16, .44, materials.woodLight, 1.7, 3.31, -5.72);
// Workshop reference board.
const referenceCanvas = document.createElement("canvas");
referenceCanvas.width = 700;
referenceCanvas.height = 440;
const refCtx = referenceCanvas.getContext("2d");
refCtx.fillStyle = "#d7c6a3";
refCtx.fillRect(0, 0, 700, 440);
refCtx.strokeStyle = "#50463a";
refCtx.lineWidth = 7;
refCtx.strokeRect(18, 18, 664, 404);
refCtx.fillStyle = "#50463a";
refCtx.textAlign = "center";
refCtx.font = "700 43px Georgia";
refCtx.fillText("THE COMPOSING ROOM", 350, 78);
refCtx.font = "700 92px Georgia";
refCtx.fillText("TYPE", 350, 200);
refCtx.font = "700 68px Georgia";
refCtx.fillText("RE / USE", 350, 293);
refCtx.strokeStyle = "#9d5c35";
refCtx.lineWidth = 3;
refCtx.beginPath();
refCtx.moveTo(95, 342);
refCtx.lineTo(605, 342);
refCtx.stroke();
refCtx.font = "700 24px sans-serif";
refCtx.fillText("SET · INK · PRINT · RETURN", 350, 384);
const referenceTexture = canvasTexture(referenceCanvas);
const referenceFrame = new THREE.Group();
referenceFrame.position.set(-.55, 3.75, -5.82);
scene.add(referenceFrame);
box(3.45, 2.2, .12, materials.woodDark, 0, 0, -.04, referenceFrame);
const referencePlane = new THREE.Mesh(
new THREE.PlaneGeometry(3.2, 2.02),
new THREE.MeshStandardMaterial({ map: referenceTexture, roughness: .9 })
);
referencePlane.position.z = .035;
referenceFrame.add(referencePlane);
// Type case / sorted storage.
const storage = new THREE.Group();
storage.position.set(-4.8, 0, -5.25);
scene.add(storage);
box(5.2, .16, 1.05, materials.woodDark, 0, .25, 0, storage);
box(5.2, .16, 1.05, materials.woodDark, 0, 4.0, 0, storage);
box(5.2, 3.85, .12, materials.woodDark, 0, 2.12, -.47, storage);
for (const x of [-2.58, -1.3, 0, 1.3, 2.58]) {
box(.12, 3.7, 1.0, materials.woodLight, x, 2.12, 0, storage);
}
for (const y of [.62, 1.42, 2.22, 3.02, 3.82]) {
box(5.05, .1, .94, materials.woodLight, 0, y, .02, storage);
}
// Static sorted sorts, arranged by height and compartment.
let seed = 19;
const rand = () => {
seed = (seed * 9301 + 49297) % 233280;
return seed / 233280;
};
const sortedMetal = [
new THREE.MeshStandardMaterial({ color: 0x656b69, roughness: .62, metalness: .45, flatShading: true }),
new THREE.MeshStandardMaterial({ color: 0x7b7d75, roughness: .68, metalness: .38, flatShading: true }),
new THREE.MeshStandardMaterial({ color: 0x555b5a, roughness: .6, metalness: .48, flatShading: true })
];
for (let row = 0; row < 4; row++) {
const shelfY = .62 + row * .8;
for (let i = 0; i < 26; i++) {
const h = .12 + Math.floor(rand() * 4) * .075;
const x = -2.35 + (i % 13) * .38 + Math.floor(i / 13) * .12;
const z = .13 + (i % 3) * .12;
box(.12 + rand() * .06, h, .18, sortedMetal[i % 3], x, shelfY + .055 + h / 2, z, storage);
}
}
const storageSign = makeSign("SORTED TYPE CASE", 3.1);
storageSign.position.set(-4.8, 4.35, -4.73);
scene.add(storageSign);
// Composing bench.
const bench = new THREE.Group();
bench.position.set(-3, 0, 1);
scene.add(bench);
box(3.15, .18, 1.9, materials.woodLight, 0, 1.16, 0, bench);
box(2.9, .13, 1.68, materials.woodDark, 0, .99, 0, bench);
for (const x of [-1.27, 1.27]) {
for (const z of [-.65, .65]) {
box(.17, 1.08, .17, materials.woodDark, x, .52, z, bench);
}
}
box(2.85, .12, .12, materials.woodDark, 0, .34, 0, bench);
const benchSign = makeSign("COMPOSING BENCH", 2.45);
benchSign.position.set(-3, 1.75, 2.04);
scene.add(benchSign);
// Type chase / forme frame.
const chase = new THREE.Group();
scene.add(chase);
box(2.28, .07, 1.62, materials.iron, 0, 0, 0, chase);
box(2.28, .16, .12, materials.ironLight, 0, .08, -.77, chase);
box(2.28, .16, .12, materials.ironLight, 0, .08, .77, chase);
box(.12, .16, 1.42, materials.ironLight, -1.08, .08, 0, chase);
box(.12, .16, 1.42, materials.ironLight, 1.08, .08, 0, chase);
const quoin = box(.2, .25, .42, materials.brass, 1.18, .16, -.45, chase);
quoin.rotation.z = -.12;
const benchBase = new THREE.Vector3(-3, 1.27, 1);
const pressBase = new THREE.Vector3(1.45, 1.72, -.35);
// The nine reusable pieces in the followed layout.
const letters = ["T", "Y", "P", "E", "R", "E", "U", "S", "E"];
const localLayout = [
new THREE.Vector3(.72, .23, -.43),
new THREE.Vector3(.24, .23, -.43),
new THREE.Vector3(-.24, .23, -.43),
new THREE.Vector3(-.72, .23, -.43),
new THREE.Vector3(.24, .23, .08),
new THREE.Vector3(-.24, .23, .08),
new THREE.Vector3(.48, .23, .59),
new THREE.Vector3(0, .23, .59),
new THREE.Vector3(-.48, .23, .59)
];
const storageSlots = [
new THREE.Vector3(-6.25, 2.28, -4.66),
new THREE.Vector3(-5.85, 2.28, -4.66),
new THREE.Vector3(-5.45, 2.28, -4.66),
new THREE.Vector3(-5.05, 2.28, -4.66),
new THREE.Vector3(-4.65, 2.28, -4.66),
new THREE.Vector3(-4.25, 2.28, -4.66),
new THREE.Vector3(-3.85, 2.28, -4.66),
new THREE.Vector3(-3.45, 2.28, -4.66),
new THREE.Vector3(-3.05, 2.28, -4.66)
];
const pickableBlocks = [];
const typeBlocks = [];
letters.forEach((letter, index) => {
const group = new THREE.Group();
scene.add(group);
const material = new THREE.MeshStandardMaterial({
color: 0x707572,
emissive: 0x6b350c,
emissiveIntensity: .16,
roughness: .52,
metalness: .55,
flatShading: true
});
const body = box(.31, .34, .34, material, 0, 0, 0, group);
body.userData.layoutIndex = index;
body.userData.letter = letter;
pickableBlocks.push(body);
box(.055, .10, .06, materials.ironLight, .165, -.015, .08, group);
group.add(makeTypeFace(letter));
group.position.copy(storageSlots[index]);
typeBlocks.push({ group, body, material, letter, start: storageSlots[index].clone() });
});
// Press frame and bed.
const press = new THREE.Group();
press.position.set(1.45, 0, -.35);
scene.add(press);
box(3.45, .28, 2.6, materials.woodDark, 0, .25, 0, press);
box(3.12, .34, 2.22, materials.iron, 0, 1.53, 0, press);
box(2.85, .025, 1.95, materials.felt, 0, 1.72, 0, press);
for (const x of [-1.43, 1.43]) {
box(.35, 4.2, .48, materials.wood, x, 3.08, -.18, press);
box(.43, .2, .57, materials.woodDark, x, .49, -.18, press);
}
box(3.45, .46, .65, materials.wood, 0, 5.1, -.18, press);
box(3.72, .17, .82, materials.woodDark, 0, 5.4, -.18, press);
cylinder(.12, .12, 1.55, materials.brass, 0, 4.24, 0, press, 10);
cylinder(.38, .38, .16, materials.iron, 0, 3.55, 0, press, 12);
const platen = new THREE.Group();
press.add(platen);
box(2.52, .34, 1.98, materials.ironLight, 0, 0, 0, platen);
box(2.7, .12, 2.15, materials.woodDark, 0, -.24, 0, platen);
cylinder(.065, .065, 1.35, materials.brass, 0, .85, 0, platen, 8);
box(1.48, .09, .11, materials.brass, 0, 1.48, 0, platen);
sphere(.115, materials.woodDark, .74, 1.48, 0, platen);
platen.position.set(0, 3.67, 0);
const pressSign = makeSign("THE HAND PRESS", 2.5);
pressSign.position.set(1.45, 5.84, -.35);
scene.add(pressSign);
// Ink station.
box(1.18, .12, .82, materials.woodDark, -.42, 1.27, 2.05);
for (const x of [-.9, .05]) {
box(.12, 1.13, .12, materials.wood, x, .61, 2.05);
}
box(.72, .12, .55, materials.iron, -.42, 1.38, 2.05);
box(.6, .045, .44, new THREE.MeshStandardMaterial({
color: 0x171718, roughness: .32, metalness: .12, flatShading: true
}), -.42, 1.46, 2.05);
function makeInkBall() {
const group = new THREE.Group();
const leather = new THREE.MeshStandardMaterial({
color: 0x3e3028, roughness: .95, flatShading: true
});
sphere(.29, leather, 0, 0, 0, group);
cylinder(.09, .12, .38, materials.woodLight, 0, .32, 0, group, 8);
sphere(.12, materials.woodDark, 0, .54, 0, group);
return group;
}
const inkBalls = [makeInkBall(), makeInkBall()];
inkBalls[0].position.set(-.72, 1.65, 2.05);
inkBalls[1].position.set(-.12, 1.65, 2.05);
scene.add(...inkBalls);
// Paper stack on a low side table.
box(1.75, .15, 1.28, materials.woodLight, -.35, 1.06, 3.45);
for (const x of [-1.02, .32]) {
for (const z of [3.0, 3.9]) {
box(.12, .96, .12, materials.woodDark, x, .5, z);
}
}
const printedTexture = makePrintedPaperTexture();
const sheets = [];
for (let i = 0; i < 5; i++) {
const sheet = new THREE.Group();
scene.add(sheet);
box(1.48, .032, .98, materials.paper, 0, 0, 0, sheet);
const topMaterial = new THREE.MeshBasicMaterial({ color: 0xeee2c3 });
const top = new THREE.Mesh(new THREE.PlaneGeometry(1.46, .96), topMaterial);
top.rotation.x = -Math.PI / 2;
top.position.y = .019;
sheet.add(top);
sheet.userData.topMaterial = topMaterial;
sheet.userData.printed = false;
sheets.push(sheet);
}
function printSheet(sheet) {
if (sheet.userData.printed) return;
sheet.userData.printed = true;
sheet.userData.topMaterial.map = printedTexture;
sheet.userData.topMaterial.color.set(0xffffff);
sheet.userData.topMaterial.needsUpdate = true;
}
// Drying rack.
const dryingRack = new THREE.Group();
dryingRack.position.set(5.25, 0, 2.7);
scene.add(dryingRack);
for (const x of [-1.02, 1.02]) {
for (const z of [-.58, .58]) {
box(.12, 4.9, .12, materials.woodDark, x, 2.45, z, dryingRack);
}
}
const dryingShelfHeights = [.7, 1.6, 2.5, 3.4, 4.3];
dryingShelfHeights.forEach(y => {
box(2.15, .1, 1.28, materials.woodLight, 0, y, 0, dryingRack);
for (const z of [-.48, .48]) {
box(2.18, .12, .09, materials.woodDark, 0, y - .08, z, dryingRack);
}
});
const dryingSign = makeSign("DRYING RACK", 2.35);
dryingSign.position.set(5.25, 5.05, 2.7);
scene.add(dryingSign);
// A low-poly press operator.
const operator = new THREE.Group();
operator.position.set(3.55, 0, -.78);
operator.rotation.y = -.25;
scene.add(operator);
cylinder(.17, .21, .78, materials.shirt, 0, 1.43, 0, operator, 7);
box(.47, .62, .12, materials.apron, 0, 1.34, .18, operator);
sphere(.22, materials.skin, 0, 2.04, 0, operator);
cylinder(.25, .25, .08, materials.woodDark, 0, 2.22, 0, operator, 8);
cylinder(.12, .14, .77, materials.trousers, -.15, .55, 0, operator, 6);
cylinder(.12, .14, .77, materials.trousers, .15, .55, 0, operator, 6);
box(.26, .14, .44, materials.woodDark, -.15, .12, .06, operator);
box(.26, .14, .44, materials.woodDark, .15, .12, .06, operator);
const armLeft = cylinder(.09, .11, .78, materials.shirt, -.32, 1.53, .08, operator, 6);
armLeft.rotation.z = -.28;
const armRight = cylinder(.09, .11, .78, materials.shirt, .32, 1.53, .08, operator, 6);
armRight.rotation.z = .28;
// Tools and workshop details.
box(.58, .13, .26, materials.woodDark, -4.22, 1.31, 1.4);
box(.08, .08, .66, materials.iron, -3.88, 1.32, 1.45);
box(.28, .28, .28, materials.brass, -4.55, 1.42, 1.12);
for (let i = 0; i < 4; i++) {
cylinder(.07, .08, .31, i % 2 ? materials.woodDark : materials.brass,
3.1 + i * .21, 1.18, 3.68, scene, 8);
}
box(.9, .08, .42, materials.woodDark, 3.51, 1.08, 3.68);
// Small hanging lamp.
cylinder(.015, .015, 1.5, materials.iron, 0.1, 5.85, -.2, scene, 6);
cylinder(.2, .48, .42, materials.iron, 0.1, 4.95, -.2, scene, 10);
sphere(.11, new THREE.MeshBasicMaterial({ color: 0xffd88a }), 0.1, 4.73, -.2);
const phases = [
{
name: "Workshop", short: "Workshop", duration: 4,
title: "The workshop",
copy: "A composed forme, a hand press, drying sheets, and sorted type occupy one working room.",
camera: { target: [0, 1.5, -.5], radius: 13.5 }
},
{
name: "Storage", short: "Storage", duration: 4,
title: "Nine sorts, one layout",
copy: "The individual letters wait in the type case. Each is a reusable piece of metal, not a decoration.",
camera: { target: [-4.8, 2.25, -4.55], radius: 7.2 }
},
{
name: "Compose", short: "Compose", duration: 8,
title: "The forme takes shape",
copy: "The type is picked up one piece at a time and set into a reversed arrangement inside the chase.",
camera: { target: [-3, 1.3, 1], radius: 5.8 }
},
{
name: "Transfer", short: "Transfer", duration: 4,
title: "The chase moves to press",
copy: "The completed forme is carried to the press bed. The arrangement remains locked and unchanged.",
camera: { target: [-.25, 1.8, .1], radius: 9.2 }
},
{
name: "Ink", short: "Ink", duration: 4,
title: "A measured coat of ink",
copy: "Ink balls pass over the raised faces, leaving every letter ready to make the same impression.",
camera: { target: [1.45, 2, -.35], radius: 6.3 }
},
{
name: "Print", short: "Print", duration: 25,
title: "Five identical impressions",
copy: "One sheet follows another beneath the platen. The printed arrangement remains exactly the same each time.",
camera: { target: [1.45, 2.15, -.35], radius: 6.3 }
},
{
name: "Return", short: "Return", duration: 10,
title: "Unlock, distribute, repeat",
copy: "Only after the final sheet are the quoins released. The letters leave the forme and return to storage.",
camera: { target: [-2.1, 1.7, -1.5], radius: 9.5 }
},
{
name: "Complete", short: "Reusable", duration: 5,
title: "Ready for another impression",
copy: "The type is back in the case and five matching sheets are drying. The same layout can be printed again.",
camera: { target: [.2, 1.5, .3], radius: 13.2 }
}
];
let totalTime = 0;
phases.forEach((phase, index) => {
phase.index = index;
phase.start = totalTime;
totalTime += phase.duration;
});
const phaseButtons = phases.map((phase, index) => {
const button = document.createElement("button");
button.className = "phase-button";
button.innerHTML = `<span class="number">${String(index + 1).padStart(2, "0")}</span><span class="name">${phase.short}</span>`;
button.addEventListener("click", () => seek(phase.start + .01));
timeline.appendChild(button);
return button;
});
let playhead = 0;
let playing = true;
let lastPhaseIndex = -1;
let hoveredIndex = -1;
const clamp = THREE.MathUtils.clamp;
const ease = t => {
t = clamp(t, 0, 1);
return t * t * (3 - 2 * t);
};
function seek(time) {
playhead = clamp(time, 0, totalTime);
playing = playhead < totalTime;
updatePlayButton();
}
function updatePlayButton() {
playPause.textContent = playing ? "Pause" : "Play";
}
playPause.addEventListener("click", () => {
if (playhead >= totalTime) {
playhead = 0;
playing = true;
} else {
playing = !playing;
}
updatePlayButton();
});
document.getElementById("restart").addEventListener("click", () => {
playhead = 0;
playing = true;
updatePlayButton();
});
document.getElementById("next").addEventListener("click", () => {
const phase = getPhase(playhead);
if (phase.index === 5) {
const cycle = Math.floor((playhead - phase.start) / 5);
if (cycle < 4) {
seek(phase.start + (cycle + 1) * 5 + .01);
return;
}
}
seek(phases[Math.min(phase.index + 1, phases.length - 1)].start + .01);
});
cameraToggle.addEventListener("click", () => {
guidedCamera = !guidedCamera;
cameraToggle.textContent = guidedCamera ? "Tour cam" : "Manual cam";
if (guidedCamera) {
const phase = getPhase(playhead);
desiredTarget.fromArray(phase.camera.target);
desiredRadius = phase.camera.radius;
}
});
function getPhase(time) {
let found = phases[0];
for (const phase of phases) {
if (time >= phase.start) found = phase;
else break;
}
return found;
}
function setBlockPosition(block, position) {
block.group.position.copy(position);
}
function updateTypeBlocks(phase, local) {
const index = phase.index;
typeBlocks.forEach((block, i) => {
const composeTarget = benchBase.clone().add(localLayout[i]);
const pressTarget = pressBase.clone().add(localLayout[i]);
let position;
let arc = 0;
if (index <= 1) {
position = block.start.clone();
} else if (index === 2) {
const start = i * .54;
const u = ease((local - start) / 2.15);
position = block.start.clone().lerp(composeTarget, u);
arc = Math.sin(u * Math.PI) * .42;
} else if (index === 3) {
const u = ease(local / phase.duration);
position = composeTarget.clone().lerp(pressTarget, u);
arc = Math.sin(u * Math.PI) * .7;
} else if (index === 4) {
position = pressTarget.clone();
} else if (index === 5) {
position = pressTarget.clone();
} else if (index === 6) {
const start = i * .5;
const u = ease((local - start) / 2.25);
position = pressTarget.clone().lerp(block.start, u);
arc = Math.sin(u * Math.PI) * .72;
} else {
position = block.start.clone();
}
position.y += arc;
setBlockPosition(block, position);
let inkAmount = 0;
if (index === 4) inkAmount = Math.sin(clamp(local / phase.duration, 0, 1) * Math.PI);
if (index === 5 || index === 6 || index === 7) inkAmount = 1;
block.material.color.set(0x707572).lerp(new THREE.Color(0x292b2b), inkAmount * .62);
block.material.emissive.set(hoveredIndex === i ? 0xff8a2d : 0x73380c);
block.material.emissiveIntensity = hoveredIndex === i ? .65 : (inkAmount > .5 ? .09 : .16);
});
}
function updateChase(phase, local) {
if (phase.index <= 2) {
chase.position.copy(benchBase);
} else if (phase.index === 3) {
const u = ease(local / phase.duration);
chase.position.copy(benchBase).lerp(pressBase, u);
chase.position.y += Math.sin(u * Math.PI) * .7;
} else if (phase.index === 4 || phase.index === 5) {
chase.position.copy(pressBase);
} else if (phase.index === 6) {
const u = ease((local - 6.4) / 3.6);
chase.position.copy(pressBase).lerp(benchBase, u);
chase.position.y += Math.sin(u * Math.PI) * .55;
} else {
chase.position.copy(benchBase);
}
}
function updateSheets(phase, local) {
const stackBase = new THREE.Vector3(-.35, 1.17 + .035, 3.45);
const pressPaper = new THREE.Vector3(1.45, 2.165, -.35);
const dryPositions = dryingShelfHeights.map(y => new THREE.Vector3(5.25, y + .085, 2.7));
let cycle = -1;
let cycleLocal = 0;
if (phase.index === 5) {
cycle = Math.min(4, Math.floor(local / 5));
cycleLocal = local - cycle * 5;
}
sheets.forEach((sheet, i) => {
if (phase.index < 5) {
sheet.position.copy(stackBase);
sheet.position.y += i * .034;
sheet.position.z += (i % 2) * .012;
return;
}
if (phase.index === 5 && i > cycle) {
sheet.position.copy(stackBase);
sheet.position.y += i * .034;
sheet.position.z += (i % 2) * .012;
return;
}
if (phase.index === 5 && i < cycle) {
sheet.position.copy(dryPositions[i]);
printSheet(sheet);
return;
}
if (phase.index > 5) {
sheet.position.copy(dryPositions[i]);
printSheet(sheet);
return;
}
if (i === cycle) {
if (cycleLocal < .85) {
const u = ease(cycleLocal / .85);
sheet.position.copy(stackBase).lerp(pressPaper, u);
sheet.position.y += Math.sin(u * Math.PI) * .34;
} else if (cycleLocal < 2.35) {
sheet.position.copy(pressPaper);
} else if (cycleLocal < 4.55) {
const u = ease((cycleLocal - 2.35) / 2.2);
sheet.position.copy(pressPaper).lerp(dryPositions[i], u);
sheet.position.y += Math.sin(u * Math.PI) * .85;
} else {
sheet.position.copy(dryPositions[i]);
}
if (cycleLocal >= 1.52) printSheet(sheet);
}
});
}
function updatePress(phase, local) {
const high = 3.67;
const low = 2.43;
let y = high;
if (phase.index === 5) {
const cycle = Math.min(4, Math.floor(local / 5));
const t = local - cycle * 5;
if (t < .75) y = high;
else if (t < 1.55) y = THREE.MathUtils.lerp(high, low, ease((t - .75) / .8));
else if (t < 2.12) y = low;
else if (t < 2.8) y = THREE.MathUtils.lerp(low, high, ease((t - 2.12) / .68));
else y = high;
}
platen.position.y = y;
operator.rotation.z = THREE.MathUtils.lerp(operator.rotation.z, phase.index === 5 ? -.02 : 0, .1);
}
function updateInkBalls(phase, local) {
const restA = new THREE.Vector3(-.72, 1.65, 2.05);
const restB = new THREE.Vector3(-.12, 1.65, 2.05);
const pressA = new THREE.Vector3(1.05, 2.32, -.62);
const pressB = new THREE.Vector3(1.72, 2.32, -.12);
if (phase.index === 4) {
const u = clamp(local / phase.duration, 0, 1);
const travel = ease(clamp(u / .28, 0, 1));
const returnU = ease(clamp((u - .76) / .24, 0, 1));
const a = restA.clone().lerp(pressA, travel).lerp(restA, returnU);
const b = restB.clone().lerp(pressB, travel).lerp(restB, returnU);
if (u > .3 && u < .72) {
a.x += Math.sin((u - .3) * 18) * .3;
a.z += Math.cos((u - .3) * 18) * .2;
b.x += Math.sin((u - .3) * 18 + 1) * .28;
b.z += Math.cos((u - .3) * 18 + 1) * .18;
}
inkBalls[0].position.copy(a);
inkBalls[1].position.copy(b);
} else {
inkBalls[0].position.copy(restA);
inkBalls[1].position.copy(restB);
}
}
function updateUI(phase) {
if (phase.index !== lastPhaseIndex) {
phaseTitle.textContent = phase.title;
phaseCopy.textContent = phase.copy;
phaseNumber.textContent = `${String(phase.index + 1).padStart(2, "0")} / ${String(phases.length).padStart(2, "0")}`;
phaseButtons.forEach((button, index) => {
button.classList.toggle("active", index === phase.index);
if (index === phase.index) {
button.scrollIntoView({ behavior: "smooth", block: "nearest", inline: "nearest" });
}
});
lastPhaseIndex = phase.index;
}
progressFill.style.width = `${(playhead / totalTime) * 100}%`;
const seconds = Math.floor(playhead);
timeLabel.textContent = `${String(Math.floor(seconds / 60)).padStart(2, "0")}:${String(seconds % 60).padStart(2, "0")}`;
if (phase.index === 5) {
const cycle = Math.min(5, Math.floor((playhead - phase.start) / 5) + 1);
impressionLabel.textContent = `Impression ${cycle} of 5`;
} else if (phase.index > 5) {
impressionLabel.textContent = "Five matching sheets";
} else {
impressionLabel.textContent = "Five impressions";
}
}
function updateCamera(phase, dt) {
if (guidedCamera) {
desiredTarget.fromArray(phase.camera.target);
desiredRadius = phase.camera.radius;
cameraTarget.lerp(desiredTarget, 1 - Math.exp(-dt * 1.55));
cameraRadius = THREE.MathUtils.lerp(cameraRadius, desiredRadius, 1 - Math.exp(-dt * 1.45));
}
const cosPitch = Math.cos(cameraPitch);
camera.position.set(
cameraTarget.x + cameraRadius * Math.sin(cameraYaw) * cosPitch,
cameraTarget.y + cameraRadius * Math.sin(cameraPitch),
cameraTarget.z + cameraRadius * Math.cos(cameraYaw) * cosPitch
);
camera.lookAt(cameraTarget);
}
// Direct camera controls, implemented without external controls modules.
let pointerDown = false;
let dragging = false;
let lastPointerX = 0;
let lastPointerY = 0;
let startPointerX = 0;
let startPointerY = 0;
const raycaster = new THREE.Raycaster();
const pointer = new THREE.Vector2();
canvas.addEventListener("pointerdown", event => {
pointerDown = true;
dragging = false;
lastPointerX = startPointerX = event.clientX;
lastPointerY = startPointerY = event.clientY;
canvas.setPointerCapture(event.pointerId);
});
canvas.addEventListener("pointermove", event => {
if (pointerDown) {
const dx = event.clientX - lastPointerX;
const dy = event.clientY - lastPointerY;
if (Math.hypot(event.clientX - startPointerX, event.clientY - startPointerY) > 4) {
dragging = true;
guidedCamera = false;
cameraToggle.textContent = "Manual cam";
}
if (dragging) {
cameraYaw -= dx * .005;
cameraPitch = clamp(cameraPitch + dy * .004, .18, 1.12);
}
lastPointerX = event.clientX;
lastPointerY = event.clientY;
}
if (dragging) {
tooltip.style.display = "none";
return;
}
const rect = canvas.getBoundingClientRect();
pointer.x = ((event.clientX - rect.left) / rect.width) * 2 - 1;
pointer.y = -((event.clientY - rect.top) / rect.height) * 2 + 1;
raycaster.setFromCamera(pointer, camera);
const hit = raycaster.intersectObjects(pickableBlocks, false)[0];
if (hit) {
const index = hit.object.userData.layoutIndex;
hoveredIndex = index;
const letter = hit.object.userData.letter;
tooltip.textContent = `Movable type · “${letter}” · reusable sort`;
tooltip.style.display = "block";
tooltip.style.left = `${Math.min(event.clientX + 14, window.innerWidth - 190)}px`;
tooltip.style.top = `${Math.min(event.clientY + 14, window.innerHeight - 45)}px`;
canvas.style.cursor = "pointer";
} else {
hoveredIndex = -1;
tooltip.style.display = "none";
canvas.style.cursor = pointerDown ? "grabbing" : "grab";
}
});
function endPointer(event) {
pointerDown = false;
dragging = false;
if (event.pointerId !== undefined && canvas.hasPointerCapture(event.pointerId)) {
canvas.releasePointerCapture(event.pointerId);
}
}
canvas.addEventListener("pointerup", endPointer);
canvas.addEventListener("pointercancel", endPointer);
canvas.addEventListener("pointerleave", () => {
tooltip.style.display = "none";
hoveredIndex = -1;
});
canvas.addEventListener("wheel", event => {
event.preventDefault();
guidedCamera = false;
cameraToggle.textContent = "Manual cam";
cameraRadius = clamp(cameraRadius + event.deltaY * .008, 3.2, 23);
}, { passive: false });
window.addEventListener("resize", () => {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.setSize(window.innerWidth, window.innerHeight);
});
let previousTime = performance.now();
renderer.setAnimationLoop(now => {
const dt = Math.min((now - previousTime) / 1000, .05);
previousTime = now;
if (playing) {
playhead = Math.min(totalTime, playhead + dt);
if (playhead >= totalTime) {
playing = false;
updatePlayButton();
}
}
const phase = getPhase(playhead);
const local = clamp(playhead - phase.start, 0, phase.duration);
updateTypeBlocks(phase, local);
updateChase(phase, local);
updateSheets(phase, local);
updatePress(phase, local);
updateInkBalls(phase, local);
updateUI(phase);
updateCamera(phase, dt);
renderer.render(scene, camera);
});
// Render once before removing the loading screen.
renderer.render(scene, camera);
requestAnimationFrame(() => {
loading.classList.add("hidden");
setTimeout(() => loading.remove(), 600);
});
</script>
</body>
</html>
```