Prompt specification
Build or customize the Three.js 3D scene "Neighborhood news kiosk conversation" 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: Neighborhood news kiosk conversation
Category: Architecture & Cities · Style: Procedural Solid / Shader 3D
License: MIT · Reference: https://three3d.app/scene/neighborhood-news-kiosk-conversation-x0515
Scene Description Prompt:
I'd like to see this as a stylized Three.js scene: neighborhood news kiosk conversation. Compose a kiosk, noticeboard, benches, and visitors; people compare a printed headline with a dated public announcement, and highlighted dates establish the sequence of events. Use cdnjs and return one self-contained HTML file.
Working Three.js Starter (neighborhood-news-kiosk-conversation-x0515):
```html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>One Headline, Three Dates — Neighborhood News Kiosk</title>
<style>
:root {
--ink: #17343a;
--paper: #fffaf0;
--teal: #267c78;
--coral: #e66f55;
--gold: #f2bf49;
--glass: rgba(255, 250, 240, 0.9);
}
* { box-sizing: border-box; }
html, body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: #dce9e1;
color: var(--ink);
font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
"Segoe UI", sans-serif;
}
canvas {
position: fixed;
inset: 0;
display: block;
width: 100%;
height: 100%;
touch-action: none;
cursor: grab;
}
canvas:active { cursor: grabbing; }
.story {
position: fixed;
z-index: 5;
top: 24px;
left: 24px;
width: min(340px, calc(100vw - 48px));
padding: 20px 22px;
border: 1px solid rgba(23, 52, 58, 0.14);
border-radius: 18px;
background: var(--glass);
box-shadow: 0 16px 45px rgba(32, 66, 63, 0.14);
backdrop-filter: blur(12px);
pointer-events: none;
}
.eyebrow {
margin-bottom: 9px;
color: var(--coral);
font-size: 11px;
font-weight: 800;
letter-spacing: 0.16em;
text-transform: uppercase;
}
h1 {
margin: 0;
font-family: Georgia, "Times New Roman", serif;
font-size: clamp(30px, 4vw, 43px);
font-weight: 700;
line-height: 0.98;
letter-spacing: -0.035em;
}
.story p {
margin: 14px 0 16px;
color: rgba(23, 52, 58, 0.78);
font-size: 13px;
line-height: 1.55;
}
.dates {
display: flex;
align-items: center;
gap: 7px;
flex-wrap: wrap;
}
.date {
display: inline-flex;
align-items: center;
gap: 6px;
padding: 7px 9px;
border-radius: 999px;
background: #fffdf8;
font-size: 11px;
font-weight: 800;
letter-spacing: 0.04em;
box-shadow: inset 0 0 0 1px rgba(23, 52, 58, 0.12);
}
.date i {
width: 8px;
height: 8px;
border-radius: 50%;
background: var(--gold);
box-shadow: 0 0 0 3px rgba(242, 191, 73, 0.2);
}
.arrow {
color: rgba(23, 52, 58, 0.45);
font-weight: 900;
}
.controls {
position: fixed;
z-index: 6;
right: 22px;
bottom: 22px;
display: flex;
gap: 8px;
padding: 7px;
border: 1px solid rgba(23, 52, 58, 0.14);
border-radius: 14px;
background: var(--glass);
box-shadow: 0 12px 32px rgba(32, 66, 63, 0.13);
backdrop-filter: blur(12px);
}
button {
border: 0;
border-radius: 9px;
padding: 9px 12px;
background: transparent;
color: var(--ink);
font: inherit;
font-size: 12px;
font-weight: 750;
cursor: pointer;
transition: background 150ms ease, color 150ms ease, transform 150ms ease;
}
button:hover {
background: rgba(38, 124, 120, 0.11);
color: var(--teal);
}
button:active { transform: translateY(1px); }
button.primary {
background: var(--ink);
color: var(--paper);
}
button.primary:hover {
background: var(--teal);
color: white;
}
.hint {
position: fixed;
z-index: 5;
left: 50%;
bottom: 25px;
transform: translateX(-50%);
padding: 9px 13px;
border-radius: 999px;
background: rgba(23, 52, 58, 0.82);
color: #fffaf0;
font-size: 11px;
font-weight: 650;
letter-spacing: 0.03em;
pointer-events: none;
white-space: nowrap;
}
.loading {
position: fixed;
z-index: 20;
inset: 0;
display: grid;
place-items: center;
background: #dce9e1;
color: var(--ink);
font-size: 13px;
font-weight: 750;
letter-spacing: 0.08em;
text-transform: uppercase;
transition: opacity 400ms ease;
}
.loading.hidden {
opacity: 0;
pointer-events: none;
}
@media (max-width: 700px) {
.story {
top: 12px;
left: 12px;
width: min(300px, calc(100vw - 24px));
padding: 15px 17px;
}
.story p { display: none; }
.dates { margin-top: 13px; }
.hint { display: none; }
.controls {
right: 12px;
bottom: 12px;
left: 12px;
justify-content: center;
}
button { flex: 1; padding-inline: 7px; }
}
</style>
</head>
<body>
<div class="loading" id="loading">Building the neighborhood…</div>
<section class="story" aria-label="Scene description">
<div class="eyebrow">Corner news · Conversation in three dates</div>
<h1>One headline.<br />Three dates.</h1>
<p>
A visitor reads the May 2 edition while a neighbor checks the public notice.
The highlighted dates reveal how the story moves from press to announcement
to the next community gathering.
</p>
<div class="dates" aria-label="Story timeline">
<span class="date"><i></i> MAY 02</span>
<span class="arrow">→</span>
<span class="date"><i></i> MAY 08</span>
<span class="arrow">→</span>
<span class="date"><i></i> MAY 15</span>
</div>
</section>
<nav class="controls" aria-label="Camera views">
<button class="primary" data-view="reset">Full scene</button>
<button data-view="kiosk">Kiosk</button>
<button data-view="notice">Notice</button>
<button data-view="timeline">Timeline</button>
</nav>
<div class="hint">Drag to orbit · Scroll to zoom · Shift-drag to pan</div>
<script type="module">
import * as THREE from "https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
const loading = document.querySelector("#loading");
// ---------------------------------------------------------------------
// Renderer, camera, lighting
// ---------------------------------------------------------------------
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.12;
document.body.prepend(renderer.domElement);
const scene = new THREE.Scene();
scene.background = new THREE.Color(0xdce9e1);
scene.fog = new THREE.Fog(0xdce9e1, 25, 43);
const camera = new THREE.PerspectiveCamera(42, window.innerWidth / window.innerHeight, 0.1, 70);
const currentView = {
target: new THREE.Vector3(0, 1.0, 0),
radius: 17.2,
theta: 0.58,
phi: 1.02
};
const goalView = {
target: currentView.target.clone(),
radius: currentView.radius,
theta: currentView.theta,
phi: currentView.phi
};
const hemi = new THREE.HemisphereLight(0xf7fbef, 0x73958a, 2.15);
scene.add(hemi);
const sun = new THREE.DirectionalLight(0xfff0ce, 3.25);
sun.position.set(-7, 12, 8);
sun.castShadow = true;
sun.shadow.mapSize.set(2048, 2048);
sun.shadow.camera.left = -14;
sun.shadow.camera.right = 14;
sun.shadow.camera.top = 13;
sun.shadow.camera.bottom = -13;
sun.shadow.camera.near = 1;
sun.shadow.camera.far = 36;
sun.shadow.bias = -0.00025;
scene.add(sun);
const fill = new THREE.DirectionalLight(0x9bcad1, 0.65);
fill.position.set(9, 6, -7);
scene.add(fill);
// ---------------------------------------------------------------------
// Palette and reusable geometry helpers
// ---------------------------------------------------------------------
const M = {
ink: new THREE.MeshStandardMaterial({ color: 0x17343a, roughness: 0.78 }),
teal: new THREE.MeshStandardMaterial({ color: 0x267c78, roughness: 0.72 }),
tealDark: new THREE.MeshStandardMaterial({ color: 0x195957, roughness: 0.8 }),
coral: new THREE.MeshStandardMaterial({ color: 0xe66f55, roughness: 0.76 }),
coralDark: new THREE.MeshStandardMaterial({ color: 0xb94f3f, roughness: 0.82 }),
gold: new THREE.MeshStandardMaterial({ color: 0xf2bf49, roughness: 0.66 }),
cream: new THREE.MeshStandardMaterial({ color: 0xfff8e8, roughness: 0.84 }),
paper: new THREE.MeshStandardMaterial({ color: 0xfbf4df, roughness: 0.9 }),
wood: new THREE.MeshStandardMaterial({ color: 0xb67a45, roughness: 0.86 }),
woodDark: new THREE.MeshStandardMaterial({ color: 0x744b31, roughness: 0.88 }),
grass: new THREE.MeshStandardMaterial({ color: 0x91b886, roughness: 0.96 }),
grassDark: new THREE.MeshStandardMaterial({ color: 0x6f9d72, roughness: 0.96 }),
pavement: new THREE.MeshStandardMaterial({ color: 0xd9d8c7, roughness: 0.94 }),
road: new THREE.MeshStandardMaterial({ color: 0x607072, roughness: 0.94 }),
glass: new THREE.MeshStandardMaterial({
color: 0x31565a,
roughness: 0.3,
metalness: 0.05
}),
white: new THREE.MeshStandardMaterial({ color: 0xfffdf6, roughness: 0.86 })
};
function box(parent, w, h, d, x, y, z, material) {
const mesh = new THREE.Mesh(new THREE.BoxGeometry(w, h, d), material);
mesh.position.set(x, y, z);
mesh.castShadow = true;
mesh.receiveShadow = true;
parent.add(mesh);
return mesh;
}
function cylinder(parent, rt, rb, h, x, y, z, material, segments = 12) {
const mesh = new THREE.Mesh(new THREE.CylinderGeometry(rt, rb, h, segments), material);
mesh.position.set(x, y, z);
mesh.castShadow = true;
mesh.receiveShadow = true;
parent.add(mesh);
return mesh;
}
function sphere(parent, radius, x, y, z, material, detail = 1) {
const geometry = detail
? new THREE.SphereGeometry(radius, 16, 12)
: new THREE.IcosahedronGeometry(radius, 1);
const mesh = new THREE.Mesh(geometry, material);
mesh.position.set(x, y, z);
mesh.castShadow = true;
mesh.receiveShadow = true;
parent.add(mesh);
return mesh;
}
function limb(parent, a, b, radius, material) {
const start = new THREE.Vector3(...a);
const end = new THREE.Vector3(...b);
const direction = end.clone().sub(start);
const mesh = new THREE.Mesh(
new THREE.CylinderGeometry(radius, radius * 0.94, direction.length(), 10),
material
);
mesh.position.copy(start).add(end).multiplyScalar(0.5);
mesh.quaternion.setFromUnitVectors(
new THREE.Vector3(0, 1, 0),
direction.normalize()
);
mesh.castShadow = true;
mesh.receiveShadow = true;
parent.add(mesh);
return mesh;
}
function roundedPath(ctx, x, y, w, h, r) {
ctx.beginPath();
ctx.moveTo(x + r, y);
ctx.arcTo(x + w, y, x + w, y + h, r);
ctx.arcTo(x + w, y + h, x, y + h, r);
ctx.arcTo(x, y + h, x, y, r);
ctx.arcTo(x, y, x + w, y, r);
ctx.closePath();
}
function canvasTexture(width, height, draw) {
const canvas = document.createElement("canvas");
canvas.width = width;
canvas.height = height;
const ctx = canvas.getContext("2d");
draw(ctx, width, height);
const texture = new THREE.CanvasTexture(canvas);
texture.colorSpace = THREE.SRGBColorSpace;
texture.anisotropy = Math.min(8, renderer.capabilities.getMaxAnisotropy());
return texture;
}
function label(parent, texture, w, h, x, y, z, options = {}) {
const material = new THREE.MeshBasicMaterial({
map: texture,
transparent: options.transparent ?? false,
side: options.side ?? THREE.FrontSide,
depthWrite: options.depthWrite ?? true,
toneMapped: false
});
const mesh = new THREE.Mesh(new THREE.PlaneGeometry(w, h), material);
mesh.position.set(x, y, z);
if (options.rotation) mesh.rotation.set(...options.rotation);
if (options.renderOrder !== undefined) mesh.renderOrder = options.renderOrder;
parent.add(mesh);
return mesh;
}
function wrapText(ctx, text, x, y, maxWidth, lineHeight) {
const words = text.split(" ");
let line = "";
let lineY = y;
for (const word of words) {
const test = line ? line + " " + word : word;
if (ctx.measureText(test).width > maxWidth && line) {
ctx.fillText(line, x, lineY);
line = word;
lineY += lineHeight;
} else {
line = test;
}
}
if (line) ctx.fillText(line, x, lineY);
return lineY;
}
// ---------------------------------------------------------------------
// Printed materials
// ---------------------------------------------------------------------
const kioskHeadlineTexture = canvasTexture(1000, 700, (ctx, w, h) => {
ctx.fillStyle = "#fffaf0";
ctx.fillRect(0, 0, w, h);
ctx.strokeStyle = "#17343a";
ctx.lineWidth = 18;
ctx.strokeRect(18, 18, w - 36, h - 36);
ctx.fillStyle = "#e66f55";
ctx.fillRect(48, 48, 210, 58);
ctx.fillStyle = "#fffaf0";
ctx.font = "800 27px Arial, sans-serif";
ctx.textAlign = "center";
ctx.fillText("MAY 02 EDITION", 153, 87);
ctx.fillStyle = "#17343a";
ctx.textAlign = "left";
ctx.font = "900 70px Georgia, serif";
ctx.fillText("SATURDAY", 55, 205);
ctx.fillText("MARKET", 55, 278);
ctx.fillStyle = "#267c78";
ctx.fillText("RETURNS MAY 8", 55, 370);
ctx.fillStyle = "#17343a";
ctx.font = "700 28px Arial, sans-serif";
ctx.fillText("Food stalls · music · neighbors", 58, 430);
ctx.strokeStyle = "#b9b3a2";
ctx.lineWidth = 3;
for (let row = 0; row < 4; row++) {
for (let col = 0; col < 2; col++) {
ctx.beginPath();
ctx.moveTo(58 + col * 455, 485 + row * 32);
ctx.lineTo(58 + col * 455 + 405, 485 + row * 32);
ctx.stroke();
}
}
ctx.fillStyle = "#f2bf49";
ctx.beginPath();
ctx.arc(865, 610, 55, 0, Math.PI * 2);
ctx.fill();
ctx.fillStyle = "#17343a";
ctx.textAlign = "center";
ctx.font = "900 28px Arial, sans-serif";
ctx.fillText("PRINTED", 865, 603);
ctx.font = "800 19px Arial, sans-serif";
ctx.fillText("HEADLINE", 865, 629);
});
const noticeTexture = canvasTexture(1000, 760, (ctx, w, h) => {
ctx.fillStyle = "#f6edcf";
roundedPath(ctx, 25, 25, w - 50, h - 50, 10);
ctx.fill();
ctx.strokeStyle = "#17343a";
ctx.lineWidth = 12;
ctx.stroke();
ctx.fillStyle = "#267c78";
ctx.fillRect(58, 62, w - 116, 88);
ctx.fillStyle = "#fffaf0";
ctx.textAlign = "center";
ctx.font = "800 42px Arial, sans-serif";
ctx.fillText("PUBLIC ANNOUNCEMENT", w / 2, 121);
ctx.fillStyle = "#17343a";
ctx.font = "900 67px Georgia, serif";
ctx.fillText("MARKET CONTINUES", w / 2, 250);
ctx.font = "900 55px Georgia, serif";
ctx.fillStyle = "#e66f55";
ctx.fillText("SATURDAY · MAY 08", w / 2, 322);
ctx.strokeStyle = "#b8aa84";
ctx.lineWidth = 4;
ctx.beginPath();
ctx.moveTo(130, 365);
ctx.lineTo(w - 130, 365);
ctx.stroke();
ctx.fillStyle = "#17343a";
ctx.font = "700 34px Arial, sans-serif";
ctx.fillText("Gates open 9 AM — 2 PM", w / 2, 430);
ctx.font = "500 27px Arial, sans-serif";
ctx.fillText("Fresh produce, local food, music and sidewalk games.", w / 2, 483);
ctx.fillText("Bring a reusable cup and a neighbor.", w / 2, 526);
ctx.fillStyle = "#f2bf49";
ctx.beginPath();
ctx.arc(830, 625, 72, 0, Math.PI * 2);
ctx.fill();
ctx.strokeStyle = "#17343a";
ctx.lineWidth = 5;
ctx.stroke();
ctx.fillStyle = "#17343a";
ctx.textAlign = "center";
ctx.font = "900 25px Arial, sans-serif";
ctx.fillText("DATED", 830, 615);
ctx.font = "900 29px Arial, sans-serif";
ctx.fillText("MAY 08", 830, 649);
});
const newspaperTexture = canvasTexture(800, 1050, (ctx, w, h) => {
ctx.fillStyle = "#fffdf4";
ctx.fillRect(0, 0, w, h);
ctx.fillStyle = "#17343a";
ctx.textAlign = "center";
ctx.font = "900 78px Georgia, serif";
ctx.fillText("THE BEACON", w / 2, 105);
ctx.font = "700 24px Arial, sans-serif";
ctx.fillText("NEIGHBORHOOD EDITION • MAY 02", w / 2, 150);
ctx.strokeStyle = "#17343a";
ctx.lineWidth = 7;
ctx.beginPath();
ctx.moveTo(35, 178);
ctx.lineTo(w - 35, 178);
ctx.stroke();
ctx.fillStyle = "#e66f55";
ctx.font = "900 70px Georgia, serif";
ctx.fillText("SATURDAY MARKET", w / 2, 270);
ctx.fillStyle = "#267c78";
ctx.font = "900 66px Georgia, serif";
ctx.fillText("RETURNS MAY 8", w / 2, 345);
ctx.fillStyle = "#17343a";
ctx.font = "700 25px Arial, sans-serif";
ctx.fillText("A headline worth checking", w / 2, 405);
ctx.fillStyle = "#6c756f";
for (let col = 0; col < 3; col++) {
for (let row = 0; row < 24; row++) {
const x = 48 + col * 242;
const y = 475 + row * 21;
const lineWidth = 175 + ((row * 17 + col * 29) % 48);
ctx.fillRect(x, y, lineWidth, 7);
}
}
ctx.fillStyle = "#f2bf49";
ctx.fillRect(55, 980, 690, 40);
ctx.fillStyle = "#17343a";
ctx.textAlign = "left";
ctx.font = "800 24px Arial, sans-serif";
ctx.fillText("PRINTED • MAY 02", 75, 1008);
});
const mastheadTexture = canvasTexture(900, 260, (ctx, w, h) => {
ctx.fillStyle = "#e66f55";
roundedPath(ctx, 8, 8, w - 16, h - 16, 22);
ctx.fill();
ctx.strokeStyle = "#fff8e8";
ctx.lineWidth = 9;
ctx.stroke();
ctx.fillStyle = "#fff8e8";
ctx.textAlign = "center";
ctx.font = "900 95px Georgia, serif";
ctx.fillText("THE BEACON", w / 2, 133);
ctx.font = "800 30px Arial, sans-serif";
ctx.fillText("NEIGHBORHOOD NEWS", w / 2, 195);
});
const boardFasciaTexture = canvasTexture(1000, 180, (ctx, w, h) => {
ctx.fillStyle = "#267c78";
ctx.fillRect(0, 0, w, h);
ctx.fillStyle = "#fff8e8";
ctx.textAlign = "center";
ctx.font = "900 56px Arial, sans-serif";
ctx.fillText("NEIGHBORHOOD NOTICEBOARD", w / 2, 108);
});
function timelineTexture(day, title, detail, accent, index) {
return canvasTexture(1100, 540, (ctx, w, h) => {
ctx.fillStyle = "#fffaf0";
roundedPath(ctx, 12, 12, w - 24, h - 24, 28);
ctx.fill();
ctx.strokeStyle = "#17343a";
ctx.lineWidth = 12;
ctx.stroke();
ctx.fillStyle = accent;
ctx.beginPath();
ctx.arc(150, h / 2, 105, 0, Math.PI * 2);
ctx.fill();
ctx.strokeStyle = "#17343a";
ctx.lineWidth = 8;
ctx.stroke();
ctx.fillStyle = "#17343a";
ctx.textAlign = "center";
ctx.font = "900 39px Arial, sans-serif";
ctx.fillText("MAY", 150, h / 2 - 12);
ctx.font = "900 73px Georgia, serif";
ctx.fillText(day, 150, h / 2 + 57);
ctx.textAlign = "left";
ctx.fillStyle = "#e66f55";
ctx.font = "800 23px Arial, sans-serif";
ctx.fillText(`SEQUENCE 0${index}`, 305, 80);
ctx.fillStyle = "#17343a";
ctx.font = "900 45px Arial, sans-serif";
ctx.fillText(title, 305, 153);
ctx.fillStyle = "#526761";
ctx.font = "600 29px Arial, sans-serif";
wrapText(ctx, detail, 305, 215, 700, 43);
ctx.fillStyle = "#e66f55";
ctx.fillRect(305, 407, 115, 7);
ctx.fillStyle = "#f2bf49";
ctx.fillRect(432, 407, 75, 7);
ctx.fillStyle = "#267c78";
ctx.fillRect(519, 407, 185, 7);
});
}
const timelineCards = [
{
x: -3.55,
texture: timelineTexture("02", "PRINTED HEADLINE", "“Saturday market returns May 8” appears in the morning edition.", "#f2bf49", 1)
},
{
x: 0,
texture: timelineTexture("08", "PUBLIC NOTICE", "The dated market announcement confirms the event and adds opening details.", "#e66f55", 2)
},
{
x: 3.55,
texture: timelineTexture("15", "NEXT CHECK-IN", "Neighbors meet to review the market and plan what comes next.", "#65a6a0", 3)
}
];
function bubbleTexture(text) {
return canvasTexture(700, 280, (ctx, w, h) => {
ctx.clearRect(0, 0, w, h);
ctx.fillStyle = "#fffaf0";
roundedPath(ctx, 18, 18, w - 36, 190, 42);
ctx.fill();
ctx.strokeStyle = "#17343a";
ctx.lineWidth = 10;
ctx.stroke();
ctx.beginPath();
ctx.moveTo(190, 194);
ctx.lineTo(130, 264);
ctx.lineTo(278, 202);
ctx.closePath();
ctx.fill();
ctx.strokeStyle = "#17343a";
ctx.lineWidth = 10;
ctx.stroke();
ctx.fillStyle = "#17343a";
ctx.textAlign = "center";
ctx.font = "900 66px Georgia, serif";
ctx.fillText(text, w / 2, 138);
});
}
// ---------------------------------------------------------------------
// Ground, pavement and neighborhood backdrop
// ---------------------------------------------------------------------
const world = new THREE.Group();
scene.add(world);
box(world, 17.5, 0.42, 12.5, 0, -0.22, -1, M.grass);
const sidewalk = new THREE.Group();
world.add(sidewalk);
box(sidewalk, 15.7, 0.12, 8.6, 0, 0.02, -0.15, M.pavement);
const seamMaterial = new THREE.MeshStandardMaterial({ color: 0xb8b8a9, roughness: 1 });
for (let x = -7; x <= 7; x += 1.55) {
box(sidewalk, 0.025, 0.008, 8.2, x, 0.087, -0.1, seamMaterial);
}
for (let z = -4; z <= 3.5; z += 1.35) {
box(sidewalk, 15.2, 0.008, 0.025, 0, 0.087, z, seamMaterial);
}
box(world, 17.5, 0.06, 2.15, 0, 0.03, -5.05, M.road);
for (let x = -7.5; x <= 7.5; x += 1.55) {
box(world, 0.82, 0.025, 0.07, x, 0.075, -5.05, M.cream);
}
box(world, 2.4, 0.1, 8.2, -6.8, 0.04, -0.35, M.grassDark);
box(world, 2.15, 0.1, 5.1, 6.75, 0.04, -0.4, M.grassDark);
function makeHouse(x, z, w, h, d, bodyColor, roofColor) {
const group = new THREE.Group();
group.position.set(x, 0, z);
world.add(group);
const bodyMat = new THREE.MeshStandardMaterial({ color: bodyColor, roughness: 0.9 });
const roofMat = new THREE.MeshStandardMaterial({ color: roofColor, roughness: 0.88 });
box(group, w, h, d, 0, h / 2, 0, bodyMat);
const roof = new THREE.Mesh(new THREE.ConeGeometry(1, 1.25, 4), roofMat);
roof.position.y = h + 0.55;
roof.rotation.y = Math.PI / 4;
roof.scale.set(w * 0.72, 1, d * 0.72);
roof.castShadow = true;
group.add(roof);
const windowMat = new THREE.MeshStandardMaterial({ color: 0xa9d2d0, roughness: 0.38 });
const trimMat = new THREE.MeshStandardMaterial({ color: 0xfff8e8, roughness: 0.85 });
for (const wx of [-w * 0.25, w * 0.25]) {
box(group, 0.62, 0.72, 0.05, wx, h * 0.58, d / 2 + 0.03, trimMat);
box(group, 0.48, 0.57, 0.065, wx, h * 0.58, d / 2 + 0.07, windowMat);
}
box(group, 0.75, 1.45, 0.06, 0, 0.73, d / 2 + 0.04, M.tealDark);
box(group, 0.9, 0.12, 0.42, 0, 1.52, d / 2 + 0.17, M.cream);
}
makeHouse(-4.6, -7.2, 3.1, 2.55, 1.7, 0xe9b88f, 0x4d7775);
makeHouse(0.3, -7.45, 3.6, 2.8, 1.8, 0xb8c6a4, 0xb45f4c);
makeHouse(5.15, -7.15, 3.25, 2.45, 1.7, 0xc1b4c8, 0x476b73);
function makeTree(x, z, scale = 1) {
const tree = new THREE.Group();
tree.position.set(x, 0, z);
tree.scale.setScalar(scale);
world.add(tree);
cylinder(tree, 0.14, 0.19, 1.9, 0, 0.95, 0, M.woodDark, 9);
const leafA = new THREE.MeshStandardMaterial({ color: 0x67966b, roughness: 0.95 });
const leafB = new THREE.MeshStandardMaterial({ color: 0x82ad75, roughness: 0.95 });
const leafC = new THREE.MeshStandardMaterial({ color: 0x557f62, roughness: 0.95 });
sphere(tree, 0.82, 0, 2.25, 0, leafA, false);
sphere(tree, 0.67, -0.58, 2.05, 0.12, leafB, false);
sphere(tree, 0.62, 0.6, 2.12, -0.08, leafC, false);
sphere(tree, 0.55, 0.05, 2.8, 0.08, leafB, false);
}
makeTree(-7.15, -2.85, 1.08);
makeTree(7.05, -3.35, 1.0);
makeTree(6.95, 1.35, 0.72);
function makeLamp(x, z) {
const lamp = new THREE.Group();
lamp.position.set(x, 0, z);
world.add(lamp);
cylinder(lamp, 0.065, 0.085, 3.2, 0, 1.6, 0, M.ink, 10);
box(lamp, 0.66, 0.11, 0.36, 0.28, 3.15, 0, M.ink);
box(lamp, 0.47, 0.16, 0.27, 0.28, 3.05, 0, M.gold);
}
makeLamp(-6.45, -3.5);
makeLamp(5.8, -3.6);
// ---------------------------------------------------------------------
// News kiosk
// ---------------------------------------------------------------------
const kiosk = new THREE.Group();
kiosk.position.set(-4.7, 0, -0.7);
kiosk.rotation.y = 0.12;
world.add(kiosk);
box(kiosk, 2.45, 0.18, 1.82, 0, 0.11, 0, M.ink);
box(kiosk, 2.1, 2.15, 1.5, 0, 1.25, 0, M.teal);
box(kiosk, 1.56, 1.02, 0.07, 0, 1.5, 0.77, M.glass);
box(kiosk, 1.72, 1.16, 0.08, 0, 1.5, 0.72, M.cream);
label(kiosk, kioskHeadlineTexture, 1.46, 0.92, 0, 1.5, 0.78);
box(kiosk, 2.35, 0.15, 0.75, 0, 0.94, 0.82, M.coral);
box(kiosk, 2.46, 0.18, 1.87, 0, 2.42, 0.05, M.coral);
box(kiosk, 2.3, 0.13, 0.75, 0, 2.31, 1.0, M.gold);
cylinder(kiosk, 0.055, 0.055, 0.65, -0.7, 2.78, 0.1, M.ink, 8);
cylinder(kiosk, 0.055, 0.055, 0.65, 0.7, 2.78, 0.1, M.ink, 8);
label(kiosk, mastheadTexture, 2.28, 0.65, 0, 3.1, 0.1);
const littlePaperTexture = canvasTexture(480, 650, (ctx, w, h) => {
ctx.fillStyle = "#fffdf4";
ctx.fillRect(0, 0, w, h);
ctx.fillStyle = "#17343a";
ctx.textAlign = "center";
ctx.font = "900 50px Georgia, serif";
ctx.fillText("LOCAL", w / 2, 90);
ctx.font = "900 42px Georgia, serif";
ctx.fillText("LIFE", w / 2, 140);
ctx.fillStyle = "#e66f55";
ctx.fillRect(60, 180, w - 120, 35);
ctx.fillStyle = "#8a948d";
for (let i = 0; i < 14; i++) ctx.fillRect(45, 270 + i * 23, w - 90 - (i % 3) * 30, 7);
});
label(kiosk, littlePaperTexture, 0.43, 0.58, -0.57, 1.48, 0.84, {
rotation: [0, 0, -0.08]
});
label(kiosk, littlePaperTexture, 0.43, 0.58, 0.58, 1.48, 0.84, {
rotation: [0, 0, 0.08]
});
for (const x of [-0.78, 0.78]) {
const wheel = cylinder(kiosk, 0.2, 0.2, 0.13, x, 0.14, -0.63, M.ink, 16);
wheel.rotation.z = Math.PI / 2;
}
// ---------------------------------------------------------------------
// Public noticeboard
// ---------------------------------------------------------------------
const board = new THREE.Group();
board.position.set(4.05, 0, -1.45);
board.rotation.y = -0.08;
world.add(board);
cylinder(board, 0.09, 0.11, 2.0, -1.05, 1.0, 0, M.ink, 10);
cylinder(board, 0.09, 0.11, 2.0, 1.05, 1.0, 0, M.ink, 10);
box(board, 2.75, 1.9, 0.22, 0, 2.05, 0, M.woodDark);
box(board, 2.52, 1.67, 0.08, 0, 2.05, 0.15, M.wood);
label(board, noticeTexture, 2.27, 1.48, 0, 2.05, 0.21);
box(board, 3.02, 0.17, 0.88, 0, 3.12, 0.12, M.tealDark);
label(board, boardFasciaTexture, 2.77, 0.36, 0, 3.15, 0.58);
for (const x of [-1.08, 1.08]) {
box(board, 0.11, 2.65, 0.11, x, 1.48, 0.31, M.tealDark);
const cap = sphere(board, 0.09, x, 2.83, 0.31, M.gold);
cap.castShadow = false;
}
// ---------------------------------------------------------------------
// Benches
// ---------------------------------------------------------------------
function makeBench(x, z, rotation = 0) {
const bench = new THREE.Group();
bench.position.set(x, 0, z);
bench.rotation.y = rotation;
world.add(bench);
for (let i = 0; i < 4; i++) {
box(bench, 2.15, 0.11, 0.13, 0, 0.67, -0.24 + i * 0.16, M.wood);
}
for (let i = 0; i < 3; i++) {
box(bench, 2.15, 0.12, 0.1, 0, 1.0 + i * 0.17, -0.36, M.wood);
}
for (const lx of [-0.82, 0.82]) {
box(bench, 0.1, 0.67, 0.68, lx, 0.34, -0.02, M.ink);
box(bench, 0.1, 0.8, 0.1, lx, 0.86, -0.38, M.ink);
box(bench, 0.1, 0.1, 0.7, lx, 1.43, -0.32, M.ink);
}
return bench;
}
const benchA = makeBench(-0.9, -2.75, 0.08);
const benchB = makeBench(3.65, 0.65, -0.46);
// A tote and folded newspaper on the empty bench.
box(benchA, 0.42, 0.38, 0.25, 0.55, 0.91, 0.03, M.coral);
const bagHandle = new THREE.Mesh(
new THREE.TorusGeometry(0.13, 0.025, 8, 20, Math.PI),
M.coralDark
);
bagHandle.position.set(0.55, 1.11, 0.03);
benchA.add(bagHandle);
// ---------------------------------------------------------------------
// Stylized visitors
// ---------------------------------------------------------------------
function makePerson({
x = 0,
z = 0,
rotation = 0,
scale = 1,
skin = 0xc9825f,
shirt = 0xe66f55,
trousers = 0x294f58,
hair = 0x3b2a24,
pose = "stand",
paper = false
} = {}) {
const group = new THREE.Group();
group.position.set(x, 0, z);
group.rotation.y = rotation;
group.scale.setScalar(scale);
const skinMat = new THREE.MeshStandardMaterial({ color: skin, roughness: 0.86 });
const shirtMat = new THREE.MeshStandardMaterial({ color: shirt, roughness: 0.82 });
const pantsMat = new THREE.MeshStandardMaterial({ color: trousers, roughness: 0.88 });
const hairMat = new THREE.MeshStandardMaterial({ color: hair, roughness: 0.93 });
const shoeMat = new THREE.MeshStandardMaterial({ color: 0x20383d, roughness: 0.82 });
if (pose === "seated") {
cylinder(group, 0.28, 0.34, 0.69, 0, 1.12, -0.03, shirtMat, 10);
limb(group, [-0.18, 0.82, 0.03], [-0.2, 0.73, 0.53], 0.115, pantsMat);
limb(group, [0.18, 0.82, 0.03], [0.2, 0.73, 0.53], 0.115, pantsMat);
limb(group, [-0.2, 0.73, 0.53], [-0.2, 0.14, 0.58], 0.095, pantsMat);
limb(group, [0.2, 0.73, 0.53], [0.2, 0.14, 0.58], 0.095, pantsMat);
box(group, 0.25, 0.15, 0.42, -0.2, 0.08, 0.67, shoeMat);
box(group, 0.25, 0.15, 0.42, 0.2, 0.08, 0.67, shoeMat);
} else {
cylinder(group, 0.28, 0.35, 0.67, 0, 1.13, 0, shirtMat, 10);
limb(group, [-0.16, 0.82, 0], [-0.18, 0.13, 0.02], 0.115, pantsMat);
limb(group, [0.16, 0.82, 0], [0.18, 0.13, -0.02], 0.115, pantsMat);
box(group, 0.25, 0.15, 0.42, -0.18, 0.08, 0.11, shoeMat);
box(group, 0.25, 0.15, 0.42, 0.18, 0.08, 0.08, shoeMat);
}
cylinder(group, 0.09, 0.1, 0.16, 0, 1.52, 0, skinMat, 10);
sphere(group, 0.22, 0, 1.7, 0, skinMat);
const hairCap = new THREE.Mesh(
new THREE.SphereGeometry(0.228, 16, 10, 0, Math.PI * 2, 0, Math.PI / 2),
hairMat
);
hairCap.position.set(0, 1.71, -0.005);
hairCap.castShadow = true;
group.add(hairCap);
const eyeMat = new THREE.MeshStandardMaterial({ color: 0x233238, roughness: 0.6 });
sphere(group, 0.024, -0.07, 1.72, 0.2, eyeMat);
sphere(group, 0.024, 0.07, 1.72, 0.2, eyeMat);
sphere(group, 0.045, 0, 1.66, 0.222, skinMat);
const mouth = box(group, 0.07, 0.012, 0.015, 0, 1.59, 0.211, M.ink);
mouth.castShadow = false;
const shoulderY = 1.36;
if (paper) {
limb(group, [-0.28, shoulderY, 0], [-0.38, 1.07, 0.17], 0.09, shirtMat);
limb(group, [-0.38, 1.07, 0.17], [-0.24, 1.11, 0.49], 0.07, skinMat);
limb(group, [0.28, shoulderY, 0], [0.38, 1.08, 0.17], 0.09, shirtMat);
limb(group, [0.38, 1.08, 0.17], [0.24, 1.11, 0.49], 0.07, skinMat);
sphere(group, 0.075, -0.24, 1.11, 0.5, skinMat);
sphere(group, 0.075, 0.24, 1.11, 0.5, skinMat);
const printedPaper = label(group, newspaperTexture, 0.82, 0.72, 0, 1.16, 0.53, {
rotation: [-0.08, 0, 0.015],
side: THREE.DoubleSide
});
group.userData.paper = printedPaper;
} else if (pose === "point") {
limb(group, [-0.28, shoulderY, 0], [-0.4, 1.08, 0.13], 0.09, shirtMat);
limb(group, [-0.4, 1.08, 0.13], [-0.3, 0.91, 0.25], 0.07, skinMat);
sphere(group, 0.075, -0.3, 0.9, 0.26, skinMat);
limb(group, [0.28, shoulderY, 0], [0.52, 1.18, 0.25], 0.09, shirtMat);
limb(group, [0.52, 1.18, 0.25], [0.78, 1.34, 0.59], 0.07, skinMat);
sphere(group, 0.082, 0.8, 1.35, 0.61, skinMat);
} else {
limb(group, [-0.28, shoulderY, 0], [-0.42, 1.08, 0.12], 0.09, shirtMat);
limb(group, [-0.42, 1.08, 0.12], [-0.22, 1.22, 0.38], 0.07, skinMat);
limb(group, [0.28, shoulderY, 0], [0.42, 1.08, 0.12], 0.09, shirtMat);
limb(group, [0.42, 1.08, 0.12], [0.22, 1.22, 0.38], 0.07, skinMat);
sphere(group, 0.075, -0.22, 1.23, 0.39, skinMat);
sphere(group, 0.075, 0.22, 1.23, 0.39, skinMat);
}
return group;
}
const reader = makePerson({
x: -2.45,
z: 0.72,
rotation: 0.14,
skin: 0xb96f4c,
shirt: 0xe66f55,
trousers: 0x254d56,
hair: 0x302421,
paper: true
});
world.add(reader);
const companion = makePerson({
x: -1.16,
z: 0.92,
rotation: -1.08,
scale: 0.98,
skin: 0x7f4f39,
shirt: 0xf2bf49,
trousers: 0x405b60,
hair: 0x171d1d
});
world.add(companion);
const pointer = makePerson({
x: 1.35,
z: -0.3,
rotation: 1.56,
skin: 0xe0ad82,
shirt: 0x4e9b96,
trousers: 0x243e49,
hair: 0x8a5b36,
pose: "point"
});
world.add(pointer);
const browser = makePerson({
x: -4.4,
z: 0.86,
rotation: Math.PI - 0.2,
scale: 0.95,
skin: 0xd39a72,
shirt: 0x6d7ca6,
trousers: 0x4d4038,
hair: 0x4e3429
});
world.add(browser);
const seated = makePerson({
x: 0.02,
z: 0.06,
rotation: -0.08,
scale: 0.98,
skin: 0x8d5d42,
shirt: 0xd06f79,
trousers: 0x2f5961,
hair: 0x302421,
pose: "seated"
});
benchB.add(seated);
const child = makePerson({
x: 0.65,
z: 1.75,
rotation: -0.48,
scale: 0.72,
skin: 0xc7805e,
shirt: 0xf2bf49,
trousers: 0x3f6970,
hair: 0x3a261f
});
world.add(child);
const speechBubble = new THREE.Sprite(
new THREE.SpriteMaterial({
map: bubbleTexture("MAY 8?"),
transparent: true,
depthWrite: false,
toneMapped: false
})
);
speechBubble.position.set(-2.2, 2.45, 0.85);
speechBubble.scale.set(1.55, 0.62, 1);
world.add(speechBubble);
// ---------------------------------------------------------------------
// Foreground timeline: three connected, highlighted dates
// ---------------------------------------------------------------------
const timeline = new THREE.Group();
timeline.position.z = 3.0;
world.add(timeline);
const halos = [];
timelineCards.forEach((card) => {
box(timeline, 2.28, 1.16, 0.12, card.x, 0.88, 0, M.ink);
label(timeline, card.texture, 2.18, 1.06, card.x, 0.88, 0.075);
for (const sx of [-0.78, 0.78]) {
box(timeline, 0.08, 0.55, 0.08, card.x + sx, 0.28, -0.02, M.ink);
}
const halo = new THREE.Mesh(
new THREE.TorusGeometry(0.225, 0.026, 8, 36),
new THREE.MeshStandardMaterial({
color: 0xf2bf49,
emissive: 0x8c5d08,
emissiveIntensity: 0.2,
roughness: 0.5
})
);
halo.position.set(card.x - 0.72, 0.88, 0.16);
halo.castShadow = false;
timeline.add(halo);
halos.push(halo);
});
function timelineArrow(x, length) {
const arrow = new THREE.ArrowHelper(
new THREE.Vector3(1, 0, 0),
new THREE.Vector3(x, 0.43, -0.02),
length,
0x267c78,
0.25,
0.2
);
arrow.line.material.transparent = true;
arrow.cone.material.transparent = true;
timeline.add(arrow);
return arrow;
}
timelineArrow(-2.37, 1.16);
timelineArrow(1.17, 1.16);
const sequencePlaqueTexture = canvasTexture(700, 170, (ctx, w, h) => {
ctx.fillStyle = "#17343a";
roundedPath(ctx, 6, 6, w - 12, h - 12, 22);
ctx.fill();
ctx.fillStyle = "#fffaf0";
ctx.textAlign = "center";
ctx.font = "900 45px Arial, sans-serif";
ctx.fillText("HOW THE STORY MOVED", w / 2, 93);
});
label(timeline, sequencePlaqueTexture, 1.65, 0.4, 0, 1.57, -0.05);
// Small planted flower beds to soften the scene corners.
function makePlanter(x, z, color) {
const planter = new THREE.Group();
planter.position.set(x, 0, z);
world.add(planter);
box(planter, 1.1, 0.3, 0.68, 0, 0.15, 0, M.cream);
box(planter, 0.96, 0.08, 0.55, 0, 0.31, 0, M.woodDark);
const flowerMat = new THREE.MeshStandardMaterial({ color, roughness: 0.9 });
for (let i = 0; i < 8; i++) {
const px = -0.38 + (i % 4) * 0.25;
const pz = i < 4 ? -0.12 : 0.13;
cylinder(planter, 0.018, 0.022, 0.28, px, 0.44, pz, M.grassDark, 6);
sphere(planter, 0.075, px, 0.59, pz, flowerMat);
}
}
makePlanter(-6.65, 1.75, 0xe66f55);
makePlanter(6.45, 1.25, 0xf2bf49);
// ---------------------------------------------------------------------
// Direct camera controls
// ---------------------------------------------------------------------
const pointerState = {
active: false,
id: null,
lastX: 0,
lastY: 0
};
renderer.domElement.addEventListener("pointerdown", (event) => {
pointerState.active = true;
pointerState.id = event.pointerId;
pointerState.lastX = event.clientX;
pointerState.lastY = event.clientY;
renderer.domElement.setPointerCapture(event.pointerId);
});
renderer.domElement.addEventListener("pointermove", (event) => {
if (!pointerState.active || event.pointerId !== pointerState.id) return;
const dx = event.clientX - pointerState.lastX;
const dy = event.clientY - pointerState.lastY;
pointerState.lastX = event.clientX;
pointerState.lastY = event.clientY;
if (event.shiftKey) {
const right = new THREE.Vector3(1, 0, 0).applyQuaternion(camera.quaternion);
const forward = new THREE.Vector3();
camera.getWorldDirection(forward);
forward.y = 0;
forward.normalize();
goalView.target.addScaledVector(right, -dx * goalView.radius * 0.0012);
goalView.target.addScaledVector(forward, -dy * goalView.radius * 0.0012);
goalView.target.x = THREE.MathUtils.clamp(goalView.target.x, -7, 7);
goalView.target.z = THREE.MathUtils.clamp(goalView.target.z, -5, 5);
} else {
goalView.theta -= dx * 0.005;
goalView.phi = THREE.MathUtils.clamp(goalView.phi - dy * 0.004, 0.48, 1.38);
}
});
function endPointer(event) {
if (event.pointerId !== pointerState.id) return;
pointerState.active = false;
pointerState.id = null;
}
renderer.domElement.addEventListener("pointerup", endPointer);
renderer.domElement.addEventListener("pointercancel", endPointer);
renderer.domElement.addEventListener("contextmenu", (event) => event.preventDefault());
renderer.domElement.addEventListener(
"wheel",
(event) => {
event.preventDefault();
goalView.radius = THREE.MathUtils.clamp(
goalView.radius * Math.exp(event.deltaY * 0.001),
6.2,
25
);
},
{ passive: false }
);
const views = {
reset: { target: [0, 1.0, 0], radius: 17.2, theta: 0.58, phi: 1.02 },
kiosk: { target: [-4.45, 1.45, -0.25], radius: 6.6, theta: 0.18, phi: 1.18 },
notice: { target: [3.85, 1.85, -1.25], radius: 7.0, theta: 0.16, phi: 1.16 },
timeline: { target: [0, 0.75, 2.75], radius: 9.8, theta: 0.16, phi: 1.08 }
};
document.querySelectorAll("[data-view]").forEach((button) => {
button.addEventListener("click", () => {
const view = views[button.dataset.view];
goalView.target.set(...view.target);
goalView.radius = view.radius;
goalView.theta = view.theta;
goalView.phi = view.phi;
});
});
function updateCamera(dt) {
const blend = 1 - Math.exp(-8 * dt);
currentView.target.lerp(goalView.target, blend);
currentView.radius = THREE.MathUtils.lerp(currentView.radius, goalView.radius, blend);
currentView.theta = THREE.MathUtils.lerp(currentView.theta, goalView.theta, blend);
currentView.phi = THREE.MathUtils.lerp(currentView.phi, goalView.phi, blend);
const sinPhi = Math.sin(currentView.phi);
camera.position.set(
currentView.target.x + currentView.radius * sinPhi * Math.sin(currentView.theta),
currentView.target.y + currentView.radius * Math.cos(currentView.phi),
currentView.target.z + currentView.radius * sinPhi * Math.cos(currentView.theta)
);
camera.lookAt(currentView.target);
}
window.addEventListener("resize", () => {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
});
// ---------------------------------------------------------------------
// Render loop
// ---------------------------------------------------------------------
const clock = new THREE.Clock();
let firstFrame = true;
renderer.setAnimationLoop(() => {
const dt = Math.min(clock.getDelta(), 0.05);
const time = clock.elapsedTime;
updateCamera(dt);
halos.forEach((halo, index) => {
const pulse = 1 + Math.sin(time * 2.2 + index * 1.35) * 0.055;
halo.scale.setScalar(pulse);
});
if (reader.userData.paper) {
reader.userData.paper.rotation.z = 0.015 + Math.sin(time * 1.25) * 0.012;
}
speechBubble.position.y = 2.45 + Math.sin(time * 1.4) * 0.035;
renderer.render(scene, camera);
if (firstFrame) {
firstFrame = false;
loading.classList.add("hidden");
setTimeout(() => loading.remove(), 500);
}
});
</script>
</body>
</html>
```