Prompt specification
Build or customize the Three.js 3D scene "Neighborhood alteration counter" 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 alteration counter
Category: Architecture & Cities · Style: Procedural Solid / Shader 3D
License: MIT · Reference: https://three3d.app/scene/neighborhood-alteration-counter-x0551
Scene Description Prompt:
Please use Three.js from cdnjs for a stylized scene based on this idea: neighborhood alteration counter. Build a tailor shop with fitting area, tagged garments, sewing station, and collection rack; one customer order remains linked to its garment through each stage. Return one self-contained HTML file.
Working Three.js Starter (neighborhood-alteration-counter-x0551):
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="theme-color" content="#183d3b" />
<title>Neighborhood Alteration Counter</title>
<style>
:root {
--ink: #183d3b;
--ink-soft: #52716d;
--cream: #f7efdf;
--paper: rgba(255, 251, 241, 0.9);
--coral: #e66e5b;
--gold: #e5b85c;
--mint: #78a99a;
--navy: #304b63;
--shadow: 0 18px 50px rgba(20, 45, 42, 0.2);
}
* { box-sizing: border-box; }
html, body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: #d8e2dc;
color: var(--ink);
font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button { font: inherit; }
#scene {
position: fixed;
inset: 0;
width: 100%;
height: 100%;
display: block;
touch-action: none;
outline: none;
}
.vignette {
position: fixed;
inset: 0;
pointer-events: none;
background:
radial-gradient(circle at 50% 43%, transparent 48%, rgba(29, 58, 55, 0.13) 115%),
linear-gradient(180deg, rgba(255,255,255,0.06), transparent 28%);
}
.ui {
position: fixed;
inset: 0;
pointer-events: none;
}
.brand {
position: absolute;
top: 28px;
left: 32px;
width: min(430px, calc(100vw - 390px));
text-shadow: 0 2px 18px rgba(247, 239, 223, 0.8);
}
.brand-mark {
display: inline-flex;
align-items: center;
gap: 9px;
margin-bottom: 10px;
padding: 7px 11px;
border: 1px solid rgba(24, 61, 59, 0.16);
border-radius: 999px;
background: rgba(255, 251, 241, 0.78);
box-shadow: 0 8px 22px rgba(24, 61, 59, 0.08);
backdrop-filter: blur(10px);
font-size: 10px;
font-weight: 800;
letter-spacing: 0.16em;
text-transform: uppercase;
}
.brand-mark::before {
content: "";
width: 8px;
height: 8px;
border-radius: 50%;
background: var(--coral);
box-shadow: 0 0 0 4px rgba(230, 110, 91, 0.14);
}
.brand h1 {
margin: 0;
max-width: 400px;
font-family: Georgia, "Times New Roman", serif;
font-size: clamp(30px, 4.2vw, 60px);
font-weight: 500;
line-height: 0.96;
letter-spacing: -0.045em;
}
.brand h1 em {
color: var(--coral);
font-weight: inherit;
}
.brand p {
margin: 12px 0 0;
color: var(--ink-soft);
font-size: 13px;
font-weight: 650;
}
.order-card {
position: absolute;
top: 24px;
right: 24px;
width: 320px;
padding: 20px;
border: 1px solid rgba(255,255,255,0.74);
border-radius: 22px;
background: var(--paper);
box-shadow: var(--shadow);
backdrop-filter: blur(16px);
pointer-events: auto;
transition: transform 180ms ease;
}
.order-card.pulse { animation: cardPulse 500ms ease; }
@keyframes cardPulse {
0% { transform: translateY(0); }
35% { transform: translateY(-4px); }
100% { transform: translateY(0); }
}
.eyebrow {
display: flex;
align-items: center;
gap: 8px;
color: var(--ink-soft);
font-size: 10px;
font-weight: 850;
letter-spacing: 0.15em;
text-transform: uppercase;
}
.live-dot {
width: 8px;
height: 8px;
border-radius: 50%;
background: var(--coral);
box-shadow: 0 0 0 4px rgba(230, 110, 91, 0.14);
}
.order-card h2 {
margin: 12px 0 7px;
font-family: Georgia, "Times New Roman", serif;
font-size: 25px;
font-weight: 500;
line-height: 1.05;
letter-spacing: -0.025em;
}
.order-id {
color: var(--coral);
font-size: 12px;
font-weight: 850;
letter-spacing: 0.1em;
}
.status-line {
display: flex;
align-items: center;
gap: 8px;
margin-top: 16px;
font-size: 12px;
font-weight: 800;
}
.status-line::before {
content: "";
width: 9px;
height: 9px;
border-radius: 50%;
background: var(--stage-color, var(--coral));
box-shadow: 0 0 0 4px color-mix(in srgb, var(--stage-color, var(--coral)) 18%, transparent);
}
.order-copy {
min-height: 58px;
margin: 9px 0 14px;
color: var(--ink-soft);
font-size: 12.5px;
line-height: 1.55;
}
.progress-track {
height: 5px;
overflow: hidden;
border-radius: 999px;
background: rgba(24, 61, 59, 0.1);
}
.progress-fill {
width: 25%;
height: 100%;
border-radius: inherit;
background: var(--stage-color, var(--coral));
transition: width 450ms cubic-bezier(.2,.75,.2,1), background 250ms ease;
}
.linked-row {
display: flex;
align-items: center;
gap: 10px;
margin: 14px 0;
padding: 10px 11px;
border: 1px solid rgba(24, 61, 59, 0.09);
border-radius: 12px;
background: rgba(255,255,255,0.55);
color: var(--ink-soft);
font-size: 10.5px;
font-weight: 800;
letter-spacing: 0.04em;
text-transform: uppercase;
}
.linked-row svg {
flex: 0 0 auto;
color: var(--coral);
}
.advance {
width: 100%;
border: 0;
border-radius: 12px;
padding: 12px 14px;
background: var(--ink);
color: #fffaf0;
cursor: pointer;
font-size: 12px;
font-weight: 800;
transition: transform 150ms ease, background 150ms ease;
}
.advance:hover {
transform: translateY(-1px);
background: #24514e;
}
.advance:active { transform: translateY(1px); }
.timeline {
position: absolute;
left: 50%;
bottom: 24px;
display: flex;
gap: 5px;
padding: 7px;
border: 1px solid rgba(255,255,255,0.7);
border-radius: 18px;
background: rgba(250, 246, 235, 0.86);
box-shadow: 0 14px 40px rgba(26, 54, 51, 0.18);
backdrop-filter: blur(14px);
transform: translateX(-50%);
pointer-events: auto;
}
.step {
position: relative;
display: flex;
align-items: center;
gap: 10px;
min-width: 150px;
border: 0;
border-radius: 12px;
padding: 10px 12px;
background: transparent;
color: var(--ink-soft);
cursor: pointer;
text-align: left;
transition: background 180ms ease, color 180ms ease, transform 180ms ease;
}
.step:hover {
background: rgba(24, 61, 59, 0.06);
transform: translateY(-1px);
}
.step.active {
background: var(--ink);
color: #fffaf0;
}
.step-index {
display: grid;
flex: 0 0 auto;
width: 28px;
height: 28px;
place-items: center;
border: 1px solid currentColor;
border-radius: 50%;
font-family: Georgia, serif;
font-size: 13px;
}
.step.active .step-index {
color: var(--gold);
}
.step-copy {
display: flex;
flex-direction: column;
gap: 2px;
}
.step-copy strong {
font-size: 11px;
font-weight: 850;
letter-spacing: 0.025em;
}
.step-copy small {
opacity: 0.72;
font-size: 9px;
font-weight: 650;
}
.scene-hint {
position: absolute;
left: 30px;
bottom: 28px;
display: flex;
align-items: center;
gap: 9px;
color: rgba(24, 61, 59, 0.72);
font-size: 10px;
font-weight: 750;
letter-spacing: 0.035em;
}
.scene-hint svg { opacity: 0.8; }
.reset {
position: absolute;
right: 28px;
bottom: 30px;
display: grid;
width: 38px;
height: 38px;
place-items: center;
border: 1px solid rgba(24,61,59,0.14);
border-radius: 50%;
background: rgba(255, 251, 241, 0.78);
color: var(--ink);
box-shadow: 0 8px 20px rgba(24, 61, 59, 0.1);
cursor: pointer;
pointer-events: auto;
backdrop-filter: blur(10px);
}
.reset:hover { background: #fffaf0; }
.toast {
position: absolute;
left: 50%;
bottom: 112px;
padding: 9px 13px;
border-radius: 999px;
background: rgba(24, 61, 59, 0.9);
color: #fffaf0;
box-shadow: 0 10px 30px rgba(24,61,59,0.2);
font-size: 10px;
font-weight: 800;
letter-spacing: 0.04em;
opacity: 0;
transform: translate(-50%, 8px);
transition: opacity 220ms ease, transform 220ms ease;
}
.toast.show {
opacity: 1;
transform: translate(-50%, 0);
}
#loading {
position: fixed;
inset: 0;
z-index: 20;
display: grid;
place-items: center;
background: #e7e1d4;
color: var(--ink);
transition: opacity 500ms ease, visibility 500ms ease;
}
#loading.done {
opacity: 0;
visibility: hidden;
}
.loading-inner {
display: flex;
align-items: center;
gap: 12px;
font-family: Georgia, serif;
font-size: 18px;
}
.loading-inner::before {
content: "";
width: 12px;
height: 12px;
border: 2px solid rgba(24,61,59,.2);
border-top-color: var(--coral);
border-radius: 50%;
animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 1000px) {
.brand { width: calc(100vw - 350px); }
.brand h1 { font-size: 38px; }
.step { min-width: 132px; }
.step-copy small { display: none; }
.scene-hint { display: none; }
}
@media (max-width: 720px) {
.brand {
top: 17px;
left: 18px;
width: calc(100vw - 36px);
}
.brand-mark { padding: 6px 9px; font-size: 8px; }
.brand h1 { max-width: 240px; font-size: 31px; }
.brand p { display: none; }
.order-card {
top: 112px;
right: 14px;
width: 252px;
padding: 15px;
border-radius: 17px;
}
.order-card h2 { margin-top: 8px; font-size: 20px; }
.order-copy { min-height: 42px; margin: 7px 0 10px; font-size: 11px; }
.linked-row { margin: 10px 0; padding: 8px; font-size: 8.5px; }
.advance { padding: 10px; font-size: 11px; }
.timeline {
left: 12px;
right: 12px;
bottom: 12px;
overflow-x: auto;
transform: none;
border-radius: 15px;
}
.step {
flex: 1 0 112px;
min-width: 112px;
padding: 8px;
}
.step-index { width: 25px; height: 25px; }
.step-copy strong { font-size: 9.5px; }
.reset { right: 15px; bottom: 92px; }
.toast { bottom: 94px; white-space: nowrap; }
}
@media (max-height: 680px) and (min-width: 721px) {
.brand p { display: none; }
.order-card { padding: 15px; }
.order-copy { min-height: 38px; }
.linked-row { margin: 9px 0; }
}
</style>
</head>
<body>
<canvas id="scene" aria-label="Interactive 3D neighborhood tailor shop"></canvas>
<div class="vignette"></div>
<main class="ui">
<section class="brand">
<div class="brand-mark">Neighborhood workshop</div>
<h1>Alteration <em>Counter</em></h1>
<p>One order. One garment. Four careful stages.</p>
</section>
<aside class="order-card" id="orderCard" aria-live="polite">
<div class="eyebrow"><span class="live-dot"></span>Live order</div>
<h2>Maya’s linen jacket</h2>
<div class="order-id">ORDER A-104</div>
<div class="status-line" id="status">Fitting & intake</div>
<p class="order-copy" id="orderCopy">
The sleeve is pinned and the customer’s order tag is attached to the jacket.
</p>
<div class="progress-track"><div class="progress-fill" id="progressFill"></div></div>
<div class="linked-row">
<svg width="17" height="17" viewBox="0 0 24 24" fill="none" aria-hidden="true">
<path d="M9.5 14.5 14.5 9.5M7.2 16.8l-1.1 1.1a3.5 3.5 0 0 1-5-5l4-4a3.5 3.5 0 0 1 5 0M16.8 7.2l1.1-1.1a3.5 3.5 0 0 1 5 5l-4 4a3.5 3.5 0 0 1-5 0" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
</svg>
A-104 stays linked to this garment
</div>
<button class="advance" id="advance">Advance order →</button>
</aside>
<nav class="timeline" aria-label="Order stages">
<button class="step active" data-stage="0" aria-pressed="true">
<span class="step-index">1</span>
<span class="step-copy"><strong>Fit & intake</strong><small>Measurements & pins</small></span>
</button>
<button class="step" data-stage="1" aria-pressed="false">
<span class="step-index">2</span>
<span class="step-copy"><strong>Tag & queue</strong><small>Rack by order</small></span>
</button>
<button class="step" data-stage="2" aria-pressed="false">
<span class="step-index">3</span>
<span class="step-copy"><strong>At the machine</strong><small>Hem & sleeve</small></span>
</button>
<button class="step" data-stage="3" aria-pressed="false">
<span class="step-index">4</span>
<span class="step-copy"><strong>Ready for pickup</strong><small>Collection rack</small></span>
</button>
</nav>
<div class="scene-hint">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" aria-hidden="true">
<path d="M8 11V7a2 2 0 0 1 4 0v3-5a2 2 0 0 1 4 0v5-2a2 2 0 0 1 4 0v6c0 4-3 7-7 7h-1c-3 0-5-1-7-4l-2-3a2 2 0 0 1 3-2l2 2v-3Z" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
Drag to orbit · Scroll to zoom · Select a station
</div>
<button class="reset" id="reset" title="Reset camera" aria-label="Reset camera">
<svg width="17" height="17" viewBox="0 0 24 24" fill="none" aria-hidden="true">
<path d="M4 4v6h6M20 20v-6h-6M5.5 15a8 8 0 0 0 13.2 2.2L20 14M4 10l1.3-3.2A8 8 0 0 1 18.5 9" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
</button>
<div class="toast" id="toast">A-104 moved with its garment</div>
</main>
<div id="loading"><div class="loading-inner">Opening the workshop</div></div>
<script type="module">
import * as THREE from "https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
const canvas = document.getElementById("scene");
const renderer = new THREE.WebGLRenderer({
canvas,
antialias: true,
alpha: false,
powerPreference: "high-performance"
});
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1.12;
const scene = new THREE.Scene();
scene.background = new THREE.Color(0xd8e2dc);
scene.fog = new THREE.Fog(0xd8e2dc, 18, 31);
const camera = new THREE.PerspectiveCamera(38, window.innerWidth / window.innerHeight, 0.1, 80);
const C = {
ink: 0x183d3b,
ink2: 0x315c58,
cream: 0xf3e8d4,
paper: 0xfff9ec,
coral: 0xe66e5b,
coralLight: 0xf39b83,
gold: 0xe5b85c,
mint: 0x78a99a,
mintLight: 0xa9c6b5,
navy: 0x304b63,
wood: 0x9c6845,
woodLight: 0xc58d62,
darkWood: 0x60402f,
blue: 0xb9d3d4,
tan: 0xc89e7c,
white: 0xfffaf0
};
const mat = (color, roughness = 0.78, metalness = 0) =>
new THREE.MeshStandardMaterial({ color, roughness, metalness });
const M = {
ink: mat(C.ink),
ink2: mat(C.ink2),
cream: mat(C.cream),
paper: mat(C.paper),
coral: mat(C.coral),
coralLight: mat(C.coralLight),
gold: mat(C.gold),
mint: mat(C.mint),
mintLight: mat(C.mintLight),
navy: mat(C.navy),
wood: mat(C.wood),
woodLight: mat(C.woodLight),
darkWood: mat(C.darkWood),
blue: mat(C.blue, 0.3, 0.18),
tan: mat(C.tan),
white: mat(C.white),
black: mat(0x26302f),
mirror: new THREE.MeshStandardMaterial({
color: 0xa9c3c1, roughness: 0.2, metalness: 0.65
})
};
function addMesh(parent, geometry, material, x = 0, y = 0, z = 0) {
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 box(parent, w, h, d, x, y, z, material) {
return addMesh(parent, new THREE.BoxGeometry(w, h, d), material, x, y, z);
}
function cylinder(parent, rt, rb, h, x, y, z, material, segments = 20) {
return addMesh(parent, new THREE.CylinderGeometry(rt, rb, h, segments), material, x, y, z);
}
function sphere(parent, r, x, y, z, material) {
return addMesh(parent, new THREE.SphereGeometry(r, 20, 14), material, x, y, z);
}
function torus(parent, r, tube, x, y, z, material, arc = Math.PI * 2) {
return addMesh(parent, new THREE.TorusGeometry(r, tube, 10, 36, arc), material, x, y, z);
}
function roundedRect(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, painter) {
const c = document.createElement("canvas");
c.width = width;
c.height = height;
painter(c.getContext("2d"), width, height);
const texture = new THREE.CanvasTexture(c);
texture.colorSpace = THREE.SRGBColorSpace;
texture.anisotropy = Math.min(8, renderer.capabilities.getMaxAnisotropy());
return texture;
}
function textPlane(parent, texture, w, h, x, y, z) {
const material = new THREE.MeshBasicMaterial({
map: texture,
transparent: true,
toneMapped: false,
side: THREE.DoubleSide
});
const mesh = addMesh(parent, new THREE.PlaneGeometry(w, h), material, x, y, z);
mesh.castShadow = false;
mesh.receiveShadow = false;
return mesh;
}
// Lighting
scene.add(new THREE.HemisphereLight(0xfff4dc, 0x526c67, 2.15));
const key = new THREE.DirectionalLight(0xffead0, 3.15);
key.position.set(-4, 10, 7);
key.castShadow = true;
key.shadow.mapSize.set(2048, 2048);
key.shadow.camera.left = -9;
key.shadow.camera.right = 9;
key.shadow.camera.top = 8;
key.shadow.camera.bottom = -6;
key.shadow.camera.near = 1;
key.shadow.camera.far = 28;
key.shadow.bias = -0.00025;
scene.add(key);
const fill = new THREE.DirectionalLight(0xcbe5e4, 1.1);
fill.position.set(7, 5, 1);
scene.add(fill);
// Diorama base and room
box(scene, 12.8, 0.36, 7.7, 0, -0.28, 0.25, M.ink);
box(scene, 12.42, 0.14, 7.28, 0, -0.02, 0.25, M.woodLight);
const plankMaterials = [mat(0xc58d62), mat(0xbd8159), mat(0xca9569), mat(0xb97c55)];
for (let i = 0; i < 8; i++) {
const x = -5.28 + i * 1.51;
box(scene, 1.47, 0.035, 6.93, x, 0.066, 0.25, plankMaterials[i % plankMaterials.length]);
}
box(scene, 12.42, 4.62, 0.22, 0, 2.25, -3.18, M.cream);
box(scene, 12.42, 0.77, 0.08, 0, 0.43, -3.035, M.ink2);
box(scene, 0.18, 4.62, 3.85, -6.12, 2.25, -1.36, M.cream);
box(scene, 0.08, 0.77, 3.86, -6.01, 0.43, -1.35, M.ink2);
box(scene, 12.4, 0.12, 0.1, 0, 0.9, -3.0, M.gold);
box(scene, 12.42, 0.14, 0.3, 0, 4.51, -3.18, M.ink);
// Warm central rug
box(scene, 4.6, 0.035, 2.2, -0.3, 0.11, 0.55, mat(0xb8c6b5));
box(scene, 4.36, 0.014, 1.96, -0.3, 0.135, 0.55, mat(0xd4c8aa));
box(scene, 3.85, 0.012, 0.09, -0.3, 0.148, 0.32, M.coral);
box(scene, 3.85, 0.012, 0.09, -0.3, 0.148, 0.78, M.coral);
// Wall sign
const signTexture = canvasTexture(1024, 256, (ctx, w, h) => {
ctx.clearRect(0, 0, w, h);
roundedRect(ctx, 10, 18, w - 20, h - 36, 30);
ctx.fillStyle = "#183d3b";
ctx.fill();
ctx.textAlign = "center";
ctx.fillStyle = "#fff8e9";
ctx.font = "700 72px Georgia";
ctx.fillText("NEIGHBORHOOD", w / 2, 112);
ctx.fillStyle = "#e5b85c";
ctx.font = "800 31px Arial";
ctx.letterSpacing = "5px";
ctx.fillText("ALTERATION COUNTER", w / 2, 177);
});
textPlane(scene, signTexture, 4.55, 1.14, -0.25, 3.72, -3.02);
// Window
const windowGroup = new THREE.Group();
windowGroup.position.set(4.52, 3.75, -3.0);
scene.add(windowGroup);
box(windowGroup, 1.66, 1.03, 0.08, 0, 0, 0, M.blue);
box(windowGroup, 1.8, 0.1, 0.16, 0, 0.55, 0.02, M.ink);
box(windowGroup, 1.8, 0.1, 0.16, 0, -0.55, 0.02, M.ink);
box(windowGroup, 0.1, 1.16, 0.16, -0.85, 0, 0.02, M.ink);
box(windowGroup, 0.1, 1.16, 0.16, 0.85, 0, 0.02, M.ink);
box(windowGroup, 0.07, 1.02, 0.15, 0, 0, 0.03, M.ink);
// Station rugs
const stationColors = [C.coral, C.gold, C.navy, C.mint];
const stationXs = [-4.28, -1.35, 1.35, 4.18];
const rugs = [];
for (let i = 0; i < 4; i++) {
const material = mat(i === 2 ? 0xaab6b2 : 0xd6c6aa);
const rug = box(scene, 2.45, 0.025, 1.72, stationXs[i], 0.103, -1.55, material);
rug.receiveShadow = true;
rugs.push(rug);
}
// Stage plaques
const plaqueData = [
["FITTING + INTAKE", "Pinned to measure"],
["TAG + QUEUE", "Sorted by order"],
["THE SEWING STATION", "Careful alterations"],
["COLLECTION + PICKUP", "Ready to go home"]
];
const plaques = [];
function paintPlaque(ctx, w, h, data, active) {
ctx.clearRect(0, 0, w, h);
roundedRect(ctx, 5, 5, w - 10, h - 10, 22);
ctx.fillStyle = active ? "#183d3b" : "#fff7e8";
ctx.fill();
ctx.strokeStyle = active ? "#e5b85c" : "rgba(24,61,59,.22)";
ctx.lineWidth = 5;
ctx.stroke();
ctx.fillStyle = active ? "#e5b85c" : "#e66e5b";
ctx.beginPath();
ctx.arc(62, h / 2, 31, 0, Math.PI * 2);
ctx.fill();
ctx.fillStyle = active ? "#183d3b" : "#fffaf0";
ctx.textAlign = "center";
ctx.textBaseline = "middle";
ctx.font = "700 29px Georgia";
ctx.fillText(String(plaques.length + 1), 62, h / 2 + 1);
ctx.textAlign = "left";
ctx.fillStyle = active ? "#fff8e9" : "#183d3b";
ctx.font = "800 25px Arial";
ctx.fillText(data[0], 112, 69);
ctx.fillStyle = active ? "rgba(255,248,233,.7)" : "#52716d";
ctx.font = "600 19px Arial";
ctx.fillText(data[1], 113, 111);
}
for (let i = 0; i < 4; i++) {
const texture = canvasTexture(520, 180, (ctx, w, h) => paintPlaque(ctx, w, h, plaqueData[i], i === 0));
const mesh = textPlane(scene, texture, 2.42, 0.83, stationXs[i], 2.64, -3.005);
plaques.push({ texture, data: plaqueData[i] });
}
// Fitting area
const fitting = new THREE.Group();
scene.add(fitting);
// Mirror
box(fitting, 1.54, 2.04, 0.12, -4.28, 1.72, -2.97, M.darkWood);
box(fitting, 1.29, 1.78, 0.07, -4.28, 1.72, -2.89, M.mirror);
box(fitting, 0.055, 1.79, 0.035, -4.28, 1.72, -2.84, M.cream);
// Curtain rail and curtain panels
const rail = cylinder(fitting, 0.035, 0.035, 3.25, -4.28, 2.91, -2.7, M.ink);
rail.rotation.z = Math.PI / 2;
for (const side of [-1, 1]) {
for (let i = 0; i < 4; i++) {
const x = -4.28 + side * (1.2 + i * 0.11);
const curtain = addMesh(
fitting,
new THREE.CapsuleGeometry(0.11, 1.54, 4, 10),
side < 0 ? M.mint : M.coral,
x,
2.0,
-2.64 + (i % 2) * 0.035
);
curtain.scale.x = 0.85;
}
}
// Fitting bench
box(fitting, 2.15, 0.22, 0.62, -4.45, 0.52, -2.38, M.wood);
box(fitting, 1.98, 0.12, 0.52, -4.45, 0.69, -2.38, M.coral);
box(fitting, 0.14, 0.42, 0.45, -5.26, 0.29, -2.38, M.ink);
box(fitting, 0.14, 0.42, 0.45, -3.65, 0.29, -2.38, M.ink);
// Dress form
const form = new THREE.Group();
form.position.set(-4.28, 0, -1.99);
fitting.add(form);
cylinder(form, 0.035, 0.035, 1.13, 0, 0.67, 0, M.ink);
cylinder(form, 0.31, 0.31, 0.055, 0, 0.13, 0, M.ink);
const torso = addMesh(form, new THREE.CylinderGeometry(0.27, 0.39, 0.73, 14), M.tan, 0, 1.48, 0);
torso.scale.z = 0.62;
sphere(form, 0.12, 0, 1.9, 0, M.tan);
cylinder(form, 0.09, 0.09, 0.18, 0, 1.78, 0, M.tan);
// Garment rack helper
function createRack(x, width, z, color) {
const group = new THREE.Group();
group.position.set(x, 0, z);
scene.add(group);
for (const side of [-1, 1]) {
cylinder(group, 0.04, 0.04, 2.45, side * width / 2, 1.24, 0, color);
box(group, 0.54, 0.08, 0.12, side * width / 2, 0.13, 0, color);
sphere(group, 0.065, side * width / 2, 0.075, 0, M.black);
}
const bar = cylinder(group, 0.045, 0.045, width, 0, 2.46, 0, color);
bar.rotation.z = Math.PI / 2;
return group;
}
function createHanger(parent, color = M.ink) {
const geometry = new THREE.BufferGeometry().setFromPoints([
new THREE.Vector3(-0.22, 0, 0),
new THREE.Vector3(0, 0.16, 0),
new THREE.Vector3(0.22, 0, 0),
new THREE.Vector3(-0.22, 0, 0)
]);
const line = new THREE.Line(geometry, new THREE.LineBasicMaterial({ color }));
parent.add(line);
return line;
}
function createStaticGarment(parent, x, y, z, color, rotation = 0) {
const group = new THREE.Group();
group.position.set(x, y, z);
group.rotation.y = rotation;
parent.add(group);
createHanger(group, M.ink);
box(group, 0.56, 0.76, 0.16, 0, 0, 0, color);
const leftSleeve = box(group, 0.17, 0.66, 0.17, -0.34, -0.03, 0, color);
const rightSleeve = box(group, 0.17, 0.66, 0.17, 0.34, -0.03, 0, color);
leftSleeve.rotation.z = -0.18;
rightSleeve.rotation.z = 0.18;
box(group, 0.25, 0.09, 0.025, 0, 0.25, 0.092, M.cream);
return group;
}
// Tagged garment rack
const taggedRack = createRack(-1.35, 2.35, -2.66, M.ink);
createStaticGarment(taggedRack, -0.78, 1.87, 0, M.navy, -0.08);
createStaticGarment(taggedRack, -0.26, 1.88, 0.02, M.mintLight, 0.04);
createStaticGarment(taggedRack, 0.28, 1.87, 0, M.gold, -0.04);
createStaticGarment(taggedRack, 0.79, 1.88, 0.02, M.coralLight, 0.08);
// Sewing station
const sewing = new THREE.Group();
scene.add(sewing);
box(sewing, 2.38, 0.16, 1.33, 1.35, 1.08, -2.04, M.woodLight);
for (const x of [0.37, 2.33]) {
for (const z of [-2.55, -1.55]) {
box(sewing, 0.13, 1.0, 0.13, x, 0.51, z, M.ink);
}
}
box(sewing, 2.12, 0.12, 0.11, 1.35, 0.38, -2.03, M.ink);
// Sewing machine
const machine = new THREE.Group();
machine.position.set(1.44, 1.17, -2.18);
sewing.add(machine);
box(machine, 1.02, 0.13, 0.58, 0, 0.06, 0, M.ink);
box(machine, 0.24, 0.66, 0.43, -0.35, 0.41, 0, M.paper);
box(machine, 0.88, 0.29, 0.43, 0.1, 0.68, 0, M.paper);
box(machine, 0.23, 0.53, 0.4, 0.42, 0.38, 0, M.paper);
const wheel = torus(machine, 0.18, 0.045, -0.49, 0.45, 0.01, M.coral);
wheel.rotation.y = Math.PI / 2;
box(machine, 0.25, 0.07, 0.28, 0.43, 0.1, 0.04, M.coral);
const needle = box(machine, 0.025, 0.27, 0.025, 0.43, 0.13, 0.11, M.ink);
cylinder(machine, 0.045, 0.045, 0.2, 0.18, 0.91, 0, M.coral);
cylinder(machine, 0.04, 0.04, 0.2, 0.0, 0.9, 0, M.mint);
box(machine, 0.4, 0.025, 0.28, -0.08, 0.14, 0.02, M.blue);
// Task lamp
const lampBase = cylinder(sewing, 0.2, 0.24, 0.08, 2.27, 1.2, -2.35, M.ink);
const lampArm1 = cylinder(sewing, 0.025, 0.025, 0.65, 2.27, 1.51, -2.35, M.ink);
lampArm1.rotation.z = -0.28;
const lampArm2 = cylinder(sewing, 0.025, 0.025, 0.52, 2.0, 1.78, -2.35, M.ink);
lampArm2.rotation.z = 0.75;
const shade = addMesh(sewing, new THREE.CylinderGeometry(0.12, 0.25, 0.25, 20, 1, true), M.gold, 1.82, 1.91, -2.35);
shade.material.side = THREE.DoubleSide;
// Collection rack
const collection = createRack(4.18, 2.35, -2.66, M.ink);
box(collection, 2.25, 0.12, 0.72, 0, 0.47, 0, M.woodLight);
createStaticGarment(collection, -0.75, 1.88, 0, M.mint, -0.08);
createStaticGarment(collection, -0.15, 1.88, 0.02, M.navy, 0.04);
createStaticGarment(collection, 0.55, 1.88, 0, M.gold, -0.03);
box(collection, 0.67, 0.34, 0.48, 0.65, 0.7, 0.02, M.coral);
box(collection, 0.55, 0.27, 0.41, -0.55, 0.67, 0.02, M.mintLight);
// Reception counter
const counter = new THREE.Group();
counter.position.set(-4.4, 0, 1.12);
scene.add(counter);
box(counter, 2.35, 1.05, 1.05, 0, 0.52, 0, M.ink2);
box(counter, 2.52, 0.15, 1.18, 0, 1.1, 0, M.wood);
box(counter, 2.22, 0.07, 0.08, 0, 0.75, 0.55, M.gold);
const counterSign = canvasTexture(700, 180, (ctx, w, h) => {
ctx.clearRect(0, 0, w, h);
roundedRect(ctx, 12, 12, w - 24, h - 24, 22);
ctx.fillStyle = "#f7efdf";
ctx.fill();
ctx.textAlign = "center";
ctx.fillStyle = "#183d3b";
ctx.font = "800 42px Georgia";
ctx.fillText("ALTERATIONS", w / 2, 75);
ctx.fillStyle = "#e66e5b";
ctx.font = "800 21px Arial";
ctx.fillText("DROP OFF • PICK UP", w / 2, 126);
});
textPlane(counter, counterSign, 1.92, 0.49, 0, 0.52, 0.537);
box(counter, 0.43, 0.28, 0.35, 0.55, 1.31, -0.05, M.navy);
const registerScreen = box(counter, 0.36, 0.24, 0.035, 0.55, 1.55, -0.12, M.blue);
registerScreen.rotation.x = -0.15;
box(counter, 0.44, 0.025, 0.34, -0.55, 1.19, 0.05, M.paper);
// Pendant light
cylinder(scene, 0.018, 0.018, 1.1, -4.4, 4.15, 0.9, M.ink);
const pendant = addMesh(scene, new THREE.CylinderGeometry(0.18, 0.43, 0.42, 24, 1, true), M.coral, -4.4, 3.38, 0.9);
pendant.material.side = THREE.DoubleSide;
const pendantLight = new THREE.PointLight(0xffc77c, 1.3, 4.5, 2);
pendantLight.position.set(-4.4, 3.05, 0.9);
scene.add(pendantLight);
// Plant
const plant = new THREE.Group();
plant.position.set(5.48, 0, 1.45);
scene.add(plant);
const pot = addMesh(plant, new THREE.CylinderGeometry(0.31, 0.24, 0.48, 18), M.coral, 0, 0.26, 0);
cylinder(plant, 0.025, 0.025, 1.05, 0, 0.86, 0, M.ink);
for (let i = 0; i < 7; i++) {
const a = i / 7 * Math.PI * 2;
const leaf = sphere(plant, 0.2, Math.cos(a) * 0.19, 1.15 + (i % 3) * 0.1, Math.sin(a) * 0.19, M.mint);
leaf.scale.set(0.6, 1.35, 0.32);
leaf.rotation.z = Math.cos(a) * 0.5;
leaf.rotation.y = -a;
}
// Tracked customer garment: the exact same object moves through every stage.
const garment = new THREE.Group();
garment.name = "Order A-104 tracked garment";
garment.userData.orderId = "A-104";
scene.add(garment);
const garmentMaterial = mat(C.coral, 0.82);
const garmentDark = mat(0xc95749, 0.86);
const garmentLight = mat(0xf19a83, 0.84);
const jacketShape = new THREE.Shape();
jacketShape.moveTo(-0.37, 0.55);
jacketShape.lineTo(0.37, 0.55);
jacketShape.lineTo(0.48, 0.31);
jacketShape.lineTo(0.35, 0.14);
jacketShape.lineTo(0.35, -0.55);
jacketShape.lineTo(-0.35, -0.55);
jacketShape.lineTo(-0.35, 0.14);
jacketShape.lineTo(-0.48, 0.31);
jacketShape.closePath();
const jacketGeometry = new THREE.ExtrudeGeometry(jacketShape, {
depth: 0.22,
bevelEnabled: true,
bevelSegments: 2,
bevelSize: 0.035,
bevelThickness: 0.035,
curveSegments: 4
});
jacketGeometry.translate(0, 0, -0.11);
addMesh(garment, jacketGeometry, garmentMaterial);
const leftSleeve = addMesh(garment, new THREE.CapsuleGeometry(0.135, 0.5, 4, 10), garmentMaterial, -0.47, -0.05, 0);
const rightSleeve = addMesh(garment, new THREE.CapsuleGeometry(0.135, 0.5, 4, 10), garmentMaterial, 0.47, -0.05, 0);
leftSleeve.rotation.z = -0.22;
rightSleeve.rotation.z = 0.22;
// Lapels
const lapelLeft = new THREE.Shape();
lapelLeft.moveTo(-0.34, 0.53);
lapelLeft.lineTo(-0.03, 0.12);
lapelLeft.lineTo(-0.28, 0.08);
lapelLeft.closePath();
const lapelRight = new THREE.Shape();
lapelRight.moveTo(0.34, 0.53);
lapelRight.lineTo(0.03, 0.12);
lapelRight.lineTo(0.28, 0.08);
lapelRight.closePath();
const lapelLMesh = addMesh(garment, new THREE.ShapeGeometry(lapelLeft), garmentLight, 0, 0, 0.151);
const lapelRMesh = addMesh(garment, new THREE.ShapeGeometry(lapelRight), garmentLight, 0, 0, 0.151);
lapelLMesh.castShadow = false;
lapelRMesh.castShadow = false;
// Center seam, pockets, buttons
box(garment, 0.025, 0.93, 0.025, 0, -0.03, 0.145, garmentDark);
box(garment, 0.22, 0.018, 0.026, -0.2, -0.22, 0.147, garmentDark);
box(garment, 0.22, 0.018, 0.026, 0.2, -0.22, 0.147, garmentDark);
for (let i = 0; i < 3; i++) {
sphere(garment, 0.027, 0.1, 0.22 - i * 0.21, 0.17, M.gold);
}
// Permanent order tag
const tagTexture = canvasTexture(320, 190, (ctx, w, h) => {
roundedRect(ctx, 5, 5, w - 10, h - 10, 18);
ctx.fillStyle = "#fffaf0";
ctx.fill();
ctx.strokeStyle = "#304b63";
ctx.lineWidth = 8;
ctx.stroke();
ctx.fillStyle = "#304b63";
ctx.textAlign = "center";
ctx.font = "900 62px Arial";
ctx.fillText("A-104", w / 2, 93);
ctx.fillStyle = "#e66e5b";
ctx.font = "800 24px Arial";
ctx.fillText("MAYA", w / 2, 139);
});
const tag = textPlane(garment, tagTexture, 0.37, 0.25, 0.27, 0.25, 0.185);
tag.rotation.z = -0.08;
const tagString = box(garment, 0.022, 0.15, 0.015, 0.27, 0.43, 0.18, M.white);
tagString.rotation.z = 0.18;
// Pins shown during fitting
const pins = new THREE.Group();
garment.add(pins);
for (let i = 0; i < 5; i++) {
const x = -0.52 + i * 0.22;
const pin = cylinder(pins, 0.018, 0.018, 0.16, x, 0.12 - i * 0.025, 0.16, i % 2 ? M.gold : M.white, 8);
pin.rotation.z = i % 2 ? 0.65 : -0.65;
sphere(pins, 0.035, x + (i % 2 ? 0.05 : -0.05), 0.2 - i * 0.025, 0.16, M.coral);
}
// Pickup ribbon
const ribbon = new THREE.Group();
garment.add(ribbon);
ribbon.visible = false;
box(ribbon, 0.62, 0.09, 0.19, 0, 0.47, 0.03, M.mintLight);
const bowL = addMesh(ribbon, new THREE.ConeGeometry(0.14, 0.22, 3), M.mintLight, -0.13, 0.49, 0.18);
const bowR = addMesh(ribbon, new THREE.ConeGeometry(0.14, 0.22, 3), M.mintLight, 0.13, 0.49, 0.18);
bowL.rotation.z = -Math.PI / 2;
bowR.rotation.z = Math.PI / 2;
garment.scale.setScalar(0.86);
const anchors = [
{ position: new THREE.Vector3(-4.28, 1.55, -1.55), rotation: 0.08 },
{ position: new THREE.Vector3(-1.35, 1.65, -1.43), rotation: 0.0 },
{ position: new THREE.Vector3(1.38, 1.58, -1.18), rotation: -0.08 },
{ position: new THREE.Vector3(4.18, 1.65, -1.43), rotation: 0.05 }
];
garment.position.copy(anchors[0].position);
garment.rotation.y = anchors[0].rotation;
// Active stage ring and follow light
const haloMaterial = new THREE.MeshBasicMaterial({
color: C.coral,
transparent: true,
opacity: 0.62,
side: THREE.DoubleSide,
depthWrite: false,
toneMapped: false
});
const halo = addMesh(scene, new THREE.RingGeometry(0.68, 0.76, 64), haloMaterial, -4.28, 0.135, -1.55);
halo.rotation.x = -Math.PI / 2;
halo.castShadow = false;
const followLight = new THREE.PointLight(C.coral, 0.65, 2.6, 2);
scene.add(followLight);
// Invisible station picking volumes
const hitMaterial = new THREE.MeshBasicMaterial({
transparent: true,
opacity: 0,
colorWrite: false,
depthWrite: false
});
const hitMeshes = [];
for (let i = 0; i < 4; i++) {
const hit = addMesh(scene, new THREE.BoxGeometry(2.65, 3.0, 2.25), hitMaterial, stationXs[i], 1.45, -1.68);
hit.userData.stage = i;
hit.castShadow = false;
hit.receiveShadow = false;
hitMeshes.push(hit);
}
// Custom camera controls, implemented without addons.
const cameraState = {
yaw: 0.055,
pitch: 0.39,
radius: window.innerWidth < 720 ? 17.0 : 14.3,
target: new THREE.Vector3(0, 1.2, -0.35)
};
function updateCamera() {
const horizontal = Math.cos(cameraState.pitch) * cameraState.radius;
camera.position.set(
cameraState.target.x + Math.sin(cameraState.yaw) * horizontal,
cameraState.target.y + Math.sin(cameraState.pitch) * cameraState.radius,
cameraState.target.z + Math.cos(cameraState.yaw) * horizontal
);
camera.lookAt(cameraState.target);
}
updateCamera();
let pointerDown = false;
let pointerMoved = false;
let pointerStart = { x: 0, y: 0 };
let previousPointer = { x: 0, y: 0 };
const raycaster = new THREE.Raycaster();
const pointer = new THREE.Vector2();
function setPointer(event) {
const rect = canvas.getBoundingClientRect();
pointer.x = ((event.clientX - rect.left) / rect.width) * 2 - 1;
pointer.y = -((event.clientY - rect.top) / rect.height) * 2 + 1;
}
canvas.addEventListener("pointerdown", event => {
pointerDown = true;
pointerMoved = false;
pointerStart = { x: event.clientX, y: event.clientY };
previousPointer = { x: event.clientX, y: event.clientY };
canvas.setPointerCapture(event.pointerId);
canvas.style.cursor = "grabbing";
});
canvas.addEventListener("pointermove", event => {
if (pointerDown) {
const dx = event.clientX - previousPointer.x;
const dy = event.clientY - previousPointer.y;
if (Math.hypot(event.clientX - pointerStart.x, event.clientY - pointerStart.y) > 5) {
pointerMoved = true;
}
cameraState.yaw -= dx * 0.005;
cameraState.pitch = THREE.MathUtils.clamp(cameraState.pitch + dy * 0.004, 0.18, 0.83);
previousPointer = { x: event.clientX, y: event.clientY };
} else {
setPointer(event);
raycaster.setFromCamera(pointer, camera);
const hit = raycaster.intersectObjects(hitMeshes, false)[0];
canvas.style.cursor = hit ? "pointer" : "grab";
}
});
canvas.addEventListener("pointerup", event => {
pointerDown = false;
canvas.style.cursor = "grab";
if (!pointerMoved) {
setPointer(event);
raycaster.setFromCamera(pointer, camera);
const hit = raycaster.intersectObjects(hitMeshes, false)[0];
if (hit) selectStage(hit.object.userData.stage);
}
});
canvas.addEventListener("pointercancel", () => {
pointerDown = false;
canvas.style.cursor = "grab";
});
canvas.addEventListener("wheel", event => {
event.preventDefault();
cameraState.radius = THREE.MathUtils.clamp(
cameraState.radius + event.deltaY * 0.009,
8.5,
20
);
}, { passive: false });
window.addEventListener("keydown", event => {
if (event.key === "ArrowLeft") cameraState.yaw += 0.08;
if (event.key === "ArrowRight") cameraState.yaw -= 0.08;
if (event.key === "ArrowUp") cameraState.pitch = Math.min(0.83, cameraState.pitch + 0.06);
if (event.key === "ArrowDown") cameraState.pitch = Math.max(0.18, cameraState.pitch - 0.06);
if (event.key === "+" || event.key === "=") cameraState.radius = Math.max(8.5, cameraState.radius - 0.5);
if (event.key === "-") cameraState.radius = Math.min(20, cameraState.radius + 0.5);
});
const stageData = [
{
title: "Fitting & intake",
copy: "The sleeve is pinned and the customer’s order tag is attached to the jacket.",
color: "#e66e5b"
},
{
title: "Tagged & queued",
copy: "Order A-104 hangs in the tagged queue; the garment and ticket stay together.",
color: "#e5b85c"
},
{
title: "At the sewing machine",
copy: "The same jacket is on the sewing mat while its sleeve and hem are adjusted.",
color: "#304b63"
},
{
title: "Ready for pickup",
copy: "A-104 returns to the collection rack with its original tag and a pickup ribbon.",
color: "#78a99a"
}
];
let currentStage = 0;
const statusElement = document.getElementById("status");
const copyElement = document.getElementById("orderCopy");
const progressElement = document.getElementById("progressFill");
const orderCard = document.getElementById("orderCard");
const advanceButton = document.getElementById("advance");
const toast = document.getElementById("toast");
const stepButtons = [...document.querySelectorAll(".step")];
let toastTimer;
function showToast(message) {
toast.textContent = message;
toast.classList.add("show");
clearTimeout(toastTimer);
toastTimer = setTimeout(() => toast.classList.remove("show"), 1800);
}
function selectStage(index, announce = true) {
currentStage = (index + stageData.length) % stageData.length;
const data = stageData[currentStage];
statusElement.textContent = data.title;
copyElement.textContent = data.copy;
document.documentElement.style.setProperty("--stage-color", data.color);
progressElement.style.width = `${(currentStage + 1) * 25}%`;
stepButtons.forEach((button, i) => {
const active = i === currentStage;
button.classList.toggle("active", active);
button.setAttribute("aria-pressed", String(active));
});
for (let i = 0; i < plaques.length; i++) {
const plaque = plaques[i];
const context = plaque.texture.image.getContext("2d");
paintPlaque(context, plaque.texture.image.width, plaque.texture.image.height, plaque.data, i === currentStage);
plaque.texture.needsUpdate = true;
}
rugs.forEach((rug, i) => {
rug.material.emissive.set(stationColors[i]);
rug.material.emissiveIntensity = i === currentStage ? 0.12 : 0.015;
});
haloMaterial.color.set(stationColors[currentStage]);
followLight.color.set(stationColors[currentStage]);
pins.visible = currentStage === 0;
ribbon.visible = currentStage === 3;
advanceButton.textContent = currentStage === 3 ? "Replay order from intake ↺" : "Advance order →";
cameraState.target.x = anchors[currentStage].position.x * 0.19;
orderCard.classList.remove("pulse");
void orderCard.offsetWidth;
orderCard.classList.add("pulse");
if (announce) showToast("A-104 moved with its garment");
}
stepButtons.forEach(button => {
button.addEventListener("click", () => selectStage(Number(button.dataset.stage)));
});
advanceButton.addEventListener("click", () => selectStage(currentStage + 1));
document.getElementById("reset").addEventListener("click", () => {
cameraState.yaw = 0.055;
cameraState.pitch = 0.39;
cameraState.radius = window.innerWidth < 720 ? 17.0 : 14.3;
cameraState.target.set(0, 1.2, -0.35);
});
function resize() {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
}
window.addEventListener("resize", resize);
selectStage(0, false);
const clock = new THREE.Clock();
const targetPosition = new THREE.Vector3();
const targetLook = new THREE.Vector3();
function animate() {
const delta = Math.min(clock.getDelta(), 0.05);
const ease = 1 - Math.exp(-delta * 4.4);
targetPosition.copy(anchors[currentStage].position);
garment.position.lerp(targetPosition, ease);
garment.rotation.y = THREE.MathUtils.lerp(garment.rotation.y, anchors[currentStage].rotation, ease);
targetLook.set(anchors[currentStage].position.x, 0.135, anchors[currentStage].position.z);
halo.position.x = THREE.MathUtils.lerp(halo.position.x, targetLook.x, ease);
halo.position.z = THREE.MathUtils.lerp(halo.position.z, targetLook.z, ease);
haloMaterial.opacity = 0.52 + Math.sin(clock.elapsedTime * 2.4) * 0.09;
followLight.position.set(
garment.position.x,
garment.position.y + 0.35,
garment.position.z + 0.4
);
followLight.intensity = currentStage === 2 ? 0.95 : 0.55;
if (currentStage === 2) {
needle.position.y = 0.13 + Math.sin(clock.elapsedTime * 8) * 0.035;
}
cameraState.target.lerp(
new THREE.Vector3(cameraState.target.x, 1.2, -0.35),
1 - Math.exp(-delta * 3)
);
updateCamera();
renderer.render(scene, camera);
requestAnimationFrame(animate);
}
animate();
requestAnimationFrame(() => document.getElementById("loading").classList.add("done"));
</script>
</body>
</html>
```