Prompt specification
Build or customize the Three.js 3D scene "Morning edition replacement sequence" 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: Morning edition replacement sequence
Category: Voxel Worlds · Style: Voxel 3D
License: MIT · Reference: https://three3d.app/scene/morning-edition-replacement-sequence-x0514
Scene Description Prompt:
Animate a newsstand receiving a newer edition while retaining a marked archive copy; a timeline distinguishes current display from older information without erasing publication history. Build this with Three.js from cdnjs as a voxel scene in one self-contained HTML file.
Working Three.js Starter (morning-edition-replacement-sequence-x0514):
```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 Pixel — Voxel Newsstand</title>
<style>
:root {
--ink: #172b35;
--muted: #60727a;
--paper: #fffaf0;
--coral: #ef6a4d;
--teal: #1c7774;
--gold: #f3bd43;
--line: rgba(23, 43, 53, 0.16);
--shadow: 0 16px 45px rgba(23, 43, 53, 0.15);
}
* {
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: #dce8e3;
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;
}
#scene canvas {
display: block;
width: 100%;
height: 100%;
touch-action: none;
cursor: grab;
}
#scene canvas:active {
cursor: grabbing;
}
.masthead {
position: fixed;
z-index: 5;
top: 22px;
left: 24px;
width: min(410px, calc(100vw - 48px));
pointer-events: none;
}
.brand {
display: flex;
align-items: center;
gap: 10px;
margin-bottom: 15px;
font-size: 11px;
font-weight: 900;
letter-spacing: 0.18em;
text-transform: uppercase;
}
.brand-mark {
display: grid;
grid-template-columns: repeat(2, 8px);
grid-template-rows: repeat(2, 8px);
gap: 2px;
transform: rotate(-4deg);
}
.brand-mark i {
display: block;
background: var(--coral);
}
.brand-mark i:nth-child(2) {
background: var(--gold);
}
.brand-mark i:nth-child(3) {
background: var(--teal);
}
.masthead h1 {
max-width: 390px;
margin: 0;
font-family: Georgia, "Times New Roman", serif;
font-size: clamp(30px, 4vw, 52px);
line-height: 0.98;
letter-spacing: -0.045em;
text-wrap: balance;
}
.masthead p {
max-width: 350px;
margin: 13px 0 0;
color: var(--muted);
font-size: 13px;
line-height: 1.55;
}
#story-card {
position: fixed;
z-index: 5;
top: 22px;
right: 24px;
width: min(300px, calc(100vw - 48px));
padding: 17px 18px 16px;
border: 1px solid rgba(255, 255, 255, 0.65);
border-radius: 17px;
background: rgba(255, 250, 240, 0.86);
box-shadow: var(--shadow);
backdrop-filter: blur(14px);
-webkit-backdrop-filter: blur(14px);
pointer-events: none;
}
.card-label {
display: flex;
align-items: center;
justify-content: space-between;
gap: 10px;
margin-bottom: 10px;
color: var(--muted);
font-size: 9px;
font-weight: 900;
letter-spacing: 0.16em;
text-transform: uppercase;
}
.live-dot {
display: inline-block;
width: 7px;
height: 7px;
margin-right: 6px;
border-radius: 50%;
background: var(--coral);
box-shadow: 0 0 0 4px rgba(239, 106, 77, 0.14);
animation: breathe 1.5s ease-in-out infinite;
}
@keyframes breathe {
50% {
opacity: 0.42;
}
}
#story-card h2 {
margin: 0 0 7px;
font-family: Georgia, "Times New Roman", serif;
font-size: 24px;
line-height: 1.05;
}
#story-card p {
margin: 0;
color: var(--muted);
font-size: 12px;
line-height: 1.5;
}
.state-badge {
display: inline-block;
margin-top: 12px;
padding: 6px 8px;
border-radius: 7px;
background: rgba(28, 119, 116, 0.1);
color: var(--teal);
font-size: 9px;
font-weight: 900;
letter-spacing: 0.11em;
text-transform: uppercase;
}
#hint {
position: fixed;
z-index: 4;
right: 24px;
bottom: 151px;
padding: 8px 11px;
border: 1px solid rgba(255, 255, 255, 0.55);
border-radius: 9px;
background: rgba(23, 43, 53, 0.68);
color: rgba(255, 255, 255, 0.85);
font-size: 9px;
font-weight: 800;
letter-spacing: 0.1em;
text-transform: uppercase;
backdrop-filter: blur(8px);
pointer-events: none;
}
#timeline {
position: fixed;
z-index: 6;
left: 50%;
bottom: 20px;
width: min(940px, calc(100vw - 32px));
padding: 16px 18px 13px;
border: 1px solid rgba(255, 255, 255, 0.72);
border-radius: 19px;
background: rgba(255, 250, 240, 0.92);
box-shadow: var(--shadow);
backdrop-filter: blur(16px);
-webkit-backdrop-filter: blur(16px);
transform: translateX(-50%);
}
.timeline-head {
display: flex;
align-items: center;
justify-content: space-between;
gap: 14px;
margin-bottom: 12px;
}
.timeline-title {
font-size: 10px;
font-weight: 900;
letter-spacing: 0.15em;
text-transform: uppercase;
}
.timeline-title span {
color: var(--muted);
font-weight: 700;
}
#play {
min-width: 92px;
padding: 7px 12px;
border: 0;
border-radius: 8px;
background: var(--ink);
color: white;
cursor: pointer;
font-size: 10px;
font-weight: 900;
letter-spacing: 0.08em;
text-transform: uppercase;
transition: transform 150ms ease, background 150ms ease;
}
#play:hover {
background: var(--teal);
transform: translateY(-1px);
}
.issues {
position: relative;
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 10px;
}
.issues::before {
content: "";
position: absolute;
z-index: 0;
top: 13px;
left: 7%;
right: 7%;
height: 2px;
background: var(--line);
}
.issue {
position: relative;
z-index: 1;
display: grid;
grid-template-columns: 28px 1fr;
gap: 9px;
align-items: center;
min-width: 0;
padding: 8px 9px;
border: 1px solid transparent;
border-radius: 11px;
background: transparent;
color: var(--ink);
text-align: left;
cursor: pointer;
transition: border-color 160ms ease, background 160ms ease,
transform 160ms ease;
}
.issue:hover {
transform: translateY(-2px);
background: rgba(23, 43, 53, 0.035);
}
.issue.active {
border-color: rgba(28, 119, 116, 0.22);
background: rgba(28, 119, 116, 0.075);
}
.issue-marker {
display: grid;
place-items: center;
width: 26px;
height: 26px;
border: 3px solid var(--paper);
border-radius: 50%;
background: #a9b4b3;
box-shadow: 0 0 0 1px var(--line);
font-size: 9px;
font-weight: 900;
}
.issue.current .issue-marker {
background: var(--coral);
color: white;
}
.issue.archive .issue-marker {
background: var(--gold);
color: var(--ink);
}
.issue-date {
display: block;
margin-bottom: 2px;
font-size: 12px;
font-weight: 900;
}
.issue-type {
display: block;
overflow: hidden;
color: var(--muted);
font-size: 9px;
font-weight: 800;
letter-spacing: 0.08em;
text-overflow: ellipsis;
text-transform: uppercase;
white-space: nowrap;
}
.progress-track {
height: 3px;
margin-top: 11px;
overflow: hidden;
border-radius: 10px;
background: rgba(23, 43, 53, 0.09);
}
#progress {
width: 100%;
height: 100%;
border-radius: inherit;
background: linear-gradient(90deg, var(--coral), var(--gold), var(--teal));
transform: scaleX(0);
transform-origin: left center;
}
#loading {
position: fixed;
z-index: 20;
inset: 0;
display: grid;
place-items: center;
background: #dce8e3;
color: var(--ink);
font-size: 11px;
font-weight: 900;
letter-spacing: 0.16em;
text-transform: uppercase;
transition: opacity 400ms ease;
}
#loading.hidden {
opacity: 0;
pointer-events: none;
}
@media (max-width: 760px) {
.masthead {
top: 15px;
left: 15px;
}
.masthead h1 {
max-width: 280px;
font-size: 31px;
}
.masthead p {
display: none;
}
.brand {
margin-bottom: 10px;
}
#story-card {
top: auto;
right: 15px;
bottom: 164px;
width: 230px;
padding: 12px 13px;
}
#story-card h2 {
font-size: 19px;
}
#story-card p {
display: none;
}
.state-badge {
margin-top: 8px;
}
#hint {
display: none;
}
#timeline {
bottom: 10px;
width: calc(100vw - 20px);
padding: 13px 10px 10px;
}
.issue {
grid-template-columns: 24px 1fr;
gap: 6px;
padding: 6px 4px;
}
.issue-marker {
width: 23px;
height: 23px;
}
.issue-date {
font-size: 10px;
}
.issue-type {
font-size: 7px;
}
.timeline-title span {
display: none;
}
}
</style>
</head>
<body>
<div id="scene" aria-label="Interactive voxel newsstand"></div>
<header class="masthead">
<div class="brand">
<span class="brand-mark" aria-hidden="true">
<i></i><i></i><i></i><i></i>
</span>
The Daily Pixel / Field Desk
</div>
<h1>One stand.<br />Every edition counts.</h1>
<p>
A new edition arrives for display while yesterday’s copy joins the
clearly marked archive.
</p>
</header>
<aside id="story-card" aria-live="polite">
<div class="card-label">
<span>Edition desk</span>
<span><i class="live-dot"></i>Live</span>
</div>
<h2 id="story-title">The morning edition</h2>
<p id="story-copy">
Select any date below to follow its place in the publication history.
</p>
<span class="state-badge" id="state-badge">Delivery in progress</span>
</aside>
<div id="hint">Drag to orbit · Scroll to zoom</div>
<nav id="timeline" aria-label="Publication timeline">
<div class="timeline-head">
<div class="timeline-title">
Publication line <span>— history remains visible</span>
</div>
<button id="play" type="button">Ⅱ Pause</button>
</div>
<div class="issues">
<button class="issue current active" data-issue="july" type="button">
<span class="issue-marker">18</span>
<span>
<span class="issue-date">JUL 18, 2025</span>
<span class="issue-type">Current display</span>
</span>
</button>
<button class="issue archive" data-issue="april" type="button">
<span class="issue-marker">12</span>
<span>
<span class="issue-date">APR 12, 2025</span>
<span class="issue-type">Archive copy</span>
</span>
</button>
<button class="issue archive" data-issue="january" type="button">
<span class="issue-marker">03</span>
<span>
<span class="issue-date">JAN 03, 2025</span>
<span class="issue-type">Archive copy</span>
</span>
</button>
</div>
<div class="progress-track"><div id="progress"></div></div>
</nav>
<div id="loading">Building the edition desk…</div>
<script type="module">
import * as THREE from "https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
/* ------------------------------------------------------------------
Scene and renderer
------------------------------------------------------------------ */
const sceneHost = document.querySelector("#scene");
const loading = document.querySelector("#loading");
const scene = new THREE.Scene();
scene.background = new THREE.Color(0xdce8e3);
scene.fog = new THREE.Fog(0xdce8e3, 25, 45);
const camera = new THREE.PerspectiveCamera(
38,
innerWidth / innerHeight,
0.1,
100
);
const renderer = new THREE.WebGLRenderer({
antialias: true,
powerPreference: "high-performance"
});
renderer.setSize(innerWidth, innerHeight);
renderer.setPixelRatio(Math.min(devicePixelRatio, 2));
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1.12;
sceneHost.appendChild(renderer.domElement);
const hemi = new THREE.HemisphereLight(0xfff7df, 0x6e7d83, 2.2);
scene.add(hemi);
const sun = new THREE.DirectionalLight(0xfff0c5, 3.6);
sun.position.set(-8, 14, 10);
sun.castShadow = true;
sun.shadow.mapSize.set(2048, 2048);
sun.shadow.camera.left = -13;
sun.shadow.camera.right = 13;
sun.shadow.camera.top = 13;
sun.shadow.camera.bottom = -10;
sun.shadow.camera.near = 1;
sun.shadow.camera.far = 35;
sun.shadow.normalBias = 0.035;
scene.add(sun);
const rimLight = new THREE.DirectionalLight(0x9ad7d5, 1.25);
rimLight.position.set(9, 7, -8);
scene.add(rimLight);
/* ------------------------------------------------------------------
Geometry helpers
------------------------------------------------------------------ */
const materialCache = new Map();
function makeMaterial(color, roughness = 0.82) {
const key = `${color}-${roughness}`;
if (!materialCache.has(key)) {
materialCache.set(
key,
new THREE.MeshStandardMaterial({ color, roughness })
);
}
return materialCache.get(key);
}
function box(
parent,
width,
height,
depth,
x,
y,
z,
color,
options = {}
) {
const geometry = new THREE.BoxGeometry(width, height, depth);
const material =
color && color.isMaterial
? color
: new THREE.MeshStandardMaterial({
color,
roughness: options.roughness ?? 0.82,
metalness: options.metalness ?? 0,
emissive: options.emissive ?? 0x000000,
emissiveIntensity: options.emissiveIntensity ?? 0,
transparent: options.transparent ?? false,
opacity: options.opacity ?? 1
});
const mesh = new THREE.Mesh(geometry, material);
mesh.position.set(x, y, z);
mesh.castShadow = options.castShadow ?? true;
mesh.receiveShadow = options.receiveShadow ?? true;
parent.add(mesh);
return mesh;
}
function seededRandom(seed) {
let value = seed >>> 0;
return () => {
value = (value * 1664525 + 1013904223) >>> 0;
return value / 4294967296;
};
}
const random = seededRandom(20250718);
function clamp(value, min, max) {
return Math.max(min, Math.min(max, value));
}
function lerp(a, b, amount) {
return a + (b - a) * amount;
}
function smoothstep(value) {
const t = clamp(value, 0, 1);
return t * t * (3 - 2 * t);
}
function easeOutCubic(value) {
const t = clamp(value, 0, 1);
return 1 - Math.pow(1 - t, 3);
}
/* ------------------------------------------------------------------
Canvas-generated labels and publication covers
------------------------------------------------------------------ */
function makeSignTexture(
title,
subtitle,
background = "#173b43",
foreground = "#fff7df",
accent = "#ef6a4d"
) {
const canvas = document.createElement("canvas");
canvas.width = 1024;
canvas.height = 256;
const context = canvas.getContext("2d");
context.fillStyle = background;
context.fillRect(0, 0, canvas.width, canvas.height);
context.fillStyle = accent;
context.fillRect(0, 0, 22, canvas.height);
context.fillRect(34, 24, 956, 4);
context.fillRect(34, 228, 956, 4);
context.textAlign = "center";
context.fillStyle = foreground;
context.font = "900 80px Arial, sans-serif";
context.fillText(title, 520, 135);
if (subtitle) {
context.font = "700 28px Arial, sans-serif";
context.fillText(subtitle, 520, 188);
}
const texture = new THREE.CanvasTexture(canvas);
texture.colorSpace = THREE.SRGBColorSpace;
texture.anisotropy = Math.min(
8,
renderer.capabilities.getMaxAnisotropy()
);
return texture;
}
function makeCoverTexture(issue) {
const canvas = document.createElement("canvas");
canvas.width = 512;
canvas.height = 768;
const context = canvas.getContext("2d");
context.fillStyle = issue.cover;
context.fillRect(0, 0, 512, 768);
context.fillStyle = issue.accent;
context.fillRect(30, 30, 452, 128);
context.fillRect(30, 178, 452, 15);
context.fillStyle = issue.paper;
context.font = "900 72px Arial, sans-serif";
context.textAlign = "center";
context.fillText("DAILY", 256, 91);
context.font = "900 60px Arial, sans-serif";
context.fillText("PIXEL", 256, 142);
context.fillStyle = issue.ink;
context.fillRect(30, 218, 452, 244);
// Pixel-art cover illustration.
context.fillStyle = issue.accent;
context.fillRect(77, 276, 68, 68);
context.fillRect(145, 245, 68, 130);
context.fillRect(213, 215, 68, 190);
context.fillRect(281, 276, 68, 68);
context.fillRect(349, 245, 68, 130);
context.fillStyle = issue.paper;
context.fillRect(106, 314, 38, 38);
context.fillRect(237, 258, 38, 38);
context.fillRect(305, 314, 38, 38);
context.fillStyle = issue.paper;
context.font = "900 37px Arial, sans-serif";
context.fillText(issue.headline, 256, 515);
context.fillStyle = issue.ink;
context.font = "700 25px Arial, sans-serif";
context.fillText(issue.edition.toUpperCase(), 256, 570);
context.fillStyle = issue.accent;
context.fillRect(30, 610, 452, 74);
context.fillStyle = issue.ink;
context.font = "900 31px Arial, sans-serif";
context.fillText(issue.date, 256, 659);
context.fillStyle = issue.ink;
context.font = "700 17px Arial, sans-serif";
context.fillText("THE CITY, ONE PIXEL AT A TIME.", 256, 724);
const texture = new THREE.CanvasTexture(canvas);
texture.colorSpace = THREE.SRGBColorSpace;
texture.anisotropy = Math.min(
8,
renderer.capabilities.getMaxAnisotropy()
);
return texture;
}
function createSign(
parent,
width,
height,
x,
y,
z,
texture,
boardColor = 0x173b43
) {
const board = box(
parent,
width + 0.12,
height + 0.12,
0.12,
x,
y,
z,
boardColor
);
const face = new THREE.Mesh(
new THREE.PlaneGeometry(width, height),
new THREE.MeshBasicMaterial({ map: texture })
);
face.position.set(x, y, z + 0.067);
parent.add(face);
return { board, face };
}
function createIssue(issue) {
const group = new THREE.Group();
group.name = issue.id;
const coverMaterial = new THREE.MeshStandardMaterial({
color: issue.cover,
roughness: 0.76
});
box(group, 0.95, 1.38, 0.13, 0, 0, 0, coverMaterial);
box(
group,
0.89,
1.31,
0.018,
0.018,
0,
0.072,
0xfff7df,
{ roughness: 0.9 }
);
const coverFace = new THREE.Mesh(
new THREE.PlaneGeometry(0.87, 1.29),
new THREE.MeshBasicMaterial({ map: makeCoverTexture(issue) })
);
coverFace.position.set(0.018, 0, 0.084);
group.add(coverFace);
// Small voxel tabs make the copies read as physical publications.
box(group, 0.12, 0.08, 0.04, -0.38, 0.64, 0.088, issue.accent);
box(group, 0.12, 0.08, 0.04, 0.38, -0.64, 0.088, issue.accent);
scene.add(group);
return group;
}
const issueData = {
july: {
id: "july",
date: "JUL 18 / 2025",
headline: "CITY GOES BRIGHT",
edition: "Morning edition",
cover: "#168b89",
accent: "#f3bd43",
ink: "#17323b",
paper: "#fff8df"
},
april: {
id: "april",
date: "APR 12 / 2025",
headline: "AFTER THE RAIN",
edition: "City edition",
cover: "#e6b93f",
accent: "#214e66",
ink: "#172b35",
paper: "#fff9e9"
},
january: {
id: "january",
date: "JAN 03 / 2025",
headline: "WINTER REPORT",
edition: "Winter edition",
cover: "#66578c",
accent: "#8bc7a9",
ink: "#1e2938",
paper: "#fff9e9"
}
};
/* ------------------------------------------------------------------
Voxel environment
------------------------------------------------------------------ */
const environment = new THREE.Group();
scene.add(environment);
box(environment, 20, 0.65, 15, 0, -0.55, 0, 0xbfcac5);
box(
environment,
20,
0.12,
3.8,
0,
-0.11,
5.35,
0x53666b,
{ roughness: 1 }
);
// Sidewalk tiles.
for (let x = -9; x <= 9; x += 1.15) {
for (let z = -2.6; z <= 4.5; z += 1.1) {
const shade = random() > 0.5 ? 0xe1dfd2 : 0xd8d9ce;
box(
environment,
1.06,
0.12,
1.01,
x + random() * 0.03,
-0.13,
z + random() * 0.03,
shade,
{ roughness: 1 }
);
}
}
// Road lane markers.
for (let x = -8; x <= 8; x += 2.2) {
box(
environment,
1.1,
0.035,
0.11,
x,
-0.015,
5.4,
0xf2d478,
{ roughness: 1 }
);
}
// Delivery stepping dots.
for (let i = 0; i < 9; i++) {
box(
environment,
0.22,
0.025,
0.22,
-6.3 + i * 0.44,
-0.045,
2.95,
0xef6a4d,
{ roughness: 1 }
);
}
// Background city blocks.
const buildingColors = [
0x91aaa6,
0xb3b7a5,
0x9aa6b4,
0xb7aa9a,
0x8ea7a3
];
const buildingX = [-8.3, -5.1, -1.8, 1.7, 5.3, 8.2];
buildingX.forEach((x, index) => {
const height = 3.3 + random() * 3.8;
const width = 2.5 + random() * 1.6;
const color = buildingColors[index % buildingColors.length];
box(
environment,
width,
height,
2.4,
x,
height / 2 - 0.1,
-6.5 - random() * 0.5,
color,
{ roughness: 1 }
);
box(
environment,
width + 0.25,
0.22,
2.6,
x,
height,
-6.5,
0xd8d2bd,
{ roughness: 1 }
);
const windowMaterial = new THREE.MeshStandardMaterial({
color: 0xffe29b,
emissive: 0xffc85c,
emissiveIntensity: 0.22,
roughness: 0.65
});
for (let row = 0; row < Math.floor(height / 0.85); row++) {
for (let col = -1; col <= 1; col++) {
if (random() > 0.28) {
box(
environment,
0.27,
0.34,
0.035,
x + col * 0.58,
0.55 + row * 0.82,
-5.27,
windowMaterial,
{ castShadow: false }
);
}
}
}
});
// Square sun.
box(
environment,
1.55,
1.55,
0.18,
-7.2,
8.1,
-7.6,
0xf5c85d,
{ castShadow: false, roughness: 1 }
);
// Planters and voxel trees.
function createTree(x, z, scale = 1) {
const group = new THREE.Group();
group.position.set(x, 0, z);
group.scale.setScalar(scale);
box(group, 0.68, 0.55, 0.68, 0, 0.28, 0, 0xb46d4f);
box(group, 0.28, 1.5, 0.28, 0, 1.1, 0, 0x7d5b42);
box(group, 1.15, 0.9, 1.05, 0, 2.0, 0, 0x5e9676);
box(group, 0.72, 0.78, 0.78, -0.38, 2.45, 0.03, 0x78ad87);
box(group, 0.65, 0.72, 0.72, 0.42, 2.36, -0.02, 0x6aa07b);
scene.add(group);
}
createTree(-5.1, -3.2, 0.9);
createTree(6.0, -2.5, 1.05);
// Street lamp.
box(environment, 0.18, 4.9, 0.18, 6.2, 2.35, 2.0, 0x35505a);
box(environment, 0.85, 0.16, 0.16, 6.2, 4.73, 2.0, 0x35505a);
box(
environment,
0.46,
0.4,
0.46,
6.2,
4.52,
2.0,
new THREE.MeshStandardMaterial({
color: 0xffe7a6,
emissive: 0xffc75e,
emissiveIntensity: 1.4
})
);
/* ------------------------------------------------------------------
Newsstand
------------------------------------------------------------------ */
const stand = new THREE.Group();
scene.add(stand);
box(stand, 8.8, 0.22, 4.0, 0.5, 0.04, 0.15, 0x356d6b);
box(stand, 8.45, 4.05, 0.28, 0.5, 2.12, -1.83, 0x1d5559);
box(stand, 8.7, 0.22, 0.42, 0.5, 4.25, -1.73, 0xf1e4c7);
// Structural posts.
box(stand, 0.24, 4.15, 0.24, -3.56, 2.15, 1.95, 0xf1e4c7);
box(stand, 0.24, 4.15, 0.24, 4.56, 2.15, 1.95, 0xf1e4c7);
box(stand, 0.24, 4.15, 0.24, -3.56, 2.15, -1.6, 0xf1e4c7);
box(stand, 0.24, 4.15, 0.24, 4.56, 2.15, -1.6, 0xf1e4c7);
// Counter and display area.
box(stand, 5.7, 1.35, 1.25, -0.05, 0.79, 1.08, 0xd56a50);
box(stand, 5.92, 0.18, 1.45, -0.05, 1.53, 1.12, 0xf3dfbc);
box(stand, 5.55, 0.12, 0.13, -0.05, 1.18, 1.73, 0xf2c55b);
// Current-edition pedestal.
box(stand, 1.7, 0.16, 0.82, 0.25, 1.66, 1.92, 0x214f5c);
box(stand, 1.35, 0.22, 0.58, 0.25, 1.52, 1.94, 0xf2d9ac);
// Archive compartment.
box(stand, 2.5, 2.42, 0.18, 3.82, 1.27, 0.62, 0x244e55);
box(stand, 2.55, 0.18, 1.45, 3.82, 0.2, 1.15, 0xe3b968);
box(stand, 0.18, 2.52, 1.5, 2.57, 1.3, 1.13, 0xf1dfb9);
box(stand, 0.18, 2.52, 1.5, 5.07, 1.3, 1.13, 0xf1dfb9);
box(stand, 2.5, 0.18, 1.5, 3.82, 2.55, 1.13, 0xe7c890);
// Stripe awning.
for (let index = 0; index < 10; index++) {
const color = index % 2 === 0 ? 0xef6a4d : 0xfff0d2;
box(
stand,
0.86,
0.3,
2.4,
-3.45 + index * 0.88,
4.05,
1.25,
color
);
box(
stand,
0.86,
0.42,
0.16,
-3.45 + index * 0.88,
3.86,
2.44,
color
);
}
const mainSign = createSign(
stand,
7.15,
1.05,
0.5,
4.95,
1.03,
makeSignTexture(
"THE DAILY PIXEL",
"NEWS • CULTURE • CITY LIFE",
"#173b43",
"#fff6dc",
"#ef6a4d"
)
);
mainSign.board.castShadow = false;
const currentSignApril = makeSignTexture(
"CURRENT DISPLAY",
"APRIL 12 EDITION",
"#214f5c",
"#fff6dc",
"#f3bd43"
);
const currentSignJuly = makeSignTexture(
"CURRENT DISPLAY",
"JULY 18 EDITION",
"#214f5c",
"#fff6dc",
"#ef6a4d"
);
const currentSign = createSign(
stand,
2.35,
0.56,
0.25,
3.48,
1.52,
currentSignApril,
0x214f5c
);
const archiveSignOne = makeSignTexture(
"ARCHIVE",
"1 COPY RETAINED",
"#6d4d31",
"#fff4d8",
"#f3bd43"
);
const archiveSignTwo = makeSignTexture(
"ARCHIVE",
"2 COPIES RETAINED",
"#6d4d31",
"#fff4d8",
"#f3bd43"
);
const archiveSign = createSign(
stand,
2.25,
0.58,
3.82,
2.66,
1.21,
archiveSignOne,
0x6d4d31
);
// Small shop details.
box(stand, 0.65, 0.42, 0.58, 1.72, 1.86, 0.35, 0x315963);
box(stand, 0.48, 0.08, 0.38, 1.72, 2.1, 0.38, 0x9bc6b4);
box(stand, 0.28, 0.18, 0.24, 1.72, 2.2, 0.38, 0xef6a4d);
for (let i = 0; i < 5; i++) {
box(
stand,
0.62,
0.15,
0.42,
-2.35 + i * 0.68,
1.78,
0.3,
i % 2 ? 0xf0cf84 : 0xd7ded0
);
}
/* ------------------------------------------------------------------
Voxel news vendor
------------------------------------------------------------------ */
const vendor = new THREE.Group();
vendor.position.set(1.35, 0, -0.95);
scene.add(vendor);
box(vendor, 0.82, 0.85, 0.48, 0, 1.85, 0, 0xe5b74c);
box(vendor, 0.47, 0.42, 0.42, 0, 2.55, 0.02, 0xd69a73);
box(vendor, 0.52, 0.18, 0.46, 0, 2.81, 0, 0x49392f);
box(vendor, 0.12, 0.12, 0.08, -0.13, 2.57, 0.25, 0x172b35);
box(vendor, 0.12, 0.12, 0.08, 0.13, 2.57, 0.25, 0x172b35);
box(vendor, 0.2, 0.05, 0.06, 0, 2.38, 0.27, 0x8b4e42);
const vendorLeftArm = new THREE.Group();
vendorLeftArm.position.set(-0.47, 2.15, 0);
box(vendorLeftArm, 0.22, 0.7, 0.22, 0, -0.3, 0, 0xe5b74c);
box(vendorLeftArm, 0.22, 0.16, 0.22, 0, -0.68, 0, 0xd69a73);
vendor.add(vendorLeftArm);
const vendorRightArm = new THREE.Group();
vendorRightArm.position.set(0.47, 2.15, 0);
box(vendorRightArm, 0.22, 0.7, 0.22, 0, -0.3, 0, 0xe5b74c);
box(vendorRightArm, 0.22, 0.16, 0.22, 0, -0.68, 0, 0xd69a73);
vendor.add(vendorRightArm);
/* ------------------------------------------------------------------
Courier and delivery cart
------------------------------------------------------------------ */
const courier = new THREE.Group();
courier.position.set(-6.15, 0, 2.15);
scene.add(courier);
box(courier, 0.8, 0.88, 0.48, 0, 1.42, 0, 0x1c7774);
box(courier, 0.52, 0.46, 0.46, 0, 2.1, 0.01, 0xc98261);
box(courier, 0.58, 0.15, 0.5, 0, 2.38, 0, 0xef6a4d);
box(courier, 0.36, 0.12, 0.23, 0, 2.34, 0.31, 0xef6a4d);
box(courier, 0.1, 0.1, 0.07, -0.13, 2.13, 0.26, 0x172b35);
box(courier, 0.1, 0.1, 0.07, 0.13, 2.13, 0.26, 0x172b35);
// Courier satchel.
box(courier, 0.46, 0.55, 0.3, -0.42, 1.35, 0.18, 0xb95844);
box(courier, 0.5, 0.1, 0.34, -0.42, 1.55, 0.18, 0x804638);
const courierLeftArm = new THREE.Group();
courierLeftArm.position.set(-0.46, 1.78, 0);
box(courierLeftArm, 0.21, 0.68, 0.22, 0, -0.31, 0, 0x1c7774);
box(courierLeftArm, 0.22, 0.16, 0.22, 0, -0.68, 0, 0xc98261);
courier.add(courierLeftArm);
const courierRightArm = new THREE.Group();
courierRightArm.position.set(0.46, 1.78, 0);
box(courierRightArm, 0.21, 0.68, 0.22, 0, -0.31, 0, 0x1c7774);
box(courierRightArm, 0.22, 0.16, 0.22, 0, -0.68, 0, 0xc98261);
courier.add(courierRightArm);
const courierLeftLeg = new THREE.Group();
courierLeftLeg.position.set(-0.23, 1.08, 0);
box(courierLeftLeg, 0.28, 0.75, 0.3, 0, -0.34, 0, 0x324f60);
box(courierLeftLeg, 0.3, 0.18, 0.44, 0, -0.78, 0.07, 0x26363b);
courier.add(courierLeftLeg);
const courierRightLeg = new THREE.Group();
courierRightLeg.position.set(0.23, 1.08, 0);
box(courierRightLeg, 0.28, 0.75, 0.3, 0, -0.34, 0, 0x324f60);
box(courierRightLeg, 0.3, 0.18, 0.44, 0, -0.78, 0.07, 0x26363b);
courier.add(courierRightLeg);
// Delivery cart.
const cart = new THREE.Group();
cart.position.set(-7.05, 0, 2.85);
scene.add(cart);
box(cart, 1.45, 0.16, 0.86, 0, 0.62, 0, 0xef6a4d);
box(cart, 1.2, 0.17, 0.7, 0, 0.75, 0, 0xf0cf84);
box(cart, 0.12, 1.15, 0.12, -0.55, 1.2, 0.32, 0x52666b);
box(cart, 0.12, 0.12, 0.8, -0.55, 1.72, 0, 0x52666b);
box(cart, 0.28, 0.28, 0.18, -0.53, 0.33, 0.35, 0x273a40);
box(cart, 0.28, 0.28, 0.18, 0.53, 0.33, 0.35, 0x273a40);
box(cart, 0.28, 0.28, 0.18, -0.53, 0.33, -0.35, 0x273a40);
box(cart, 0.28, 0.28, 0.18, 0.53, 0.33, -0.35, 0x273a40);
/* ------------------------------------------------------------------
Publication copies
------------------------------------------------------------------ */
const julyIssue = createIssue(issueData.july);
const aprilIssue = createIssue(issueData.april);
const januaryIssue = createIssue(issueData.january);
const currentStart = new THREE.Vector3(0.25, 2.42, 1.94);
const aprilArchive = new THREE.Vector3(4.25, 1.12, 1.72);
const januaryArchive = new THREE.Vector3(3.12, 1.12, 1.64);
const julyCurrent = new THREE.Vector3(0.25, 2.42, 1.94);
aprilIssue.position.copy(currentStart);
januaryIssue.position.copy(januaryArchive);
januaryIssue.scale.setScalar(0.8);
const heldJulyPosition = new THREE.Vector3();
julyIssue.position.set(-5.55, 1.98, 2.45);
/* ------------------------------------------------------------------
Voxel celebration particles
------------------------------------------------------------------ */
const confetti = [];
const confettiColors = [
0xef6a4d,
0xf3bd43,
0x48a39d,
0xfff2cc,
0x5d7790
];
for (let index = 0; index < 24; index++) {
const material = new THREE.MeshBasicMaterial({
color: confettiColors[index % confettiColors.length],
transparent: true
});
const particle = box(
scene,
0.075,
0.075,
0.075,
0,
-20,
0,
material,
{ castShadow: false, receiveShadow: false }
);
particle.visible = false;
confetti.push({
mesh: particle,
velocity: new THREE.Vector3(
(random() - 0.5) * 2.6,
1.7 + random() * 2.2,
(random() - 0.5) * 2.1
),
spin: random() * Math.PI * 2
});
}
/* ------------------------------------------------------------------
Camera controls — implemented without addons
------------------------------------------------------------------ */
const orbit = {
theta: 0.37,
pitch: 0.72,
distance: 15.2,
target: new THREE.Vector3(0.35, 2.05, 0.15)
};
let dragging = false;
let pointerX = 0;
let pointerY = 0;
renderer.domElement.addEventListener("pointerdown", (event) => {
dragging = true;
pointerX = event.clientX;
pointerY = event.clientY;
renderer.domElement.setPointerCapture(event.pointerId);
});
renderer.domElement.addEventListener("pointermove", (event) => {
if (!dragging) return;
const deltaX = event.clientX - pointerX;
const deltaY = event.clientY - pointerY;
orbit.theta -= deltaX * 0.006;
orbit.pitch = clamp(orbit.pitch + deltaY * 0.004, 0.42, 1.17);
pointerX = event.clientX;
pointerY = event.clientY;
});
function stopDragging(event) {
dragging = false;
if (event && renderer.domElement.hasPointerCapture(event.pointerId)) {
renderer.domElement.releasePointerCapture(event.pointerId);
}
}
renderer.domElement.addEventListener("pointerup", stopDragging);
renderer.domElement.addEventListener("pointercancel", stopDragging);
renderer.domElement.addEventListener(
"wheel",
(event) => {
event.preventDefault();
orbit.distance = clamp(
orbit.distance + event.deltaY * 0.012,
10.5,
22
);
},
{ passive: false }
);
renderer.domElement.addEventListener("dblclick", () => {
orbit.theta = 0.37;
orbit.pitch = 0.72;
orbit.distance = 15.2;
});
function updateCamera() {
const horizontal = Math.sin(orbit.pitch) * orbit.distance;
camera.position.set(
orbit.target.x + horizontal * Math.sin(orbit.theta),
orbit.target.y + Math.cos(orbit.pitch) * orbit.distance,
orbit.target.z + horizontal * Math.cos(orbit.theta)
);
camera.lookAt(orbit.target);
}
/* ------------------------------------------------------------------
Animation state and UI
------------------------------------------------------------------ */
const duration = 9.2;
let playhead = 0;
let playing = true;
let selectedIssue = "july";
let lastStatus = "";
const playButton = document.querySelector("#play");
const progress = document.querySelector("#progress");
const storyTitle = document.querySelector("#story-title");
const storyCopy = document.querySelector("#story-copy");
const stateBadge = document.querySelector("#state-badge");
const issueButtons = [...document.querySelectorAll(".issue")];
const storyContent = {
july: {
title: "The morning edition",
copy:
"July 18 occupies the current-display pedestal. The cover is new, while the timeline continues to preserve every earlier edition.",
badge: "Current display"
},
april: {
title: "Yesterday’s edition",
copy:
"April 12 has not disappeared. It moves into the marked archive beside the retained January copy.",
badge: "Archive copy retained"
},
january: {
title: "The first edition",
copy:
"January 03 remains on the archive shelf as the oldest visible copy. The timeline records it even when the display changes again.",
badge: "Archive copy retained"
}
};
function selectIssue(id) {
selectedIssue = id;
const content = storyContent[id];
issueButtons.forEach((button) => {
const active = button.dataset.issue === id;
button.classList.toggle("active", active);
if (active) {
button.setAttribute("aria-current", "true");
} else {
button.removeAttribute("aria-current");
}
});
storyTitle.textContent = content.title;
storyCopy.textContent = content.copy;
if (playhead >= duration - 0.05) {
stateBadge.textContent = content.badge;
}
}
issueButtons.forEach((button) => {
button.addEventListener("click", () => {
selectIssue(button.dataset.issue);
});
});
function resetAnimation() {
playhead = 0;
playing = true;
lastStatus = "";
selectIssue("july");
updatePlayButton();
}
function updatePlayButton() {
if (playhead >= duration) {
playButton.textContent = "↻ Replay";
} else if (playing) {
playButton.textContent = "Ⅱ Pause";
} else {
playButton.textContent = "▶ Play";
}
}
playButton.addEventListener("click", () => {
if (playhead >= duration) {
resetAnimation();
} else {
playing = !playing;
updatePlayButton();
}
});
window.addEventListener("keydown", (event) => {
if (event.code === "Space") {
event.preventDefault();
playButton.click();
}
if (event.key.toLowerCase() === "r") {
resetAnimation();
}
});
function setStatus(text, badge) {
if (text === lastStatus) return;
lastStatus = text;
stateBadge.textContent = badge;
}
function quadraticBezier(out, a, b, c, t) {
const inverse = 1 - t;
out.set(
inverse * inverse * a.x + 2 * inverse * t * b.x + t * t * c.x,
inverse * inverse * a.y + 2 * inverse * t * b.y + t * t * c.y,
inverse * inverse * a.z + 2 * inverse * t * b.z + t * t * c.z
);
return out;
}
const flightStart = new THREE.Vector3();
const flightControl = new THREE.Vector3();
const flightEnd = new THREE.Vector3();
const temporaryVector = new THREE.Vector3();
/* ------------------------------------------------------------------
Main animation
------------------------------------------------------------------ */
const clock = new THREE.Clock();
function animate() {
requestAnimationFrame(animate);
const delta = Math.min(clock.getDelta(), 0.05);
const elapsed = clock.elapsedTime;
if (playing && playhead < duration) {
playhead = Math.min(duration, playhead + delta);
if (playhead >= duration) {
playing = false;
updatePlayButton();
}
}
const time = playhead;
progress.style.transform = `scaleX(${time / duration})`;
/* Courier walk: 0–3.4 seconds. */
const walkProgress = easeOutCubic(time / 3.4);
courier.position.x = lerp(-6.15, -3.32, walkProgress);
courier.position.y = time < 3.4 ? Math.abs(Math.sin(elapsed * 10)) * 0.035 : 0;
const isWalking = time > 0.05 && time < 3.4;
const stride = isWalking ? Math.sin(elapsed * 10) * 0.55 : 0;
courierLeftLeg.rotation.z = stride;
courierRightLeg.rotation.z = -stride;
courierLeftArm.rotation.z = -stride * 0.58;
courierRightArm.rotation.z = time > 3.4
? Math.sin(elapsed * 4.5) * 0.45
: stride * 0.58;
/* Vendor receives the issue and waves. */
vendorRightArm.rotation.z =
time > 3.4
? -0.45 + Math.sin(elapsed * 4.5) * 0.38
: -0.08;
vendorLeftArm.rotation.z = 0.12 + Math.sin(elapsed * 1.8) * 0.08;
/* New July copy: carried, then flown to the display. */
if (time < 3.45) {
heldJulyPosition.set(
courier.position.x + 0.58,
1.98,
2.45
);
julyIssue.position.copy(heldJulyPosition);
julyIssue.rotation.set(0, 0.08, -0.08);
} else {
const flight = smoothstep((time - 3.45) / 1.95);
flightStart.set(
-2.74,
1.98,
2.45
);
flightControl.set(
-1.05,
4.0,
3.8
);
flightEnd.copy(julyCurrent);
quadraticBezier(
temporaryVector,
flightStart,
flightControl,
flightEnd,
flight
);
julyIssue.position.copy(temporaryVector);
julyIssue.rotation.y = Math.sin(flight * Math.PI) * 0.8;
julyIssue.rotation.z = Math.sin(flight * Math.PI) * 0.18;
}
/* April copy leaves the display but is retained in the archive. */
if (time < 3.05) {
aprilIssue.position.copy(currentStart);
aprilIssue.rotation.set(0, 0, 0);
aprilIssue.scale.setScalar(1);
} else {
const archiveMove = smoothstep((time - 3.05) / 2.05);
temporaryVector.lerpVectors(
currentStart,
aprilArchive,
archiveMove
);
temporaryVector.y += Math.sin(archiveMove * Math.PI) * 1.42;
aprilIssue.position.copy(temporaryVector);
aprilIssue.rotation.y = archiveMove * 0.32;
aprilIssue.rotation.z = -Math.sin(archiveMove * Math.PI) * 0.12;
aprilIssue.scale.setScalar(lerp(1, 0.82, archiveMove));
}
/* January remains visible, shifting slightly to make room. */
const januaryNudge = smoothstep((time - 3.05) / 1.2);
januaryIssue.position.set(
januaryArchive.x - januaryNudge * 0.08,
januaryArchive.y,
januaryArchive.z - januaryNudge * 0.08
);
januaryIssue.rotation.y = -0.04 * januaryNudge;
/* Physical labels update without removing prior editions. */
currentSign.face.material.map =
time < 5.25 ? currentSignApril : currentSignJuly;
archiveSign.face.material.map =
time < 3.05 ? archiveSignOne : archiveSignTwo;
/* Selected publication gently pulses. */
const pulse = 1 + Math.sin(elapsed * 4.4) * 0.018;
if (selectedIssue === "july") {
julyIssue.scale.setScalar(pulse);
} else if (selectedIssue === "april") {
aprilIssue.scale.multiplyScalar(pulse);
} else {
januaryIssue.scale.setScalar(0.8 * pulse);
}
/* Voxel confetti at the moment of display. */
const confettiTime = (time - 5.25) / 1.5;
confetti.forEach((particle, index) => {
if (confettiTime <= 0 || confettiTime >= 1) {
particle.mesh.visible = false;
return;
}
particle.mesh.visible = true;
particle.mesh.position.set(
julyCurrent.x + particle.velocity.x * confettiTime,
julyCurrent.y + 0.5 +
particle.velocity.y * confettiTime -
2.35 * confettiTime * confettiTime,
julyCurrent.z + particle.velocity.z * confettiTime
);
particle.mesh.rotation.set(
particle.spin * confettiTime,
particle.spin * confettiTime * 1.7,
particle.spin * 0.5 * confettiTime
);
const fade = confettiTime > 0.72
? 1 - (confettiTime - 0.72) / 0.28
: 1;
particle.mesh.material.opacity = clamp(fade, 0, 1);
particle.mesh.scale.setScalar(0.7 + fade * 0.3);
});
/* Delivery status. */
if (time < 1.6) {
setStatus("Courier approaching", "Delivery in progress");
} else if (time < 3.45) {
setStatus("July edition received", "New edition in transit");
} else if (time < 5.25) {
setStatus("Replacing the display copy", "Archive update in progress");
} else if (time < duration) {
setStatus("New edition displayed", "History preserved");
} else {
setStatus(
storyContent[selectedIssue].badge,
storyContent[selectedIssue].badge
);
}
updateCamera();
renderer.render(scene, camera);
}
window.addEventListener("resize", () => {
camera.aspect = innerWidth / innerHeight;
camera.updateProjectionMatrix();
renderer.setSize(innerWidth, innerHeight);
renderer.setPixelRatio(Math.min(devicePixelRatio, 2));
});
selectIssue("july");
updateCamera();
updatePlayButton();
animate();
requestAnimationFrame(() => {
loading.classList.add("hidden");
setTimeout(() => loading.remove(), 450);
});
</script>
</body>
</html>
```