Prompt specification
Build or customize the Three.js 3D scene "Food-cart station sequence model" 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: Food-cart station sequence model
Category: Architecture & Cities · Style: Procedural Solid / Shader 3D
License: MIT · Reference: https://three3d.app/scene/food-cart-station-sequence-model-x0501
Scene Description Prompt:
Create a single self-contained HTML file using Three.js from cdnjs that shows food-cart service flow. Show a compact cart with separate preparation, assembly, and pickup surfaces; connect them with simple arrows while keeping customer access on the opposite side. Stylized solid forms.
Working Three.js Starter (food-cart-station-sequence-model-x0501):
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Food Cart · Service Flow</title>
<style>
:root{
--ink:#22303a; --paper:rgba(255,255,255,.82); --line:rgba(34,48,58,.14);
}
*{box-sizing:border-box}
html,body{margin:0;height:100%;overflow:hidden;background:#f4f1ec;
font-family:"Segoe UI",system-ui,-apple-system,Helvetica,Arial,sans-serif;color:var(--ink)}
#app{position:fixed;inset:0}
canvas{display:block}
.panel{
position:fixed;background:var(--paper);backdrop-filter:blur(8px);
border:1px solid var(--line);border-radius:14px;padding:14px 16px;
box-shadow:0 10px 30px rgba(30,40,50,.12);
}
#title{top:18px;left:18px;max-width:320px}
#title h1{margin:0 0 2px;font-size:16px;letter-spacing:.14em;text-transform:uppercase}
#title p{margin:0;font-size:12.5px;line-height:1.45;opacity:.75}
#legend{bottom:18px;left:18px;display:flex;flex-wrap:wrap;gap:8px;align-items:center;font-size:12px}
.chip{display:flex;align-items:center;gap:7px;padding:6px 11px;border-radius:999px;
background:rgba(255,255,255,.75);border:1px solid var(--line)}
.sw{width:12px;height:12px;border-radius:4px;display:inline-block}
.sep{opacity:.45;font-size:11px;letter-spacing:.1em;text-transform:uppercase}
#hint{bottom:18px;right:18px;font-size:11.5px;opacity:.7;letter-spacing:.03em}
#ctrls{top:18px;right:18px;display:flex;gap:8px}
button{
font:inherit;font-size:12px;padding:8px 13px;border-radius:10px;cursor:pointer;
background:#fff;border:1px solid var(--line);color:var(--ink);box-shadow:0 3px 10px rgba(30,40,50,.08)
}
button:hover{background:#f0ece6}
button:active{transform:translateY(1px)}
@media (max-width:700px){#legend{display:none}#hint{display:none}}
</style>
</head>
<body>
<div id="app"></div>
<div class="panel" id="title">
<h1>Food Cart · Service Flow</h1>
<p>Prep → Assembly → Pickup run along the vendor deck; customers wait and collect on the opposite side.</p>
</div>
<div class="panel" id="ctrls">
<button data-view="reset">Reset</button>
<button data-view="top">Top</button>
<button data-view="side">Side</button>
</div>
<div class="panel" id="legend">
<span class="chip"><i class="sw" style="background:#3F8F6B"></i>1 Prep</span>
<span class="chip"><i class="sw" style="background:#E9A13B"></i>2 Assembly</span>
<span class="chip"><i class="sw" style="background:#E1553C"></i>3 Pickup</span>
<span class="sep">|</span>
<span class="chip"><i class="sw" style="background:#9BB8D4"></i>Customer access</span>
</div>
<div class="panel" id="hint">drag = orbit · wheel = zoom · right-drag = pan</div>
<script type="module">
import * as THREE from 'https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js';
/* ---------------------------------------------------------------- basics */
const app = document.getElementById('app');
const renderer = new THREE.WebGLRenderer({ antialias:true, alpha:false });
renderer.setPixelRatio(Math.min(devicePixelRatio, 2));
renderer.setSize(innerWidth, innerHeight);
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
renderer.outputColorSpace = THREE.SRGBColorSpace;
app.appendChild(renderer.domElement);
const scene = new THREE.Scene();
scene.background = new THREE.Color(0xf4f1ec);
scene.fog = new THREE.Fog(0xf4f1ec, 18, 42);
const camera = new THREE.PerspectiveCamera(42, innerWidth/innerHeight, 0.1, 120);
scene.add(new THREE.HemisphereLight(0xfff6ea, 0xb9c3c8, 0.85));
const key = new THREE.DirectionalLight(0xfff3e2, 2.0);
key.position.set(6.5, 12, -4.5);
key.castShadow = true;
key.shadow.mapSize.set(2048, 2048);
key.shadow.camera.left = -12; key.shadow.camera.right = 12;
key.shadow.camera.top = 12; key.shadow.camera.bottom = -12;
key.shadow.camera.far = 40;
key.shadow.bias = -0.0009;
key.shadow.normalBias = 0.02;
scene.add(key);
const fill = new THREE.DirectionalLight(0xdfe8f2, 0.55);
fill.position.set(-8, 6, 8);
scene.add(fill);
/* ------------------------------------------------------------- helpers */
const mat = (c, o={}) => new THREE.MeshStandardMaterial({ color:c, roughness:.72, metalness:.02, ...o });
function roundedBoxGeo(w, h, d, r = .08){
const b = Math.min(.03, r*.5, w/2-.002, h/2-.002, d/2-.002);
const sw = w-2*b, sh = h-2*b, sd = d-2*b, rr = Math.max(.002, r-b);
const s = new THREE.Shape();
s.moveTo(-sw/2+rr, -sh/2);
s.lineTo(sw/2-rr, -sh/2); s.quadraticCurveTo(sw/2,-sh/2, sw/2,-sh/2+rr);
s.lineTo(sw/2, sh/2-rr); s.quadraticCurveTo(sw/2,sh/2, sw/2-rr,sh/2);
s.lineTo(-sw/2+rr, sh/2); s.quadraticCurveTo(-sw/2,sh/2, -sw/2,sh/2-rr);
s.lineTo(-sw/2,-sh/2+rr);s.quadraticCurveTo(-sw/2,-sh/2, -sw/2+rr,-sh/2);
const g = new THREE.ExtrudeGeometry(s,{depth:sd,bevelEnabled:true,bevelThickness:b,bevelSize:b,bevelSegments:2,curveSegments:6});
g.translate(0,0,-sd/2); g.computeVertexNormals();
return g;
}
const rbox = (w,h,d,r,c,mats) => new THREE.Mesh(roundedBoxGeo(w,h,d,r), mats || mat(c));
function roundRect(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 labelTexture(text, {bg='#ffffff', fg='#22303a', sub=null, w=512, h=150, fs=62, r=26}={}){
const c = document.createElement('canvas'); c.width=w; c.height=h;
const x = c.getContext('2d');
roundRect(x,3,3,w-6,h-6,r); x.fillStyle=bg; x.fill();
x.strokeStyle='rgba(34,48,58,.18)'; x.lineWidth=3; x.stroke();
x.textAlign='center'; x.textBaseline='middle'; x.fillStyle=fg;
x.font = `700 ${fs}px "Segoe UI",system-ui,sans-serif`;
x.fillText(text, w/2, sub ? h*.38 : h*.5);
if(sub){ x.globalAlpha=.62; x.font=`600 ${Math.round(fs*.42)}px "Segoe UI",system-ui,sans-serif`; x.fillText(sub, w/2, h*.72); x.globalAlpha=1; }
const t = new THREE.CanvasTexture(c); t.colorSpace = THREE.SRGBColorSpace; t.anisotropy = 4; return t;
}
function menuTexture(){
const c=document.createElement('canvas'); c.width=512; c.height=384;
const x=c.getContext('2d');
roundRect(x,4,4,504,376,26); x.fillStyle='#fdf7ea'; x.fill();
x.strokeStyle='rgba(34,48,58,.2)'; x.lineWidth=4; x.stroke();
x.fillStyle='#E1553C'; roundRect(x,4,4,504,86,26); x.fill(); roundRect(x,4,62,504,28,4); x.fill();
x.textAlign='center'; x.fillStyle='#fff'; x.font='700 42px "Segoe UI",system-ui,sans-serif'; x.fillText('MENU',256,52);
const items=[['Street Taco','$3'],['Burrito','$5'],['Loaded Nachos','$4']];
x.textAlign='left'; items.forEach((it,i)=>{
x.fillStyle='#22303a'; x.font='600 30px "Segoe UI",system-ui,sans-serif'; x.fillText(it[0],46,146+i*74);
x.fillStyle='#3F8F6B'; x.font='700 30px "Segoe UI",system-ui,sans-serif'; x.textAlign='right'; x.fillText(it[1],466,146+i*74); x.textAlign='left';
});
const t=new THREE.CanvasTexture(c); t.colorSpace=THREE.SRGBColorSpace; return t;
}
const billboards = [];
function billboard(texture, w, h, pos, opts={}){
const m = new THREE.Mesh(new THREE.PlaneGeometry(w,h),
new THREE.MeshBasicMaterial({map:texture, transparent:true, depthWrite:false, toneMapped:false, ...opts}));
m.position.copy(pos); m.renderOrder = 5; scene.add(m); billboards.push(m); return m;
}
function arrowMesh(len, wid, col, thick=.05){
const s = new THREE.Shape(), hw = wid/2, head = Math.min(len*.55, wid*1.05), tail = len - head;
s.moveTo(-len/2,-hw*.45); s.lineTo(-len/2+tail,-hw*.45);
s.lineTo(-len/2+tail,-hw); s.lineTo(len/2,0); s.lineTo(-len/2+tail,hw);
s.lineTo(-len/2+tail,hw*.45); s.lineTo(-len/2,hw*.45); s.closePath();
const g = new THREE.ExtrudeGeometry(s,{depth:thick,bevelEnabled:false});
g.translate(0,0,-thick/2);
const m = new THREE.Mesh(g, mat(col, {roughness:.55}));
m.rotation.x = -Math.PI/2; // lay flat, points +X
return m;
}
/* --------------------------------------------------------------- ground */
const ground = new THREE.Mesh(new THREE.CircleGeometry(10.5, 72), mat(0xece5d9));
ground.rotation.x = -Math.PI/2; ground.receiveShadow = true; scene.add(ground);
function floorPatch(w, d, x, z, c){
const g = roundedBoxGeo(w, .04, d, .18);
const m = new THREE.Mesh(g, mat(c)); m.position.set(x,.02,z); m.receiveShadow = true; scene.add(m); return m;
}
floorPatch(8.6, 2.3, 0.7, -2.85, 0xd7e3f0); // customer side
floorPatch(7.6, 1.7, 0.0, 2.60, 0xf0dfc6); // vendor / staff side
/* ----------------------------------------------------------------- cart */
const CREAM = 0xf0e3cb, CHASSIS = 0x33424d, DARK = 0x243039, STEEL = 0xa8b2b8;
const chassis = rbox(7.2, .18, 2.4, .06, CHASSIS); chassis.position.y = .70; scene.add(chassis);
const body = rbox(7.0, 1.00, 2.3, .14, CREAM); body.position.y = 1.28; scene.add(body);
const deck = rbox(7.0, .12, 2.3, .06, 0xd9cfc0); deck.position.y = 1.84; scene.add(deck);
const stripe = rbox(6.9, .22, .06, .03, 0xE1553C); stripe.position.set(0, 1.12, -1.17); scene.add(stripe);
const stripe2 = rbox(6.9, .22, .06, .03, 0xE1553C); stripe2.position.set(0, 1.12, 1.17); scene.add(stripe2);
const wheelGeo = new THREE.CylinderGeometry(.36,.36,.16,28);
for(const wx of [-2.65, 2.65]) for(const wz of [-1.0, 1.0]){
const w = new THREE.Mesh(wheelGeo, mat(DARK));
w.rotation.x = Math.PI/2; w.position.set(wx,.36,wz); scene.add(w);
const hub = new THREE.Mesh(new THREE.CylinderGeometry(.13,.13,.19,18), mat(0xc9c2b7));
hub.rotation.x = Math.PI/2; hub.position.set(wx,.36,wz); scene.add(hub);
}
/* ------------------------------------------ three separate work surfaces */
const SURF = [
{ key:'prep', name:'1 · PREP', color:0x3F8F6B, x:-2.30, top:2.44, sub:'prep station' },
{ key:'assy', name:'2 · ASSEMBLY', color:0xE9A13B, x: 0.00, top:2.38, sub:'build station' },
{ key:'pick', name:'3 · PICKUP', color:0xE1553C, x: 2.30, top:2.32, sub:'hand-off' },
];
const SZ = 0.62; // vendor-side depth of the surfaces
for(const s of SURF){
const legH = s.top - .14 - 1.90;
const slab = rbox(1.78, .14, 1.05, .07, s.color); slab.position.set(s.x, s.top-.07, SZ); scene.add(slab);
const lip = rbox(1.60, .03, .95, .03, 0xffffff, mat(s.color,{roughness:.5}));
lip.position.set(s.x, s.top+.015, SZ); lip.material.transparent = true; lip.material.opacity = .18; scene.add(lip);
for(const lx of [-.62,.62]){
const leg = rbox(.10, legH, .10, .03, 0x8d9498); leg.position.set(s.x+lx, 1.90+legH/2, SZ); scene.add(leg);
}
// small numbered tag plate on the front face of each surface
const tag = new THREE.Mesh(new THREE.PlaneGeometry(.5,.28),
new THREE.MeshBasicMaterial({map:labelTexture(s.name.split('·')[0].trim(),{bg:'#ffffff',fg:'#22303a',fs:70,w:256,h:140}),transparent:true}));
tag.position.set(s.x, s.top-.07, SZ-.535); tag.rotation.y = Math.PI; scene.add(tag);
}
/* ---------------------------------------------------------- flow arrows */
const pulseRings = [];
for(const ax of [-1.15, 1.15]){
const a = arrowMesh(.52, .30, 0x33424d); a.position.set(ax, 1.925, SZ); scene.add(a);
const ring = new THREE.Mesh(new THREE.RingGeometry(.16,.21,32),
new THREE.MeshBasicMaterial({color:0xE1553C, transparent:true, opacity:.5, side:THREE.DoubleSide, depthWrite:false}));
ring.rotation.x = -Math.PI/2; ring.position.set(ax, 1.94, SZ); scene.add(ring); pulseRings.push(ring);
}
// hand-off arrow: from pickup surface, over the counter edge, down to the customer
const handoff = arrowMesh(.75, .30, 0xE1553C, .05);
handoff.rotation.set(0, Math.PI/2, -0.42); handoff.position.set(2.30, 2.50, -0.22); scene.add(handoff);
/* ------------------------------------------------------- surface props */
const C = {
board:0xc98b4b, steel:0xc9d2d6, bun:0xe8b96a, meat:0x6b3f2a, lettuce:0x7fc05a,
tomato:0xd94a3d, bag:0xd8b384, white:0xfbf7ef, cup:0xf3ece0, ink:0x33424d
};
// PREP
{
const y = 2.44;
const board = rbox(.95,.05,.62,.06,C.board); board.position.set(-2.55,y+.03,SZ-.05); scene.add(board);
const knife = rbox(.40,.025,.09,.02,C.steel); knife.position.set(-2.45,y+.07,SZ+.18); knife.rotation.y=.35; scene.add(knife);
const handle = rbox(.16,.045,.10,.02,0x3a2f2a); handle.position.set(-2.70,y+.07,SZ+.14); handle.rotation.y=.35; scene.add(handle);
const veg = [[0x7fc05a,.10,-2.72,SZ-.16],[0xd94a3d,.11,-2.52,SZ-.22],[0xe9a13b,.09,-2.38,SZ-.10]];
veg.forEach(([c,r,x,z])=>{ const s=new THREE.Mesh(new THREE.SphereGeometry(r,16,12),mat(c)); s.position.set(x,y+.09,z); scene.add(s); });
const bowl = new THREE.Mesh(new THREE.CylinderGeometry(.22,.16,.14,24), mat(0xe8e0d2));
bowl.position.set(-1.98,y+.07,SZ+.05); scene.add(bowl);
}
// ASSEMBLY
{
const y = 2.38;
const bottom = new THREE.Mesh(new THREE.SphereGeometry(.21,20,14), mat(C.bun));
bottom.scale.y=.45; bottom.position.set(-.22,y+.07,SZ-.08); scene.add(bottom);
const patty = new THREE.Mesh(new THREE.CylinderGeometry(.21,.21,.07,24), mat(C.meat));
patty.position.set(-.22,y+.17,SZ-.08); scene.add(patty);
const let_ = new THREE.Mesh(new THREE.CylinderGeometry(.235,.235,.035,24), mat(C.lettuce));
let_.position.set(-.22,y+.225,SZ-.08); scene.add(let_);
const top = new THREE.Mesh(new THREE.SphereGeometry(.21,20,14), mat(C.bun));
top.scale.y=.42; top.position.set(-.22,y+.27,SZ-.08); scene.add(top);
for(let i=0;i<3;i++){
const b = new THREE.Mesh(new THREE.CylinderGeometry(.20,.20,.06,20), mat(C.bun));
b.position.set(.52,y+.03+i*.06,SZ+.02); scene.add(b);
}
const can = new THREE.Mesh(new THREE.CylinderGeometry(.11,.11,.26,20), mat(0xe6d7bd));
can.position.set(-.62,y+.13,SZ+.06); scene.add(can);
}
// PICKUP
{
const y = 2.32;
const tray = rbox(.54,.09,.40,.04,C.white); tray.position.set(2.12,y+.05,SZ+.02); scene.add(tray);
const wrap = rbox(.46,.05,.32,.03,0xf6f1e6); wrap.position.set(2.12,y+.11,SZ+.02); scene.add(wrap);
const bag = rbox(.36,.44,.30,.05,C.bag); bag.position.set(2.72,y+.22,SZ+.06); scene.add(bag);
const fold = rbox(.36,.07,.30,.03,0xb98f61); fold.position.set(2.72,y+.46,SZ+.06); scene.add(fold);
const cup = new THREE.Mesh(new THREE.CylinderGeometry(.11,.09,.30,20), mat(C.cup));
cup.position.set(2.40,y+.15,SZ-.28); scene.add(cup);
const lid = new THREE.Mesh(new THREE.CylinderGeometry(.12,.12,.04,20), mat(0xE1553C));
lid.position.set(2.40,y+.32,SZ-.28); scene.add(lid);
}
/* ------------------------------------------------ customer side (opposite) */
// pickup / collection ledge reaching out to the customer side
const ledge = rbox(1.9, .13, 1.15, .07, 0xE1553C); ledge.position.set(2.30, 1.42, -1.78); scene.add(ledge);
for(const lx of [1.60, 3.00]){
const leg = rbox(.11, 1.33, .11, .03, 0x8d9498); leg.position.set(lx, .66, -2.18); scene.add(leg);
}
const ledgeBag = rbox(.30,.36,.26,.04,C.bag); ledgeBag.position.set(2.05,1.67,-1.95); scene.add(ledgeBag);
const ledgeCup = new THREE.Mesh(new THREE.CylinderGeometry(.10,.09,.28,18), mat(C.cup));
ledgeCup.position.set(2.48,1.63,-1.95); scene.add(ledgeCup);
// striped awning over the menu / order area
const awn = new THREE.Group(); awn.position.set(-2.0, 2.62, -1.80); awn.rotation.x = -0.15; scene.add(awn);
for(let i=0;i<6;i++){
const st = new THREE.Mesh(new THREE.BoxGeometry(.44,.07,1.38), mat(i%2 ? 0xf6f1e6 : 0xE1553C));
st.position.x = -1.32 + i*.44; awn.add(st);
}
const valance = new THREE.Mesh(new THREE.BoxGeometry(2.66,.26,.07), mat(0xf6f1e6));
valance.position.set(0,-.14,-.70); awn.add(valance);
for(const sx of [-3.1,-.9]){
const post = rbox(.09,.95,.09,.03,0x8d9498); post.position.set(sx,2.25,-1.10); scene.add(post);
}
// menu board on the customer-facing side
const menuFrame = rbox(1.86,1.12,.08,.05,0x33424d); menuFrame.position.set(-2.0,1.42,-1.20); scene.add(menuFrame);
const menu = new THREE.Mesh(new THREE.PlaneGeometry(1.7,1.0), new THREE.MeshBasicMaterial({map:menuTexture()}));
menu.position.set(-2.0,1.42,-1.245); menu.rotation.y = Math.PI; scene.add(menu);
// floor arrow: customers approach from this side
const floorArrow = arrowMesh(.85,.42,0x9BB8D4,.04); floorArrow.position.set(2.55,.055,-2.95); scene.add(floorArrow);
/* --------------------------------------------------------------- people */
function person({x,z,rot=0,shirt=0x4c6ef5,skin=0xf1c9a5,hair=0x3b2f2f,hat=null,apron=null,scale=1}){
const g = new THREE.Group();
const torso = rbox(.46,.70,.30,.12,shirt); torso.position.y = 1.02; g.add(torso);
const hips = rbox(.44,.28,.30,.10,0x3d4850); hips.position.y=.68; g.add(hips);
for(const lx of [-.11,.11]){
const leg = rbox(.16,.62,.18,.05,0x364049); leg.position.set(lx,.34,0); g.add(leg);
const shoe = rbox(.18,.10,.28,.04,0x222b31); shoe.position.set(lx,.05,.04); g.add(shoe);
}
for(const ax of [-.30,.30]){
const arm = rbox(.13,.54,.15,.06,shirt); arm.position.set(ax,1.04,0); arm.rotation.z = ax<0 ? .12 : -.12; g.add(arm);
}
const head = new THREE.Mesh(new THREE.SphereGeometry(.20,22,16), mat(skin)); head.position.y=1.55; g.add(head);
const hairM = new THREE.Mesh(new THREE.SphereGeometry(.205,22,16), mat(hair)); hairM.scale.y=.62; hairM.position.y=1.66; g.add(hairM);
if(hat){
const hm = new THREE.Mesh(new THREE.CylinderGeometry(.21,.21,.13,22), mat(0xf7f3ea)); hm.position.y=1.79; g.add(hm);
const hm2 = new THREE.Mesh(new THREE.SphereGeometry(.21,22,14), mat(0xf7f3ea)); hm2.scale.y=.62; hm2.position.y=1.88; g.add(hm2);
}
if(apron){
const ap = rbox(.42,.52,.05,.04,apron); ap.position.set(0,.95,-.17); g.add(ap);
}
g.position.set(x,0,z); g.rotation.y = rot; g.scale.setScalar(scale);
scene.add(g); return g;
}
person({x:-1.35,z:1.95,rot:0,shirt:0x3F8F6B,apron:0xf4efe4,hat:true}); // vendor
person({x:3.95,z:-2.75,rot:Math.PI,shirt:0xE1553C,scale:.98}); // customer at pickup
person({x:4.85,z:-3.05,rot:Math.PI,shirt:0x4c6ef5,scale:.92}); // customer waiting
person({x:0.55,z:-3.15,rot:Math.PI,shirt:0x9BB8D4,scale:.9}); // customer at menu
/* --------------------------------------------------------------- labels */
billboard(labelTexture('1 · PREP',{bg:'#3F8F6B',fg:'#ffffff',sub:'prep station'}),1.35,.40,new THREE.Vector3(-2.30,2.92,SZ-.05));
billboard(labelTexture('2 · ASSEMBLY',{bg:'#E9A13B',fg:'#22303a',sub:'build station'}),1.55,.40,new THREE.Vector3(0,2.86,SZ-.05));
billboard(labelTexture('3 · PICKUP',{bg:'#E1553C',fg:'#ffffff',sub:'hand-off'}),1.45,.40,new THREE.Vector3(2.30,2.80,SZ-.05));
billboard(labelTexture('CUSTOMER ACCESS',{bg:'#9BB8D4',fg:'#22303a'}),1.75,.38,new THREE.Vector3(1.10,.55,-3.35));
billboard(labelTexture('STAFF SIDE',{bg:'#d9c09a',fg:'#22303a'}),1.35,.36,new THREE.Vector3(-2.9,.55,3.05));
/* ---------------------------------------------------------- shadows etc */
scene.traverse(o=>{ if(o.isMesh && !o.material?.transparent && o.material?.type!=='MeshBasicMaterial'){ o.castShadow=true; o.receiveShadow=true; } });
/* ------------------------------------------------------- camera controls */
const target = new THREE.Vector3(0,1.70,0);
const VIEWS = {
reset:{ theta:2.29, phi:1.19, dist:12.6 },
top: { theta:2.29, phi:0.16, dist:13.0 },
side: { theta:Math.PI, phi:1.32, dist:13.5 },
};
let theta=VIEWS.reset.theta, phi=VIEWS.reset.phi, dist=VIEWS.reset.dist;
function applyCamera(){
const s = new THREE.Spherical(dist, phi, theta);
camera.position.setFromSpherical(s).add(target);
camera.lookAt(target);
}
applyCamera();
const pointers = new Map();
let mode='orbit', lastX=0, lastY=0, pinchDist=0;
const el = renderer.domElement;
el.addEventListener('contextmenu', e=>e.preventDefault());
el.addEventListener('pointerdown', e=>{
pointers.set(e.pointerId, {x:e.clientX,y:e.clientY});
if(pointers.size===1){ mode = (e.button===2||e.shiftKey)?'pan':'orbit'; lastX=e.clientX; lastY=e.clientY; }
else if(pointers.size===2){ const p=[...pointers.values()]; pinchDist=Math.hypot(p[0].x-p[1].x,p[0].y-p[1].y); }
el.setPointerCapture(e.pointerId);
});
el.addEventListener('pointermove', e=>{
if(!pointers.has(e.pointerId)) return;
pointers.set(e.pointerId,{x:e.clientX,y:e.clientY});
if(pointers.size===2){
const p=[...pointers.values()], d=Math.hypot(p[0].x-p[1].x,p[0].y-p[1].y);
if(pinchDist) dist = THREE.MathUtils.clamp(dist*(pinchDist/d), 5.5, 26);
pinchDist=d; return;
}
const dx=e.clientX-lastX, dy=e.clientY-lastY; lastX=e.clientX; lastY=e.clientY;
if(mode==='orbit'){
theta -= dx*0.006;
phi = THREE.MathUtils.clamp(phi - dy*0.005, 0.10, 1.46);
}else{
const right = new THREE.Vector3(), up = new THREE.Vector3();
camera.matrixWorld.extractBasis(right, up, new THREE.Vector3());
target.addScaledVector(right,-dx*0.012*dist/12).addScaledVector(up, dy*0.012*dist/12);
target.x = THREE.MathUtils.clamp(target.x,-5,5);
target.z = THREE.MathUtils.clamp(target.z,-5,5);
}
});
const endPtr = e=>{ pointers.delete(e.pointerId); if(pointers.size<2) pinchDist=0; };
el.addEventListener('pointerup', endPtr);
el.addEventListener('pointercancel', endPtr);
el.addEventListener('wheel', e=>{ e.preventDefault(); dist = THREE.MathUtils.clamp(dist*(1+e.deltaY*0.0011),5.5,26); },{passive:false});
document.querySelectorAll('#ctrls button').forEach(b=>{
b.addEventListener('click',()=>{
const v=VIEWS[b.dataset.view];
theta=v.theta; phi=v.phi; dist=v.dist; target.set(0,1.70,0);
});
});
addEventListener('resize',()=>{
camera.aspect=innerWidth/innerHeight; camera.updateProjectionMatrix();
renderer.setSize(innerWidth,innerHeight);
});
/* -------------------------------------------------------------- animate */
const clock = new THREE.Clock();
function tick(){
const t = clock.getElapsedTime();
applyCamera();
for(const b of billboards) b.quaternion.copy(camera.quaternion);
pulseRings.forEach((r,i)=>{
const p = (t*0.55 + i/3) % 1;
const s = 0.55 + p*1.9;
r.scale.set(s,s,s);
r.material.opacity = Math.max(0, (1-p))*0.55;
});
renderer.render(scene,camera);
requestAnimationFrame(tick);
}
tick();
</script>
</body>
</html>
```