Prompt specification
Build or customize the Three.js 3D scene "Newspaper edition stack markers" 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: Newspaper edition stack markers
Category: Architecture & Cities · Style: Procedural Solid / Shader 3D
License: MIT · Reference: https://three3d.app/scene/newspaper-edition-stack-markers-x0513
Scene Description Prompt:
Create a standalone stylized scene in one HTML file using Three.js from cdnjs. Show three newspaper stacks with different edition dates and matching headline symbols; separate their chronological order from their physical stack heights for clear comparison.
Working Three.js Starter (newspaper-edition-stack-markers-x0513):
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>The Daily Fold — Edition Archive</title>
<style>
:root {
--ink: #17383d;
--paper: #f4eedf;
--coral: #df694e;
--teal: #287f83;
--gold: #d8a936;
}
* {
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: #e9e1d2;
color: var(--ink);
font-family: Arial, Helvetica, sans-serif;
}
#scene {
position: fixed;
inset: 0;
}
canvas {
display: block;
width: 100%;
height: 100%;
touch-action: none;
}
.masthead {
position: fixed;
top: 30px;
left: 34px;
z-index: 5;
max-width: 430px;
pointer-events: none;
}
.eyebrow {
display: flex;
align-items: center;
gap: 10px;
margin-bottom: 13px;
font-size: 11px;
font-weight: 800;
letter-spacing: 0.22em;
text-transform: uppercase;
}
.eyebrow::before {
width: 28px;
height: 3px;
background: var(--coral);
content: "";
}
h1 {
margin: 0;
font-family: Georgia, "Times New Roman", serif;
font-size: clamp(36px, 4.4vw, 66px);
font-weight: 700;
line-height: 0.94;
letter-spacing: -0.045em;
}
.dek {
max-width: 370px;
margin: 18px 0 0;
color: rgba(23, 56, 61, 0.73);
font-family: Georgia, "Times New Roman", serif;
font-size: 15px;
line-height: 1.55;
}
.key {
position: fixed;
top: 30px;
right: 32px;
z-index: 5;
width: 230px;
padding: 16px 18px;
border: 1px solid rgba(23, 56, 61, 0.16);
border-radius: 14px;
background: rgba(247, 242, 230, 0.78);
box-shadow: 0 14px 35px rgba(40, 49, 45, 0.08);
backdrop-filter: blur(10px);
pointer-events: none;
}
.key-title {
margin-bottom: 12px;
font-size: 10px;
font-weight: 800;
letter-spacing: 0.19em;
text-transform: uppercase;
}
.key-row {
display: grid;
grid-template-columns: 19px 1fr;
gap: 10px;
align-items: start;
margin-top: 10px;
font-size: 12px;
line-height: 1.35;
}
.key-row b {
display: block;
margin-bottom: 2px;
font-size: 11px;
letter-spacing: 0.03em;
}
.key-row span:last-child {
color: rgba(23, 56, 61, 0.65);
}
.key-mark {
position: relative;
width: 18px;
height: 18px;
}
.key-mark.order::after {
position: absolute;
top: 8px;
left: 0;
width: 16px;
height: 2px;
background: var(--coral);
content: "";
}
.key-mark.order::before {
position: absolute;
top: 5px;
right: 0;
border-top: 4px solid transparent;
border-bottom: 4px solid transparent;
border-left: 6px solid var(--coral);
content: "";
}
.key-mark.height {
border-right: 2px solid var(--teal);
border-bottom: 2px solid var(--teal);
}
.key-mark.symbol {
border: 2px solid var(--gold);
border-radius: 50%;
}
.controls {
position: fixed;
bottom: 25px;
left: 30px;
z-index: 6;
display: flex;
align-items: center;
gap: 14px;
font-size: 10px;
font-weight: 800;
letter-spacing: 0.12em;
text-transform: uppercase;
pointer-events: none;
}
.controls::before {
width: 7px;
height: 7px;
border-radius: 50%;
background: var(--teal);
box-shadow: 0 0 0 5px rgba(40, 127, 131, 0.13);
content: "";
}
button {
border: 0;
cursor: pointer;
}
#reset {
position: fixed;
right: 31px;
bottom: 23px;
z-index: 7;
padding: 10px 15px;
border: 1px solid rgba(23, 56, 61, 0.2);
border-radius: 999px;
background: rgba(247, 242, 230, 0.84);
color: var(--ink);
font: inherit;
font-size: 10px;
font-weight: 800;
letter-spacing: 0.13em;
text-transform: uppercase;
backdrop-filter: blur(8px);
}
#reset:hover {
background: var(--ink);
color: var(--paper);
}
#tooltip {
position: fixed;
z-index: 10;
min-width: 190px;
padding: 12px 14px;
border-radius: 10px;
background: rgba(23, 56, 61, 0.94);
color: #f7f0df;
box-shadow: 0 12px 30px rgba(16, 30, 30, 0.22);
font-size: 11px;
line-height: 1.5;
opacity: 0;
pointer-events: none;
transform: translate(14px, 14px);
transition: opacity 120ms ease;
}
#tooltip strong {
display: block;
margin-bottom: 2px;
font-family: Georgia, "Times New Roman", serif;
font-size: 16px;
}
#tooltip .tip-meta {
color: rgba(247, 240, 223, 0.68);
}
@media (max-width: 760px) {
.masthead {
top: 21px;
left: 20px;
max-width: calc(100vw - 40px);
}
h1 {
max-width: 330px;
font-size: 39px;
}
.dek {
display: none;
}
.key {
top: auto;
right: 18px;
bottom: 67px;
width: 190px;
padding: 12px 14px;
}
.key-title,
.key-row:nth-of-type(3) {
display: none;
}
.key-row {
margin-top: 7px;
}
.controls {
bottom: 23px;
left: 20px;
font-size: 9px;
}
#reset {
right: 18px;
bottom: 20px;
}
}
</style>
</head>
<body>
<div id="scene" aria-label="Interactive three-dimensional newspaper archive"></div>
<header class="masthead">
<div class="eyebrow">The Daily Fold · Visual Archive</div>
<h1>Three editions.<br />Three stories in time.</h1>
<p class="dek">
Follow the date rail at the front to read chronology. The stack heights
count physical copies only—so time and quantity remain distinct.
</p>
</header>
<aside class="key" aria-label="Scene legend">
<div class="key-title">How to read the scene</div>
<div class="key-row">
<div class="key-mark order"></div>
<div>
<b>Chronological order</b>
<span>Dates and symbols on the front rail</span>
</div>
</div>
<div class="key-row">
<div class="key-mark height"></div>
<div>
<b>Physical height</b>
<span>Copy count on the rear ruler</span>
</div>
</div>
<div class="key-row">
<div class="key-mark symbol"></div>
<div>
<b>Edition identity</b>
<span>Each date pairs with its headline symbol</span>
</div>
</div>
</aside>
<div class="controls">Drag to orbit · Scroll or pinch to zoom · Hover an edition</div>
<button id="reset" type="button">Reset view</button>
<div id="tooltip" role="status"></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 tooltip = document.querySelector("#tooltip");
const resetButton = document.querySelector("#reset");
const editions = [
{
date: "14 OCT 2025",
title: "A NEW DAWN",
symbol: "sun",
accent: "#df694e",
copies: 4,
x: -4.0
},
{
date: "21 OCT 2025",
title: "THE TIDE TURNS",
symbol: "wave",
accent: "#287f83",
copies: 8,
x: 0.0
},
{
date: "28 OCT 2025",
title: "TOWARD TOMORROW",
symbol: "star",
accent: "#d4a332",
copies: 3,
x: 4.0
}
];
const scene = new THREE.Scene();
scene.background = new THREE.Color(0xe9e1d2);
scene.fog = new THREE.Fog(0xe9e1d2, 18, 34);
const camera = new THREE.PerspectiveCamera(
36,
window.innerWidth / window.innerHeight,
0.1,
100
);
const renderer = new THREE.WebGLRenderer({
antialias: true,
powerPreference: "high-performance"
});
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1.08;
container.appendChild(renderer.domElement);
const maxAnisotropy = renderer.capabilities.getMaxAnisotropy();
// Lighting: soft editorial studio.
scene.add(new THREE.HemisphereLight(0xfff9eb, 0x69777a, 2.1));
const keyLight = new THREE.DirectionalLight(0xfff0d7, 3.1);
keyLight.position.set(-5, 10, 8);
keyLight.castShadow = true;
keyLight.shadow.mapSize.set(2048, 2048);
keyLight.shadow.camera.left = -10;
keyLight.shadow.camera.right = 10;
keyLight.shadow.camera.top = 9;
keyLight.shadow.camera.bottom = -6;
keyLight.shadow.camera.near = 1;
keyLight.shadow.camera.far = 30;
keyLight.shadow.bias = -0.0004;
scene.add(keyLight);
const rimLight = new THREE.DirectionalLight(0xb9d7d5, 1.25);
rimLight.position.set(7, 6, -4);
scene.add(rimLight);
const fillLight = new THREE.PointLight(0xf3b08f, 12, 14, 2);
fillLight.position.set(-5, 4, 4);
scene.add(fillLight);
// ---------- Canvas drawing helpers ----------
function roundedRect(ctx, x, y, w, h, r) {
const radius = Math.min(r, w / 2, h / 2);
ctx.beginPath();
ctx.moveTo(x + radius, y);
ctx.lineTo(x + w - radius, y);
ctx.quadraticCurveTo(x + w, y, x + w, y + radius);
ctx.lineTo(x + w, y + h - radius);
ctx.quadraticCurveTo(x + w, y + h, x + w - radius, y + h);
ctx.lineTo(x + radius, y + h);
ctx.quadraticCurveTo(x, y + h, x, y + h - radius);
ctx.lineTo(x, y + radius);
ctx.quadraticCurveTo(x, y, x + radius, y);
ctx.closePath();
}
function rgba(hex, alpha) {
const value = parseInt(hex.replace("#", ""), 16);
const r = (value >> 16) & 255;
const g = (value >> 8) & 255;
const b = value & 255;
return `rgba(${r}, ${g}, ${b}, ${alpha})`;
}
function drawSymbol(ctx, type, cx, cy, size, color) {
ctx.save();
ctx.translate(cx, cy);
ctx.strokeStyle = color;
ctx.fillStyle = color;
ctx.lineCap = "round";
ctx.lineJoin = "round";
if (type === "sun") {
const r = size * 0.29;
ctx.beginPath();
ctx.arc(0, size * 0.1, r, 0, Math.PI * 2);
ctx.fill();
for (let i = 0; i < 8; i++) {
const a = (Math.PI * 2 * i) / 8;
const inner = r + size * 0.11;
const outer = r + size * 0.25;
ctx.beginPath();
ctx.moveTo(Math.cos(a) * inner, size * 0.1 + Math.sin(a) * inner);
ctx.lineTo(Math.cos(a) * outer, size * 0.1 + Math.sin(a) * outer);
ctx.lineWidth = size * 0.045;
ctx.stroke();
}
ctx.beginPath();
ctx.moveTo(-size * 0.48, size * 0.43);
ctx.lineTo(size * 0.48, size * 0.43);
ctx.lineWidth = size * 0.055;
ctx.stroke();
}
if (type === "wave") {
ctx.lineWidth = size * 0.075;
for (let row = 0; row < 3; row++) {
const y = (row - 1) * size * 0.23;
ctx.beginPath();
ctx.moveTo(-size * 0.48, y);
ctx.bezierCurveTo(
-size * 0.22, y - size * 0.19,
-size * 0.06, y + size * 0.19,
size * 0.17, y
);
ctx.bezierCurveTo(
size * 0.31, y - size * 0.13,
size * 0.4, y + size * 0.1,
size * 0.49, y - size * 0.02
);
ctx.stroke();
}
}
if (type === "star") {
ctx.beginPath();
for (let i = 0; i < 16; i++) {
const radius = i % 2 === 0 ? size * 0.47 : size * 0.19;
const angle = (Math.PI * 2 * i) / 16 - Math.PI / 2;
const x = Math.cos(angle) * radius;
const y = Math.sin(angle) * radius;
if (i === 0) ctx.moveTo(x, y);
else ctx.lineTo(x, y);
}
ctx.closePath();
ctx.fill();
ctx.beginPath();
ctx.arc(0, 0, size * 0.07, 0, Math.PI * 2);
ctx.fillStyle = "#f4eedf";
ctx.fill();
}
ctx.restore();
}
function seededRandom(seed) {
let value = seed % 2147483647;
return () => {
value = (value * 16807) % 2147483647;
return (value - 1) / 2147483646;
};
}
function canvasTexture(canvas) {
const texture = new THREE.CanvasTexture(canvas);
texture.colorSpace = THREE.SRGBColorSpace;
texture.anisotropy = maxAnisotropy;
return texture;
}
function makeSprite(canvas, width, height, renderOrder = 10) {
const material = new THREE.SpriteMaterial({
map: canvasTexture(canvas),
transparent: true,
depthTest: false,
depthWrite: false
});
const sprite = new THREE.Sprite(material);
sprite.scale.set(width, height, 1);
sprite.renderOrder = renderOrder;
return sprite;
}
function makeDateCard(edition) {
const canvas = document.createElement("canvas");
canvas.width = 768;
canvas.height = 280;
const ctx = canvas.getContext("2d");
roundedRect(ctx, 5, 5, 758, 270, 22);
ctx.fillStyle = "#f8f1e3";
ctx.fill();
ctx.strokeStyle = rgba(edition.accent, 0.72);
ctx.lineWidth = 4;
ctx.stroke();
ctx.fillStyle = edition.accent;
ctx.fillRect(24, 24, 12, 232);
ctx.beginPath();
ctx.arc(122, 139, 75, 0, Math.PI * 2);
ctx.fillStyle = rgba(edition.accent, 0.13);
ctx.fill();
drawSymbol(ctx, edition.symbol, 122, 133, 90, edition.accent);
ctx.textAlign = "left";
ctx.fillStyle = "#17383d";
ctx.font = "700 19px Arial, sans-serif";
ctx.fillText("EDITION DATE", 224, 68);
ctx.font = "700 49px Georgia, serif";
ctx.fillText(edition.date, 224, 127);
ctx.fillStyle = rgba("#17383d", 0.69);
ctx.font = "700 24px Georgia, serif";
ctx.fillText(edition.title, 224, 175);
ctx.fillStyle = edition.accent;
ctx.font = "700 15px Arial, sans-serif";
ctx.fillText("EARLIER → LATER", 224, 222);
return canvas;
}
function makeNewspaperTexture(edition, index) {
const canvas = document.createElement("canvas");
canvas.width = 1024;
canvas.height = 720;
const ctx = canvas.getContext("2d");
ctx.fillStyle = "#f3ead6";
ctx.fillRect(0, 0, canvas.width, canvas.height);
const random = seededRandom(117 + index * 71);
for (let i = 0; i < 1500; i++) {
const x = random() * canvas.width;
const y = random() * canvas.height;
const alpha = 0.018 + random() * 0.025;
ctx.fillStyle = `rgba(66, 52, 38, ${alpha})`;
ctx.fillRect(x, y, 1 + random() * 2, 1);
}
ctx.strokeStyle = "#17383d";
ctx.lineWidth = 3;
ctx.strokeRect(28, 28, 968, 664);
ctx.textAlign = "center";
ctx.fillStyle = "#17383d";
ctx.font = "700 72px Georgia, serif";
ctx.fillText("THE DAILY FOLD", 512, 108);
ctx.fillStyle = edition.accent;
ctx.fillRect(44, 140, 936, 6);
ctx.textAlign = "left";
ctx.font = "700 20px Arial, sans-serif";
ctx.fillText(edition.date, 48, 180);
ctx.textAlign = "right";
ctx.fillText("ARCHIVE EDITION · $2", 976, 180);
ctx.textAlign = "center";
ctx.font = "700 16px Arial, sans-serif";
ctx.fillText("SPECIAL REPORT", 512, 180);
ctx.fillStyle = rgba(edition.accent, 0.12);
ctx.beginPath();
ctx.arc(145, 318, 98, 0, Math.PI * 2);
ctx.fill();
drawSymbol(ctx, edition.symbol, 145, 310, 120, edition.accent);
ctx.textAlign = "left";
ctx.fillStyle = "#17383d";
ctx.font = "700 55px Georgia, serif";
ctx.fillText(edition.title, 278, 292);
ctx.fillStyle = edition.accent;
ctx.font = "700 19px Arial, sans-serif";
ctx.fillText("ONE STORY · THREE MOMENTS · A CONTINUING RECORD", 280, 333);
ctx.strokeStyle = rgba("#17383d", 0.3);
ctx.lineWidth = 2;
ctx.beginPath();
ctx.moveTo(48, 380);
ctx.lineTo(976, 380);
ctx.stroke();
const columnStarts = [48, 340, 632];
const columnWidths = [250, 250, 344];
for (let c = 0; c < 3; c++) {
const x = columnStarts[c];
const w = columnWidths[c];
ctx.fillStyle = "#17383d";
ctx.font = "700 21px Georgia, serif";
const headings = ["THE EDITOR'S NOTE", "INSIDE THE STORY", "WHAT COMES NEXT"];
ctx.fillText(headings[c], x, 422);
ctx.fillStyle = rgba("#17383d", 0.22);
for (let row = 0; row < 18; row++) {
const lineWidth = row % 5 === 0 ? w * 0.72 : w;
ctx.fillRect(x, 448 + row * 11, lineWidth, 3);
}
}
ctx.textAlign = "center";
ctx.fillStyle = rgba("#17383d", 0.58);
ctx.font = "700 16px Arial, sans-serif";
ctx.fillText("THE DAILY FOLD · INDEPENDENT EDITION ARCHIVE · 2025", 512, 674);
return canvas;
}
function makeHeightBadge(edition) {
const canvas = document.createElement("canvas");
canvas.width = 640;
canvas.height = 170;
const ctx = canvas.getContext("2d");
roundedRect(ctx, 4, 4, 632, 162, 18);
ctx.fillStyle = "#17383d";
ctx.fill();
ctx.fillStyle = edition.accent;
roundedRect(ctx, 15, 15, 10, 140, 5);
ctx.fill();
ctx.textAlign = "left";
ctx.fillStyle = rgba("#f4eedf", 0.62);
ctx.font = "700 17px Arial, sans-serif";
ctx.fillText("PHYSICAL HEIGHT", 49, 61);
ctx.fillStyle = "#f4eedf";
ctx.font = "700 58px Georgia, serif";
ctx.fillText(`${String(edition.copies).padStart(2, "0")} COPIES`, 47, 126);
return canvas;
}
function makeSmallLabel(text, color = "#17383d") {
const canvas = document.createElement("canvas");
canvas.width = 512;
canvas.height = 128;
const ctx = canvas.getContext("2d");
ctx.textAlign = "center";
ctx.textBaseline = "middle";
ctx.fillStyle = color;
ctx.font = "800 43px Arial, sans-serif";
ctx.fillText(text, 256, 64);
return canvas;
}
function makeFloorLabel(text) {
const canvas = document.createElement("canvas");
canvas.width = 1024;
canvas.height = 128;
const ctx = canvas.getContext("2d");
ctx.textAlign = "center";
ctx.textBaseline = "middle";
ctx.fillStyle = "#17383d";
ctx.font = "800 39px Arial, sans-serif";
ctx.fillText(text, 512, 64);
const texture = canvasTexture(canvas);
const material = new THREE.MeshBasicMaterial({
map: texture,
transparent: true,
depthWrite: false
});
const mesh = new THREE.Mesh(new THREE.PlaneGeometry(4.8, 0.6), material);
mesh.rotation.x = -Math.PI / 2;
return mesh;
}
// ---------- Stage and backdrop ----------
const ground = new THREE.Mesh(
new THREE.PlaneGeometry(40, 30),
new THREE.MeshStandardMaterial({
color: 0xe6ddcc,
roughness: 1
})
);
ground.rotation.x = -Math.PI / 2;
ground.position.y = -0.14;
ground.receiveShadow = true;
scene.add(ground);
const wall = new THREE.Mesh(
new THREE.PlaneGeometry(22, 10),
new THREE.MeshStandardMaterial({
color: 0xf1eadc,
roughness: 1
})
);
wall.position.set(0, 4.25, -4.15);
wall.receiveShadow = true;
scene.add(wall);
const stage = new THREE.Mesh(
new THREE.BoxGeometry(13.2, 0.28, 6.8),
new THREE.MeshStandardMaterial({
color: 0xc9beaa,
roughness: 0.92
})
);
stage.position.set(0, 0, -0.05);
stage.receiveShadow = true;
stage.castShadow = true;
scene.add(stage);
const frontTrim = new THREE.Mesh(
new THREE.BoxGeometry(13.25, 0.13, 0.12),
new THREE.MeshStandardMaterial({
color: 0x17383d,
roughness: 0.7
})
);
frontTrim.position.set(0, 0.045, 3.32);
frontTrim.castShadow = true;
scene.add(frontTrim);
editions.forEach((edition, index) => {
const pastel = [
0xead8c8,
0xd2e0dc,
0xeee1b8
][index];
const disk = new THREE.Mesh(
new THREE.CircleGeometry(1.32, 64),
new THREE.MeshStandardMaterial({
color: pastel,
roughness: 1
})
);
disk.position.set(edition.x, 2.35, -4.08);
scene.add(disk);
const ring = new THREE.Mesh(
new THREE.TorusGeometry(1.35, 0.025, 8, 96),
new THREE.MeshBasicMaterial({
color: edition.accent,
transparent: true,
opacity: 0.55
})
);
ring.position.set(edition.x, 2.35, -4.04);
scene.add(ring);
});
// ---------- Newspaper stacks ----------
const paperMaterial = new THREE.MeshStandardMaterial({
color: 0xf1e7d3,
roughness: 0.98
});
const edgeMaterial = new THREE.LineBasicMaterial({
color: 0x6f6558,
transparent: true,
opacity: 0.18
});
const pickMeshes = [];
const topMaterials = [];
editions.forEach((edition, editionIndex) => {
const random = seededRandom(400 + editionIndex * 193);
const plinth = new THREE.Mesh(
new THREE.BoxGeometry(3.58, 0.12, 2.55),
new THREE.MeshStandardMaterial({
color: 0x25484c,
roughness: 0.72
})
);
plinth.position.set(edition.x, 0.20, 0.08);
plinth.castShadow = true;
plinth.receiveShadow = true;
scene.add(plinth);
const plinthTrim = new THREE.Mesh(
new THREE.BoxGeometry(3.64, 0.035, 2.61),
new THREE.MeshStandardMaterial({
color: edition.accent,
roughness: 0.75
})
);
plinthTrim.position.set(edition.x, 0.145, 0.08);
scene.add(plinthTrim);
const stack = new THREE.Group();
stack.position.set(edition.x, 0, 0.08);
scene.add(stack);
let topLayer;
for (let i = 0; i < edition.copies; i++) {
const layer = new THREE.Group();
const sheet = new THREE.Mesh(
new THREE.BoxGeometry(3.05, 0.14, 2.04),
paperMaterial
);
sheet.position.y = 0.30 + i * 0.17;
sheet.castShadow = true;
sheet.receiveShadow = true;
const edges = new THREE.LineSegments(
new THREE.EdgesGeometry(sheet.geometry),
edgeMaterial
);
sheet.add(edges);
layer.add(sheet);
layer.position.x = (random() - 0.5) * 0.065;
layer.position.z = (random() - 0.5) * 0.05;
layer.rotation.y = (random() - 0.5) * 0.028;
layer.rotation.z = (random() - 0.5) * 0.018;
stack.add(layer);
topLayer = layer;
}
const topMaterial = new THREE.MeshStandardMaterial({
map: canvasTexture(makeNewspaperTexture(edition, editionIndex)),
roughness: 0.98,
metalness: 0
});
const topPage = new THREE.Mesh(
new THREE.PlaneGeometry(3.025, 2.015),
topMaterial
);
topPage.rotation.x = -Math.PI / 2;
topPage.position.y = 0.0715;
topPage.receiveShadow = true;
topPage.userData.editionIndex = editionIndex;
topLayer.add(topPage);
pickMeshes.push(topPage);
topMaterials.push(topMaterial);
const badge = makeSprite(
makeHeightBadge(edition),
1.82,
0.49,
13
);
badge.position.set(edition.x, 0.51, 1.48);
scene.add(badge);
});
// ---------- Front chronology rail ----------
const railMaterial = new THREE.LineBasicMaterial({
color: 0xdf694e,
transparent: true,
opacity: 0.8
});
const rail = new THREE.Line(
new THREE.BufferGeometry().setFromPoints([
new THREE.Vector3(-5.75, 0.185, 2.55),
new THREE.Vector3(5.75, 0.185, 2.55)
]),
railMaterial
);
scene.add(rail);
const arrow = new THREE.Mesh(
new THREE.ConeGeometry(0.14, 0.36, 3),
new THREE.MeshBasicMaterial({ color: 0xdf694e })
);
arrow.rotation.z = -Math.PI / 2;
arrow.position.set(5.88, 0.185, 2.55);
scene.add(arrow);
editions.forEach((edition) => {
const node = new THREE.Mesh(
new THREE.CylinderGeometry(0.13, 0.13, 0.045, 24),
new THREE.MeshStandardMaterial({
color: edition.accent,
roughness: 0.55
})
);
node.position.set(edition.x, 0.19, 2.55);
scene.add(node);
const card = makeSprite(makeDateCard(edition), 2.68, 0.98, 18);
card.position.set(edition.x, 0.84, 2.55);
scene.add(card);
});
const chronologyLabel = makeFloorLabel("CHRONOLOGICAL ORDER →");
chronologyLabel.position.set(0, 0.146, 3.02);
scene.add(chronologyLabel);
// ---------- Rear physical-height ruler ----------
const rulerBaseY = 0.25;
const copyHeight = 0.17;
const rulerX = 6.18;
const rulerZ = -2.22;
const rulerMaterial = new THREE.LineBasicMaterial({
color: 0x287f83,
transparent: true,
opacity: 0.7
});
const ruler = new THREE.Line(
new THREE.BufferGeometry().setFromPoints([
new THREE.Vector3(rulerX, rulerBaseY, rulerZ),
new THREE.Vector3(rulerX, rulerBaseY + 8 * copyHeight, rulerZ)
]),
rulerMaterial
);
scene.add(ruler);
for (let copies = 0; copies <= 8; copies += 2) {
const y = rulerBaseY + copies * copyHeight;
const tick = new THREE.Line(
new THREE.BufferGeometry().setFromPoints([
new THREE.Vector3(rulerX - 0.11, y, rulerZ),
new THREE.Vector3(rulerX + 0.12, y, rulerZ)
]),
rulerMaterial
);
scene.add(tick);
const label = makeSprite(
makeSmallLabel(String(copies), "#287f83"),
0.42,
0.19,
12
);
label.position.set(rulerX + 0.32, y, rulerZ);
scene.add(label);
}
const heightTitle = makeSprite(
makeSmallLabel("PHYSICAL HEIGHT · COPIES", "#287f83"),
2.75,
0.4,
12
);
heightTitle.position.set(5.18, 2.02, rulerZ);
scene.add(heightTitle);
// Fine height guides remain behind the physical stacks.
for (let copies = 0; copies <= 8; copies += 2) {
const y = rulerBaseY + copies * copyHeight;
const guide = new THREE.Line(
new THREE.BufferGeometry().setFromPoints([
new THREE.Vector3(-5.6, y, -2.27),
new THREE.Vector3(rulerX, y, -2.27)
]),
new THREE.LineBasicMaterial({
color: 0x6a8e8f,
transparent: true,
opacity: 0.16
})
);
scene.add(guide);
}
// ---------- Direct camera controls ----------
const target = new THREE.Vector3(0, 1.05, 0.28);
let desiredTheta = 0;
let desiredPhi = 1.17;
let desiredRadius = window.innerWidth < 760 ? 21 : 16.3;
let currentTheta = desiredTheta;
let currentPhi = desiredPhi;
let currentRadius = desiredRadius;
const pointers = new Map();
let lastPointer = null;
let lastPinchDistance = 0;
let dragging = false;
function updateCamera() {
const sinPhi = Math.sin(currentPhi);
camera.position.set(
target.x + currentRadius * sinPhi * Math.sin(currentTheta),
target.y + currentRadius * Math.cos(currentPhi),
target.z + currentRadius * sinPhi * Math.cos(currentTheta)
);
camera.lookAt(target);
}
function pointerDistance() {
const values = [...pointers.values()];
if (values.length < 2) return 0;
return Math.hypot(
values[0].x - values[1].x,
values[0].y - values[1].y
);
}
renderer.domElement.addEventListener("pointerdown", (event) => {
renderer.domElement.setPointerCapture(event.pointerId);
pointers.set(event.pointerId, { x: event.clientX, y: event.clientY });
if (pointers.size === 1) {
dragging = true;
lastPointer = { x: event.clientX, y: event.clientY };
} else {
dragging = false;
lastPinchDistance = pointerDistance();
}
tooltip.style.opacity = "0";
});
renderer.domElement.addEventListener("pointermove", (event) => {
if (pointers.has(event.pointerId)) {
pointers.set(event.pointerId, { x: event.clientX, y: event.clientY });
}
if (pointers.size === 2) {
const distance = pointerDistance();
if (lastPinchDistance > 0 && distance > 0) {
desiredRadius *= lastPinchDistance / distance;
desiredRadius = THREE.MathUtils.clamp(desiredRadius, 10.5, 25);
}
lastPinchDistance = distance;
return;
}
if (dragging && lastPointer) {
const dx = event.clientX - lastPointer.x;
const dy = event.clientY - lastPointer.y;
desiredTheta -= dx * 0.005;
desiredPhi = THREE.MathUtils.clamp(
desiredPhi - dy * 0.004,
0.68,
1.43
);
lastPointer = { x: event.clientX, y: event.clientY };
return;
}
updateHover(event);
});
function endPointer(event) {
pointers.delete(event.pointerId);
dragging = pointers.size === 1;
lastPointer = null;
lastPinchDistance = 0;
}
renderer.domElement.addEventListener("pointerup", endPointer);
renderer.domElement.addEventListener("pointercancel", endPointer);
renderer.domElement.addEventListener("pointerleave", () => {
tooltip.style.opacity = "0";
topMaterials.forEach((material) => {
material.emissive.set(0x000000);
material.emissiveIntensity = 0;
});
});
renderer.domElement.addEventListener(
"wheel",
(event) => {
event.preventDefault();
desiredRadius *= Math.exp(event.deltaY * 0.001);
desiredRadius = THREE.MathUtils.clamp(desiredRadius, 10.5, 25);
},
{ passive: false }
);
resetButton.addEventListener("click", () => {
desiredTheta = 0;
desiredPhi = 1.17;
desiredRadius = window.innerWidth < 760 ? 21 : 16.3;
});
// ---------- Hover interaction ----------
const raycaster = new THREE.Raycaster();
const pointerNdc = new THREE.Vector2();
let hoveredIndex = -1;
function updateHover(event) {
const rect = renderer.domElement.getBoundingClientRect();
pointerNdc.x = ((event.clientX - rect.left) / rect.width) * 2 - 1;
pointerNdc.y = -((event.clientY - rect.top) / rect.height) * 2 + 1;
raycaster.setFromCamera(pointerNdc, camera);
const intersections = raycaster.intersectObjects(pickMeshes, false);
topMaterials.forEach((material) => {
material.emissive.set(0x000000);
material.emissiveIntensity = 0;
});
if (!intersections.length) {
hoveredIndex = -1;
tooltip.style.opacity = "0";
renderer.domElement.style.cursor = "grab";
return;
}
const index = intersections[0].object.userData.editionIndex;
const edition = editions[index];
hoveredIndex = index;
topMaterials[index].emissive.set(edition.accent);
topMaterials[index].emissiveIntensity = 0.15;
renderer.domElement.style.cursor = "pointer";
tooltip.innerHTML = `
<strong>${edition.title}</strong>
${edition.date}<br />
<span class="tip-meta">${edition.copies} physical copies · edition symbol matched</span>
`;
const x = Math.min(event.clientX, window.innerWidth - 225);
const y = Math.min(event.clientY, window.innerHeight - 105);
tooltip.style.left = `${x}px`;
tooltip.style.top = `${y}px`;
tooltip.style.opacity = "1";
}
// ---------- Resize and render loop ----------
window.addEventListener("resize", () => {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
});
function animate() {
requestAnimationFrame(animate);
currentTheta += (desiredTheta - currentTheta) * 0.085;
currentPhi += (desiredPhi - currentPhi) * 0.085;
currentRadius += (desiredRadius - currentRadius) * 0.085;
updateCamera();
renderer.render(scene, camera);
}
updateCamera();
animate();
</script>
</body>
</html>
```