Prompt specification
Build or customize the Three.js 3D scene "Print shop and street reading gathering" 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 shop and street reading gathering
Category: Art & Culture · Style: Procedural Solid / Shader 3D
License: MIT · Reference: https://three3d.app/scene/print-shop-and-street-reading-gathering-x2339
Scene Description Prompt:
Create a single self-contained HTML file using Three.js from cdnjs that shows early printed news sheets and their distribution. Build a compact street scene linking press room, sheet drying, vendor, and readers. Show information moving through several people without inventing a real historical proclamation. Low-poly.
Working Three.js Starter (print-shop-and-street-reading-gathering-x2339):
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>The News on the Street</title>
<style>
:root {
--ink: #26373a;
--muted: #657274;
--paper: #f6efdf;
--rust: #b85e3f;
--gold: #d59b45;
--green: #42665a;
--line: rgba(38, 55, 58, 0.16);
}
* {
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: #e9e1d5;
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;
cursor: grab;
}
#scene canvas:active {
cursor: grabbing;
}
.masthead {
position: fixed;
z-index: 10;
top: 24px;
left: 28px;
width: min(460px, calc(100vw - 56px));
pointer-events: none;
text-shadow: 0 1px rgba(255, 255, 255, 0.35);
}
.eyebrow {
display: flex;
align-items: center;
gap: 9px;
margin-bottom: 8px;
color: var(--rust);
font-size: 11px;
font-weight: 800;
letter-spacing: 0.19em;
text-transform: uppercase;
}
.eyebrow::before {
width: 30px;
height: 2px;
background: var(--rust);
content: "";
}
h1 {
margin: 0;
font-family: Georgia, "Times New Roman", serif;
font-size: clamp(30px, 4vw, 52px);
font-weight: 500;
line-height: 0.98;
letter-spacing: -0.035em;
}
.masthead p {
max-width: 420px;
margin: 13px 0 0;
color: #526164;
font-size: 13px;
line-height: 1.5;
}
.actions {
position: fixed;
z-index: 20;
top: 22px;
right: 24px;
display: flex;
gap: 8px;
}
button {
appearance: none;
border: 1px solid rgba(38, 55, 58, 0.18);
border-radius: 999px;
padding: 10px 14px;
background: rgba(246, 239, 223, 0.88);
color: var(--ink);
box-shadow: 0 5px 20px rgba(40, 44, 40, 0.08);
backdrop-filter: blur(10px);
cursor: pointer;
font: inherit;
font-size: 12px;
font-weight: 700;
transition: transform 150ms ease, background 150ms ease;
}
button:hover {
background: #fff9ed;
transform: translateY(-1px);
}
button:focus-visible {
outline: 2px solid var(--rust);
outline-offset: 3px;
}
.route-panel {
position: fixed;
z-index: 12;
bottom: 24px;
left: 28px;
width: min(410px, calc(100vw - 56px));
padding: 17px 18px 15px;
border: 1px solid rgba(38, 55, 58, 0.14);
border-radius: 16px;
background: rgba(246, 239, 223, 0.9);
box-shadow: 0 16px 50px rgba(40, 44, 40, 0.12);
backdrop-filter: blur(14px);
}
.panel-title {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 12px;
font-size: 11px;
font-weight: 800;
letter-spacing: 0.14em;
text-transform: uppercase;
}
.panel-title span:last-child {
color: var(--rust);
font-size: 10px;
}
.steps {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 6px;
}
.step {
position: relative;
min-width: 0;
padding-right: 8px;
}
.step:not(:last-child)::after {
position: absolute;
top: 12px;
right: 1px;
color: #a7aaa4;
content: "→";
font-size: 12px;
}
.step b {
display: block;
margin-bottom: 3px;
color: var(--rust);
font-family: Georgia, serif;
font-size: 19px;
font-weight: 500;
}
.step span {
display: block;
overflow: hidden;
color: #526164;
font-size: 10px;
font-weight: 700;
line-height: 1.2;
text-overflow: ellipsis;
text-transform: uppercase;
}
.disclaimer {
margin: 13px 0 0;
padding-top: 11px;
border-top: 1px solid var(--line);
color: #6c7474;
font-size: 10px;
line-height: 1.45;
}
.controls-hint {
position: fixed;
z-index: 10;
right: 26px;
bottom: 24px;
padding: 9px 12px;
border-radius: 999px;
background: rgba(246, 239, 223, 0.76);
color: #667072;
font-size: 10px;
font-weight: 650;
backdrop-filter: blur(10px);
pointer-events: none;
}
#label-layer {
position: fixed;
z-index: 8;
inset: 0;
overflow: hidden;
pointer-events: none;
}
.scene-label {
position: absolute;
display: flex;
align-items: center;
gap: 7px;
padding: 6px 9px;
border: 1px solid rgba(38, 55, 58, 0.13);
border-radius: 8px;
background: rgba(250, 246, 237, 0.9);
box-shadow: 0 5px 18px rgba(39, 45, 42, 0.09);
color: var(--ink);
font-size: 9px;
font-weight: 800;
letter-spacing: 0.1em;
text-transform: uppercase;
transform: translate(-50%, -100%);
transition: opacity 120ms linear;
white-space: nowrap;
}
.scene-label::after {
position: absolute;
bottom: -17px;
left: 50%;
width: 1px;
height: 16px;
background: rgba(38, 55, 58, 0.3);
content: "";
}
.scene-label i {
width: 6px;
height: 6px;
border-radius: 50%;
background: var(--rust);
box-shadow: 0 0 0 3px rgba(184, 94, 63, 0.13);
}
#loading {
position: fixed;
z-index: 100;
inset: 0;
display: grid;
place-items: center;
background: #e9e1d5;
color: var(--ink);
transition: opacity 450ms ease, visibility 450ms ease;
}
#loading.hidden {
visibility: hidden;
opacity: 0;
}
.loader {
text-align: center;
}
.loader-mark {
width: 38px;
height: 50px;
margin: 0 auto 16px;
border: 2px solid var(--ink);
border-radius: 3px;
box-shadow: 7px 7px 0 var(--rust);
transform: rotate(-4deg);
}
.loader p {
margin: 0;
font-family: Georgia, serif;
font-size: 19px;
}
@media (max-width: 760px) {
.masthead {
top: 18px;
left: 18px;
width: calc(100vw - 36px);
}
.masthead p {
max-width: 310px;
font-size: 11px;
}
.actions {
top: auto;
right: 16px;
bottom: 16px;
}
.route-panel {
bottom: 16px;
left: 16px;
width: min(350px, calc(100vw - 32px));
padding: 13px 14px;
}
.controls-hint {
display: none;
}
.scene-label {
font-size: 8px;
}
}
@media (max-width: 520px) {
h1 {
max-width: 280px;
}
.masthead p,
.disclaimer,
.panel-title span:last-child {
display: none;
}
.route-panel {
right: 16px;
width: auto;
}
.actions {
bottom: 112px;
}
button {
padding: 9px 11px;
font-size: 10px;
}
}
</style>
</head>
<body>
<div id="scene" aria-label="Interactive low-poly street scene showing printed news moving from a press room to readers"></div>
<header class="masthead">
<div class="eyebrow">An early print workflow</div>
<h1>The News on the Street</h1>
<p>
Follow a printed sheet from the hand press, through drying and sale,
into the hands of readers.
</p>
</header>
<nav class="actions" aria-label="Scene controls">
<button id="flow-button" type="button">Pause copies</button>
<button id="labels-button" type="button">Hide labels</button>
<button id="reset-button" type="button">Reset view</button>
</nav>
<div id="label-layer" aria-hidden="true">
<div class="scene-label" id="label-press"><i></i>01 · Press room</div>
<div class="scene-label" id="label-dry"><i></i>02 · Sheet drying</div>
<div class="scene-label" id="label-vendor"><i></i>03 · Street vendor</div>
<div class="scene-label" id="label-readers"><i></i>04 · Readers</div>
</div>
<aside class="route-panel">
<div class="panel-title">
<span>The four-hand route</span>
<span>One story · many copies</span>
</div>
<div class="steps">
<div class="step"><b>01</b><span>Print</span></div>
<div class="step"><b>02</b><span>Dry</span></div>
<div class="step"><b>03</b><span>Sell</span></div>
<div class="step"><b>04</b><span>Read</span></div>
</div>
<p class="disclaimer">
Generic printed reports only. This scene does not depict or invent a real
historical proclamation, dated event, or named document.
</p>
</aside>
<div class="controls-hint">Drag to orbit · Shift/right-drag to pan · Scroll or pinch to zoom</div>
<div id="loading">
<div class="loader">
<div class="loader-mark"></div>
<p>Setting the type…</p>
</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 sceneEl = document.querySelector("#scene");
const loadingEl = document.querySelector("#loading");
const flowButton = document.querySelector("#flow-button");
const labelsButton = document.querySelector("#labels-button");
const resetButton = document.querySelector("#reset-button");
const scene = new THREE.Scene();
scene.background = new THREE.Color(0xe9e1d5);
scene.fog = new THREE.Fog(0xe9e1d5, 32, 58);
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.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1.12;
sceneEl.appendChild(renderer.domElement);
const camera = new THREE.OrthographicCamera(-12, 12, 7, -7, 0.1, 100);
const cameraTarget = new THREE.Vector3(0.1, 1, 0.05);
let cameraTheta = 0.38;
let cameraPhi = 0.96;
let cameraRadius = 21;
let cameraZoom = 1;
const hemi = new THREE.HemisphereLight(0xf8f0df, 0x6e665b, 2.15);
scene.add(hemi);
const sun = new THREE.DirectionalLight(0xffedcf, 3.25);
sun.position.set(-9, 17, 10);
sun.castShadow = true;
sun.shadow.mapSize.set(2048, 2048);
sun.shadow.camera.left = -18;
sun.shadow.camera.right = 18;
sun.shadow.camera.top = 15;
sun.shadow.camera.bottom = -12;
sun.shadow.camera.near = 1;
sun.shadow.camera.far = 45;
sun.shadow.bias = -0.00035;
scene.add(sun);
const fill = new THREE.DirectionalLight(0xc6d9dc, 0.85);
fill.position.set(12, 7, -10);
scene.add(fill);
const material = (color, options = {}) =>
new THREE.MeshStandardMaterial({
color,
roughness: 0.88,
metalness: 0,
flatShading: true,
...options
});
const M = {
ground: material(0xb9ad91),
earth: material(0x807761),
edge: material(0x6f695b),
cobble: material(0xffffff, { vertexColors: true }),
wall: material(0xd8c39c),
wallLight: material(0xead8b6),
timber: material(0x594536),
roof: material(0x9b4938),
roofDark: material(0x7c392f),
wood: material(0x956a43),
woodDark: material(0x503c31),
metal: material(0x384449, { roughness: 0.6, metalness: 0.35 }),
metalLight: material(0x667477, { roughness: 0.52, metalness: 0.4 }),
paper: material(0xfff7df),
paperShade: material(0xe6dcc3),
ink: material(0x39464a),
rust: material(0xb85e3f),
gold: material(0xd59b45),
green: material(0x42665a),
blue: material(0x537b8a),
ochre: material(0xc28d45),
skin: material(0xc98f68),
skinLight: material(0xe0ad82),
hair: material(0x47372e),
black: material(0x252d2e),
barrel: material(0x765b40),
leaf: material(0x687b50),
leafLight: material(0x829260)
};
function mesh(parent, geometry, mat, position = [0, 0, 0], rotation = [0, 0, 0]) {
const object = new THREE.Mesh(geometry, mat);
object.position.set(...position);
object.rotation.set(...rotation);
object.castShadow = true;
object.receiveShadow = true;
parent.add(object);
return object;
}
function box(parent, size, position, mat, rotation = [0, 0, 0]) {
return mesh(
parent,
new THREE.BoxGeometry(...size),
mat,
position,
rotation
);
}
function cylinder(
parent,
radiiHeight,
position,
mat,
rotation = [0, 0, 0],
segments = 8
) {
return mesh(
parent,
new THREE.CylinderGeometry(
radiiHeight[0],
radiiHeight[1],
radiiHeight[2],
segments
),
mat,
position,
rotation
);
}
function makeSign(text, width = 512, height = 144) {
const canvas = document.createElement("canvas");
canvas.width = width;
canvas.height = height;
const ctx = canvas.getContext("2d");
ctx.fillStyle = "#f2e7cf";
ctx.fillRect(0, 0, width, height);
ctx.strokeStyle = "#514539";
ctx.lineWidth = 8;
ctx.strokeRect(8, 8, width - 16, height - 16);
ctx.fillStyle = "#354447";
ctx.textAlign = "center";
ctx.textBaseline = "middle";
ctx.font = `700 ${Math.floor(height * 0.37)}px Georgia`;
ctx.fillText(text, width / 2, height / 2 + 2);
const texture = new THREE.CanvasTexture(canvas);
texture.colorSpace = THREE.SRGBColorSpace;
texture.anisotropy = Math.min(4, renderer.capabilities.getMaxAnisotropy());
return new THREE.MeshBasicMaterial({ map: texture });
}
function addSign(parent, text, size, position, rotation = [0, 0, 0]) {
return mesh(
parent,
new THREE.PlaneGeometry(...size),
makeSign(text),
position,
rotation
);
}
function makePaper(scale = 1) {
const group = new THREE.Group();
group.scale.setScalar(scale);
box(group, [0.42, 0.58, 0.025], [0, 0, 0], M.paper);
// A generic masthead and rows of type, not a reproduction of any document.
box(group, [0.27, 0.045, 0.006], [0, 0.20, 0.016], M.rust);
box(group, [0.09, 0.09, 0.006], [-0.11, 0.075, 0.016], M.ink);
[-0.015, 0.055, 0.125, 0.195].forEach((y, index) => {
const lineWidth = index === 3 ? 0.20 : 0.28;
box(
group,
[lineWidth, 0.014, 0.006],
[-0.035, y, 0.016],
M.ink
);
});
return group;
}
function makePaperStack(parent, x, y, z, count = 7, spread = 0.04) {
const group = new THREE.Group();
group.position.set(x, y, z);
parent.add(group);
for (let i = 0; i < count; i++) {
const sheet = box(
group,
[0.62, 0.025, 0.72],
[
(Math.random() - 0.5) * spread,
i * 0.029,
(Math.random() - 0.5) * spread
],
i % 3 === 0 ? M.paperShade : M.paper
);
sheet.rotation.y = (Math.random() - 0.5) * 0.08;
}
return group;
}
// Diorama base and cobbled street.
box(scene, [25, 0.8, 10], [0, -0.48, 0.3], M.edge);
box(scene, [24.7, 0.14, 9.7], [0, -0.02, 0.3], M.ground);
const cobbleCountX = 30;
const cobbleCountZ = 8;
const cobbleGeometry = new THREE.BoxGeometry(0.68, 0.075, 0.48);
const cobbles = new THREE.InstancedMesh(cobbleGeometry, M.cobble, cobbleCountX * cobbleCountZ);
const dummy = new THREE.Object3D();
const cobbleColors = [0xc4b9a0, 0xb8ad95, 0xcec2aa, 0xb0a58f];
let cobbleIndex = 0;
for (let x = 0; x < cobbleCountX; x++) {
for (let z = 0; z < cobbleCountZ; z++) {
dummy.position.set(-11.4 + x * 0.78, 0.085, -0.6 + z * 0.58);
dummy.scale.set(
0.95 + ((x + z) % 3) * 0.025,
1,
0.94 + ((x * 2 + z) % 3) * 0.025
);
dummy.rotation.y = (((x + z) % 3) - 1) * 0.012;
dummy.updateMatrix();
cobbles.setMatrixAt(cobbleIndex, dummy.matrix);
cobbles.setColorAt(
cobbleIndex,
new THREE.Color(cobbleColors[(x + z * 2) % cobbleColors.length])
);
cobbleIndex++;
}
}
cobbles.receiveShadow = true;
scene.add(cobbles);
box(scene, [24, 0.18, 0.7], [0, 0.08, -0.18], M.wallLight);
// Cutaway press room.
const pressRoom = new THREE.Group();
scene.add(pressRoom);
box(pressRoom, [6.35, 0.18, 3.55], [-7.25, 0.16, -1.85], M.wallLight);
box(pressRoom, [6.35, 3.05, 0.24], [-7.25, 1.68, -3.52], M.wall);
box(pressRoom, [0.24, 3.05, 3.55], [-10.38, 1.68, -1.85], M.wall);
box(pressRoom, [0.24, 1.25, 3.55], [-4.12, 0.72, -1.85], M.wall);
[-10.22, -8.55, -6.05, -4.2].forEach((x) => {
box(pressRoom, [0.18, 3.1, 0.18], [x, 1.68, -3.34], M.timber);
});
box(pressRoom, [6.4, 0.18, 0.18], [-7.25, 3.08, -3.34], M.timber);
box(pressRoom, [6.4, 0.18, 0.18], [-7.25, 0.25, -3.34], M.timber);
// Only the rear roof slope is shown so that the press remains visible.
box(
pressRoom,
[6.7, 0.16, 2.05],
[-7.25, 3.35, -2.7],
M.roof,
[0.38, 0, 0]
);
[-9.8, -7.25, -4.7].forEach((x) => {
box(
pressRoom,
[0.15, 0.15, 3.25],
[x, 3.08, -1.85],
M.timber,
[0.14, 0, 0]
);
});
addSign(pressRoom, "PRINT HOUSE", [2.65, 0.64], [-7.25, 2.5, -3.385]);
const windowPanel = box(
pressRoom,
[1.15, 0.95, 0.05],
[-9.35, 1.75, -3.365],
M.blue
);
box(pressRoom, [0.08, 1.0, 0.08], [-9.35, 1.75, -3.32], M.timber);
box(pressRoom, [1.2, 0.08, 0.08], [-9.35, 1.75, -3.32], M.timber);
// Hand-operated printing press.
const press = new THREE.Group();
press.position.set(-7.55, 0, -1.82);
scene.add(press);
box(press, [1.7, 0.28, 1.35], [0, 0.34, 0], M.woodDark);
box(press, [1.45, 0.16, 1.1], [0, 0.56, 0], M.wood);
[-0.62, 0.62].forEach((x) => {
box(press, [0.19, 2.15, 0.24], [x, 1.58, -0.1], M.metal);
box(press, [0.34, 0.22, 0.36], [x, 0.69, -0.1], M.metalLight);
});
box(press, [1.48, 0.22, 0.36], [0, 2.63, -0.1], M.metal);
cylinder(press, [0.09, 0.09, 0.95], [0, 2.14, -0.1], M.metalLight, [0, 0, 0], 10);
const platen = box(press, [1.15, 0.17, 0.9], [0, 1.43, 0], M.metalLight);
box(press, [1.02, 0.055, 0.76], [0, 1.31, 0], M.paperShade);
const flywheel = new THREE.Group();
flywheel.position.set(0.96, 1.38, -0.08);
press.add(flywheel);
mesh(
flywheel,
new THREE.TorusGeometry(0.47, 0.075, 6, 14),
M.metal,
[0, 0, 0],
[0, Math.PI / 2, 0]
);
box(flywheel, [0.08, 0.88, 0.08], [0, 0, 0], M.metalLight);
box(flywheel, [0.08, 0.08, 0.88], [0, 0, 0], M.metalLight);
cylinder(flywheel, [0.12, 0.12, 0.23], [0, 0, 0], M.rust, [0, 0, Math.PI / 2], 10);
const pressLever = new THREE.Group();
pressLever.position.set(0.78, 1.28, 0.38);
press.add(pressLever);
box(pressLever, [0.1, 0.1, 1.15], [0, 0, 0.48], M.woodDark);
cylinder(pressLever, [0.08, 0.08, 0.35], [0, 0, 1.06], M.wood, [Math.PI / 2, 0, 0], 8);
const outputPaper = makePaper(0.95);
outputPaper.position.set(-6.05, 0.68, -0.7);
outputPaper.rotation.set(-Math.PI / 2, 0.12, 0);
scene.add(outputPaper);
makePaperStack(scene, -4.72, 0.12, -2.6, 8, 0.16);
makePaperStack(scene, -4.72, 0.12, -1.88, 6, 0.16);
// Drying rack.
const dryingRack = new THREE.Group();
dryingRack.position.set(-1.95, 0, -1.56);
scene.add(dryingRack);
[-1.62, 1.62].forEach((x) => {
box(dryingRack, [0.16, 2.32, 0.16], [x, 1.22, 0], M.wood);
box(dryingRack, [0.5, 0.12, 0.65], [x, 0.18, 0], M.woodDark);
box(dryingRack, [0.11, 0.11, 0.95], [x, 1.42, 0], M.woodDark, [Math.PI / 2, 0, 0]);
});
[2.25, 1.55, 0.85].forEach((y) => {
box(dryingRack, [3.35, 0.09, 0.09], [0, y, 0], M.woodDark);
});
const hangingSheets = [];
for (let i = 0; i < 7; i++) {
const hanger = new THREE.Group();
hanger.position.set(-1.42 + i * 0.47, 2.22, 0.02);
dryingRack.add(hanger);
const paper = makePaper(0.78);
paper.position.y = -0.32;
hanger.add(paper);
hangingSheets.push(hanger);
}
// Vendor cart.
const cart = new THREE.Group();
cart.position.set(3.18, 0, 0.18);
scene.add(cart);
box(cart, [2.8, 0.65, 1.28], [0, 0.82, 0], M.green);
box(cart, [2.95, 0.13, 1.42], [0, 1.18, 0], M.wood);
box(cart, [2.85, 0.08, 1.3], [0, 0.51, 0], M.woodDark);
[-0.93, 0.93].forEach((x) => {
[-0.72, 0.72].forEach((z) => {
const wheel = cylinder(
cart,
[0.37, 0.37, 0.16],
[x, 0.43, z],
M.metal,
[Math.PI / 2, 0, 0],
10
);
const hub = cylinder(
cart,
[0.1, 0.1, 0.19],
[x, 0.43, z],
M.rust,
[Math.PI / 2, 0, 0],
8
);
wheel.castShadow = hub.castShadow = true;
});
});
[-1.24, 1.24].forEach((x) => {
[-0.54, 0.54].forEach((z) => {
box(cart, [0.08, 1.2, 0.08], [x, 1.77, z], M.woodDark);
});
});
for (let i = 0; i < 8; i++) {
const stripeMaterial = i % 2 === 0 ? M.rust : M.paper;
box(
cart,
[0.34, 0.12, 1.62],
[-1.19 + i * 0.34, 2.35, 0],
stripeMaterial
);
}
box(cart, [2.8, 0.22, 0.1], [0, 2.16, 0.77], M.rust);
addSign(cart, "PRINTED NEWS", [2.2, 0.56], [0, 0.91, 0.655]);
makePaperStack(cart, -0.72, 1.28, 0, 10, 0.08);
makePaperStack(cart, 0.15, 1.28, 0.04, 12, 0.08);
makePaperStack(cart, 0.9, 1.28, -0.04, 8, 0.08);
// Low-poly people.
function makePerson(x, z, shirtMaterial, options = {}) {
const root = new THREE.Group();
root.position.set(x, 0.16, z);
root.rotation.y = options.rotation || 0;
scene.add(root);
const scale = options.scale || 1;
root.scale.setScalar(scale);
const legs = [];
[-0.13, 0.13].forEach((legX, index) => {
const leg = new THREE.Group();
leg.position.set(legX, 0.76, 0);
root.add(leg);
box(leg, [0.18, 0.63, 0.2], [0, -0.3, 0], options.legs || M.ink);
box(leg, [0.21, 0.12, 0.31], [0, -0.62, 0.06], M.woodDark);
legs.push(leg);
});
cylinder(
root,
[0.31, 0.25, 0.69],
[0, 1.08, 0],
shirtMaterial,
[0, 0, 0],
7
);
const head = mesh(
root,
new THREE.DodecahedronGeometry(0.235, 0),
options.skin || M.skin,
[0, 1.64, 0]
);
mesh(
root,
new THREE.SphereGeometry(0.238, 8, 5, 0, Math.PI * 2, 0, Math.PI / 2),
options.hair || M.hair,
[0, 1.65, -0.015]
);
const nose = mesh(
root,
new THREE.ConeGeometry(0.055, 0.14, 4),
options.skin || M.skin,
[0, 1.62, 0.235],
[Math.PI / 2, 0, 0]
);
const arms = [];
[-0.36, 0.36].forEach((armX) => {
const arm = new THREE.Group();
arm.position.set(armX, 1.35, 0);
root.add(arm);
box(arm, [0.14, 0.48, 0.15], [0, -0.22, 0], shirtMaterial);
mesh(
arm,
new THREE.DodecahedronGeometry(0.09, 0),
options.skin || M.skin,
[0, -0.49, 0]
);
arms.push(arm);
});
return { root, arms, legs, head, nose };
}
const printer = makePerson(-7.45, -0.48, M.blue, {
skin: M.skinLight,
hair: M.woodDark
});
const handler = makePerson(-3.42, 0.14, M.rust, {
skin: M.skin,
rotation: -0.25
});
const vendor = makePerson(3.18, -0.75, M.green, {
skin: M.skinLight,
hair: M.black
});
const readerOne = makePerson(6.55, 1.35, M.ochre, {
skin: M.skin,
rotation: -0.15
});
const readerTwo = makePerson(8.35, -0.12, M.blue, {
skin: M.skinLight,
hair: M.woodDark,
rotation: 0.38
});
printer.arms[0].rotation.x = -0.65;
printer.arms[1].rotation.x = -0.6;
handler.arms[0].rotation.x = -1.0;
handler.arms[1].rotation.x = -0.82;
vendor.arms[0].rotation.x = -0.92;
vendor.arms[1].rotation.x = -0.92;
readerOne.arms[0].rotation.x = -1.05;
readerOne.arms[1].rotation.x = -1.05;
readerTwo.arms[0].rotation.x = -0.82;
readerTwo.arms[1].rotation.x = -0.82;
const heldPaperOne = makePaper(0.92);
heldPaperOne.position.set(0.05, 1.08, 0.34);
heldPaperOne.rotation.set(-0.18, 0.04, -0.03);
readerOne.root.add(heldPaperOne);
const heldPaperTwo = makePaper(0.88);
heldPaperTwo.position.set(0.02, 1.12, 0.31);
heldPaperTwo.rotation.set(-0.14, 0.03, 0.04);
readerTwo.root.add(heldPaperTwo);
const handlerPaper = makePaper(0.82);
handlerPaper.position.set(0.05, 0.96, 0.35);
handlerPaper.rotation.set(-0.25, 0, -0.08);
handler.root.add(handlerPaper);
// Bench, crates, barrel, lamp, and a small angular tree.
const bench = new THREE.Group();
bench.position.set(8.2, 0, 2.15);
bench.rotation.y = -0.08;
scene.add(bench);
box(bench, [2.3, 0.16, 0.58], [0, 0.65, 0], M.wood);
box(bench, [2.3, 0.65, 0.12], [0, 1.05, -0.24], M.wood);
[-0.82, 0.82].forEach((x) => {
box(bench, [0.16, 0.67, 0.48], [x, 0.34, 0], M.woodDark);
});
const crate = new THREE.Group();
crate.position.set(-3.9, 0.1, -2.75);
scene.add(crate);
box(crate, [0.95, 0.72, 0.8], [0, 0.36, 0], M.wood);
box(crate, [1.02, 0.09, 0.87], [0, 0.5, 0], M.woodDark);
box(crate, [1.02, 0.09, 0.87], [0, 0.2, 0], M.woodDark);
const barrel = new THREE.Group();
barrel.position.set(10.15, 0.1, 1.8);
scene.add(barrel);
cylinder(barrel, [0.39, 0.34, 0.9], [0, 0.45, 0], M.barrel, [0, 0, 0], 10);
cylinder(barrel, [0.405, 0.405, 0.07], [0, 0.23, 0], M.metal, [0, 0, 0], 10);
cylinder(barrel, [0.405, 0.405, 0.07], [0, 0.67, 0], M.metal, [0, 0, 0], 10);
const lamp = new THREE.Group();
lamp.position.set(5.15, 0.1, -2.25);
scene.add(lamp);
cylinder(lamp, [0.065, 0.095, 3.15], [0, 1.58, 0], M.metal, [0, 0, 0], 8);
box(lamp, [0.42, 0.42, 0.42], [0, 3.12, 0], M.gold);
box(lamp, [0.5, 0.1, 0.5], [0, 3.38, 0], M.metal);
cylinder(lamp, [0.19, 0.19, 0.07], [0, 3.38, 0], M.metal, [0, 0, 0], 8);
const tree = new THREE.Group();
tree.position.set(10.55, 0.08, -2.5);
scene.add(tree);
cylinder(tree, [0.16, 0.24, 2.15], [0, 1.05, 0], M.woodDark, [0, 0, 0], 7);
mesh(tree, new THREE.IcosahedronGeometry(1.05, 1), M.leaf, [0, 2.65, 0]);
mesh(tree, new THREE.IcosahedronGeometry(0.72, 0), M.leafLight, [-0.48, 2.22, 0.12]);
mesh(tree, new THREE.IcosahedronGeometry(0.68, 0), M.leaf, [0.52, 2.35, -0.08]);
// The journey of a printed copy through the street.
const journeyCurves = [
new THREE.CatmullRomCurve3([
new THREE.Vector3(-7.45, 1.17, -0.48),
new THREE.Vector3(-6.55, 1.18, -0.25),
new THREE.Vector3(-5.1, 1.18, 0.02),
new THREE.Vector3(-3.42, 1.18, 0.14)
], false, "catmullrom", 0.18),
new THREE.CatmullRomCurve3([
new THREE.Vector3(-3.42, 1.18, 0.14),
new THREE.Vector3(-2.95, 1.28, -0.2),
new THREE.Vector3(-2.35, 1.39, -1.42),
new THREE.Vector3(-1.95, 1.4, -1.56)
], false, "catmullrom", 0.18),
new THREE.CatmullRomCurve3([
new THREE.Vector3(-1.95, 1.4, -1.56),
new THREE.Vector3(-0.45, 1.24, -0.78),
new THREE.Vector3(1.45, 1.2, -0.55),
new THREE.Vector3(3.18, 1.18, -0.75)
], false, "catmullrom", 0.18),
new THREE.CatmullRomCurve3([
new THREE.Vector3(3.18, 1.18, -0.75),
new THREE.Vector3(4.2, 1.16, 0.08),
new THREE.Vector3(5.45, 1.18, 1.0),
new THREE.Vector3(6.55, 1.22, 1.35)
], false, "catmullrom", 0.18),
new THREE.CatmullRomCurve3([
new THREE.Vector3(6.55, 1.22, 1.35),
new THREE.Vector3(7.18, 1.18, 1.12),
new THREE.Vector3(8.35, 1.18, -0.12)
], false, "catmullrom", 0.18)
];
const journeyDurations = [2.7, 2.0, 3.6, 3.0, 2.2];
const journeyTotal = journeyDurations.reduce((sum, duration) => sum + duration, 0);
const routeMaterial = new THREE.MeshStandardMaterial({
color: 0xb85e3f,
emissive: 0x6d2416,
emissiveIntensity: 0.08,
transparent: true,
opacity: 0.48,
roughness: 0.9
});
journeyCurves.forEach((curve) => {
const groundPoints = curve.points.map((point) =>
new THREE.Vector3(point.x, 0.15, point.z)
);
const groundCurve = new THREE.CatmullRomCurve3(
groundPoints,
false,
"catmullrom",
0.18
);
mesh(
scene,
new THREE.TubeGeometry(groundCurve, 36, 0.022, 5, false),
routeMaterial
);
});
[
[-7.45, -0.48],
[-3.42, 0.14],
[-1.95, -1.56],
[3.18, -0.75],
[6.55, 1.35],
[8.35, -0.12]
].forEach(([x, z]) => {
cylinder(scene, [0.14, 0.14, 0.035], [x, 0.16, z], M.rust, [0, 0, 0], 12);
cylinder(scene, [0.065, 0.065, 0.04], [x, 0.185, z], M.gold, [0, 0, 0], 12);
});
const flowCopies = [];
for (let i = 0; i < 4; i++) {
const paper = makePaper(1.12);
scene.add(paper);
flowCopies.push({
paper,
offset: (journeyTotal / 4) * i
});
}
function sampleJourney(time) {
let stageStart = 0;
for (let i = 0; i < journeyDurations.length; i++) {
const duration = journeyDurations[i];
const localTime = time - stageStart;
if (localTime <= duration || i === journeyDurations.length - 1) {
const amount = THREE.MathUtils.clamp(localTime / duration, 0, 1);
const point = journeyCurves[i].getPointAt(amount);
const tangent = journeyCurves[i].getTangentAt(amount);
return { point, tangent, stage: i };
}
stageStart += duration;
}
return {
point: journeyCurves[0].getPointAt(0),
tangent: journeyCurves[0].getTangentAt(0),
stage: 0
};
}
// Projected labels are implemented without renderer addons.
const labels = [
{
element: document.querySelector("#label-press"),
position: new THREE.Vector3(-7.25, 3.45, -2.4)
},
{
element: document.querySelector("#label-dry"),
position: new THREE.Vector3(-1.95, 2.72, -1.56)
},
{
element: document.querySelector("#label-vendor"),
position: new THREE.Vector3(3.18, 2.9, 0.18)
},
{
element: document.querySelector("#label-readers"),
position: new THREE.Vector3(7.25, 2.25, 0.7)
}
];
let labelsVisible = true;
function updateLabels() {
const width = window.innerWidth;
const height = window.innerHeight;
labels.forEach((label) => {
if (!labelsVisible) {
label.element.style.opacity = "0";
return;
}
const projected = label.position.clone().project(camera);
const x = (projected.x * 0.5 + 0.5) * width;
const y = (-projected.y * 0.5 + 0.5) * height;
const inView = projected.z > -1 && projected.z < 1;
label.element.style.left = `${x}px`;
label.element.style.top = `${y}px`;
label.element.style.opacity = inView ? "1" : "0";
});
}
function updateCamera() {
const sinPhi = Math.sin(cameraPhi);
camera.position.set(
cameraTarget.x + cameraRadius * sinPhi * Math.sin(cameraTheta),
cameraTarget.y + cameraRadius * Math.cos(cameraPhi),
cameraTarget.z + cameraRadius * sinPhi * Math.cos(cameraTheta)
);
camera.lookAt(cameraTarget);
camera.zoom = cameraZoom;
camera.updateProjectionMatrix();
}
function resize() {
const aspect = window.innerWidth / window.innerHeight;
const viewHeight = aspect < 0.8
? 20
: Math.max(14.2, 26 / aspect);
camera.left = -viewHeight * aspect / 2;
camera.right = viewHeight * aspect / 2;
camera.top = viewHeight / 2;
camera.bottom = -viewHeight / 2;
camera.updateProjectionMatrix();
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
}
window.addEventListener("resize", resize);
resize();
// Direct camera controls: orbit, pan, wheel zoom, and two-finger pinch.
const pointers = new Map();
let pinchDistance = null;
renderer.domElement.addEventListener("contextmenu", (event) => {
event.preventDefault();
});
renderer.domElement.addEventListener("pointerdown", (event) => {
renderer.domElement.setPointerCapture(event.pointerId);
pointers.set(event.pointerId, {
x: event.clientX,
y: event.clientY,
pan: event.shiftKey || event.button === 2
});
if (pointers.size === 2) {
const values = [...pointers.values()];
pinchDistance = Math.hypot(
values[0].x - values[1].x,
values[0].y - values[1].y
);
}
});
renderer.domElement.addEventListener("pointermove", (event) => {
const previous = pointers.get(event.pointerId);
if (!previous) return;
const dx = event.clientX - previous.x;
const dy = event.clientY - previous.y;
previous.x = event.clientX;
previous.y = event.clientY;
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 (pinchDistance && distance > 0) {
cameraZoom = THREE.MathUtils.clamp(
cameraZoom * (pinchDistance / distance),
0.65,
2.2
);
}
pinchDistance = distance;
return;
}
if (previous.pan) {
const right = new THREE.Vector3().setFromMatrixColumn(camera.matrixWorld, 0);
const up = new THREE.Vector3().setFromMatrixColumn(camera.matrixWorld, 1);
const panScale = 0.012 / cameraZoom;
cameraTarget.addScaledVector(right, -dx * panScale);
cameraTarget.addScaledVector(up, dy * panScale);
cameraTarget.x = THREE.MathUtils.clamp(cameraTarget.x, -5, 5);
cameraTarget.y = THREE.MathUtils.clamp(cameraTarget.y, 0, 3);
cameraTarget.z = THREE.MathUtils.clamp(cameraTarget.z, -2, 2);
} else {
cameraTheta -= dx * 0.006;
cameraPhi = THREE.MathUtils.clamp(cameraPhi - dy * 0.005, 0.56, 1.32);
}
});
function endPointer(event) {
pointers.delete(event.pointerId);
if (pointers.size < 2) pinchDistance = null;
}
renderer.domElement.addEventListener("pointerup", endPointer);
renderer.domElement.addEventListener("pointercancel", endPointer);
renderer.domElement.addEventListener(
"wheel",
(event) => {
event.preventDefault();
cameraZoom = THREE.MathUtils.clamp(
cameraZoom * Math.exp(-event.deltaY * 0.001),
0.65,
2.2
);
},
{ passive: false }
);
function resetView() {
cameraTarget.set(0.1, 1, 0.05);
cameraTheta = 0.38;
cameraPhi = 0.96;
cameraZoom = 1;
}
resetButton.addEventListener("click", resetView);
let flowPaused = false;
flowButton.addEventListener("click", () => {
flowPaused = !flowPaused;
flowButton.textContent = flowPaused ? "Resume copies" : "Pause copies";
});
labelsButton.addEventListener("click", () => {
labelsVisible = !labelsVisible;
labelsButton.textContent = labelsVisible ? "Hide labels" : "Show labels";
});
window.addEventListener("keydown", (event) => {
if (event.code === "Space") {
event.preventDefault();
flowButton.click();
}
if (event.key.toLowerCase() === "r") resetView();
if (event.key === "ArrowLeft") cameraTheta += 0.08;
if (event.key === "ArrowRight") cameraTheta -= 0.08;
if (event.key === "ArrowUp") cameraPhi = THREE.MathUtils.clamp(cameraPhi - 0.06, 0.56, 1.32);
if (event.key === "ArrowDown") cameraPhi = THREE.MathUtils.clamp(cameraPhi + 0.06, 0.56, 1.32);
if (event.key === "+" || event.key === "=") {
cameraZoom = THREE.MathUtils.clamp(cameraZoom * 1.08, 0.65, 2.2);
}
if (event.key === "-") {
cameraZoom = THREE.MathUtils.clamp(cameraZoom / 1.08, 0.65, 2.2);
}
});
const clock = new THREE.Clock();
let elapsed = 0;
let flowTime = 0;
function animate() {
requestAnimationFrame(animate);
const delta = Math.min(clock.getDelta(), 0.05);
elapsed += delta;
if (!flowPaused) flowTime += delta;
// Repeating hand-press cycle.
const pressCycle = (elapsed % 4.2) / 4.2;
const pressPush = Math.pow(
Math.max(0, Math.sin(pressCycle * Math.PI * 2)),
8
);
platen.position.y = 1.43 - pressPush * 0.42;
pressLever.rotation.x = -0.25 + pressPush * 0.65;
flywheel.rotation.x = pressPush * 1.8;
printer.arms[0].rotation.x = -0.5 + pressPush * 0.95;
printer.arms[1].rotation.x = -0.48 + pressPush * 0.88;
// Sheets flutter slightly on the drying line.
hangingSheets.forEach((hanger, index) => {
hanger.rotation.y = Math.sin(elapsed * 1.4 + index * 0.7) * 0.075;
hanger.rotation.z = Math.sin(elapsed * 1.1 + index * 0.45) * 0.025;
});
// Vendor gestures over the stacks; readers continue reading.
vendor.arms[0].rotation.x = -0.88 + Math.sin(elapsed * 1.6) * 0.09;
vendor.arms[1].rotation.x = -0.9 - Math.sin(elapsed * 1.6) * 0.07;
heldPaperOne.rotation.z = -0.03 + Math.sin(elapsed * 1.3) * 0.025;
heldPaperTwo.rotation.z = 0.04 + Math.sin(elapsed * 1.25 + 1) * 0.025;
// Animate several copies along one continuous handoff journey.
flowCopies.forEach((copy, index) => {
const phase = ((flowTime + copy.offset) % journeyTotal) / journeyTotal;
const sample = sampleJourney((flowTime + copy.offset) % journeyTotal);
copy.paper.position.copy(sample.point);
copy.paper.position.y += Math.sin(elapsed * 4 + index) * 0.018;
copy.paper.rotation.y = 0.08 + Math.sin(elapsed * 2.5 + index) * 0.12;
copy.paper.rotation.z = Math.sin(elapsed * 3.1 + index) * 0.08;
const fadeIn = THREE.MathUtils.clamp(phase / 0.025, 0, 1);
const fadeOut = THREE.MathUtils.clamp((1 - phase) / 0.025, 0, 1);
const visibleScale = Math.min(fadeIn, fadeOut);
copy.paper.scale.setScalar(1.12 * visibleScale);
});
updateCamera();
updateLabels();
renderer.render(scene, camera);
}
updateCamera();
animate();
requestAnimationFrame(() => {
loadingEl.classList.add("hidden");
});
</script>
</body>
</html>
```