Prompt specification
Build or customize the Three.js 3D scene "Community Event Supply Contingencies" 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: Community Event Supply Contingencies
Category: Voxel Worlds · Style: Voxel 3D
License: MIT · Reference: https://three3d.app/scene/community-event-supply-contingencies-x3223
Scene Description Prompt:
Please create one self-contained HTML file with Three.js from cdnjs showing contingency plans for uncertain events. Build an event site with deliveries arriving within declared time windows. Compare a rigid schedule with a plan containing buffers and substitutes under the same arrivals. Voxel style.
Working Three.js Starter (community-event-supply-contingencies-x3223):
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Fieldwork — Contingency Planning for Event Deliveries</title>
<style>
:root {
--bg: #eceae2;
--panel: #f8f7f1;
--panel-strong: #ffffff;
--ink: #17211d;
--muted: #69736d;
--line: #d8dcd4;
--green: #216d59;
--green-soft: #dcebe4;
--red: #d95f4d;
--red-soft: #f4dfda;
--blue: #5376b9;
--amber: #d89c32;
--purple: #8967ae;
--shadow: 0 16px 42px rgba(39, 49, 43, 0.09);
}
* { box-sizing: border-box; }
html, body {
margin: 0;
width: 100%;
min-height: 100%;
background: var(--bg);
color: var(--ink);
font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input { font: inherit; }
button { color: inherit; }
.app {
min-height: 100vh;
display: flex;
flex-direction: column;
}
.topbar {
height: 78px;
flex: 0 0 78px;
display: grid;
grid-template-columns: 300px 1fr auto;
align-items: center;
gap: 24px;
padding: 0 24px;
background: rgba(248, 247, 241, 0.92);
border-bottom: 1px solid var(--line);
backdrop-filter: blur(12px);
z-index: 5;
}
.brand {
display: flex;
align-items: center;
gap: 13px;
}
.brand-icon {
width: 38px;
height: 38px;
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 3px;
transform: rotate(-3deg);
}
.brand-icon i {
display: block;
background: var(--ink);
border-radius: 1px;
}
.brand-icon i:nth-child(2) { background: var(--green); }
.brand-icon i:nth-child(3) { background: var(--amber); }
.brand-icon i:nth-child(4) { background: var(--red); }
.brand-name {
font-weight: 900;
font-size: 17px;
letter-spacing: 0.12em;
}
.brand-sub {
margin-top: 3px;
color: var(--muted);
font-size: 10px;
font-weight: 800;
letter-spacing: 0.13em;
text-transform: uppercase;
}
.event-title {
display: flex;
align-items: center;
justify-content: center;
gap: 14px;
text-align: center;
}
.event-title strong {
display: block;
font-size: 17px;
letter-spacing: -0.02em;
}
.event-title span {
display: block;
color: var(--muted);
font-size: 12px;
margin-top: 3px;
}
.event-pill {
padding: 6px 9px;
border: 1px solid var(--line);
background: white;
border-radius: 5px;
font-size: 10px;
font-weight: 900;
letter-spacing: 0.1em;
text-transform: uppercase;
}
.header-status {
display: flex;
align-items: center;
gap: 13px;
}
.live-pill {
display: flex;
align-items: center;
gap: 8px;
font-size: 11px;
font-weight: 850;
letter-spacing: 0.08em;
text-transform: uppercase;
}
.live-dot {
width: 8px;
height: 8px;
background: var(--green);
border-radius: 50%;
box-shadow: 0 0 0 4px var(--green-soft);
}
.clock {
min-width: 82px;
padding: 9px 12px;
border-radius: 6px;
background: var(--ink);
color: white;
font-variant-numeric: tabular-nums;
text-align: center;
font-size: 17px;
font-weight: 850;
letter-spacing: 0.04em;
}
.workspace {
min-height: 0;
flex: 1;
display: grid;
grid-template-columns: 270px minmax(560px, 1fr) 320px;
gap: 14px;
padding: 14px;
}
.panel {
background: var(--panel);
border: 1px solid var(--line);
border-radius: 8px;
box-shadow: var(--shadow);
}
.left-panel, .right-panel {
overflow: auto;
scrollbar-width: thin;
}
.section {
padding: 19px;
border-bottom: 1px solid var(--line);
}
.section:last-child { border-bottom: 0; }
.eyebrow {
color: var(--muted);
font-size: 10px;
font-weight: 900;
letter-spacing: 0.14em;
text-transform: uppercase;
}
h1, h2, h3, p { margin: 0; }
.section-title {
margin-top: 7px;
font-size: 20px;
line-height: 1.12;
letter-spacing: -0.035em;
}
.section-copy {
margin-top: 9px;
color: var(--muted);
font-size: 12px;
line-height: 1.5;
}
.arrival-list {
display: grid;
gap: 8px;
margin-top: 16px;
}
.arrival-row {
width: 100%;
padding: 11px;
border: 1px solid var(--line);
border-left: 4px solid var(--job-color);
border-radius: 5px;
background: rgba(255,255,255,0.66);
text-align: left;
}
.arrival-top,
.arrival-bottom {
display: flex;
align-items: center;
justify-content: space-between;
gap: 8px;
}
.arrival-top strong {
font-size: 12px;
}
.arrival-time {
font-size: 12px;
font-weight: 900;
font-variant-numeric: tabular-nums;
}
.arrival-bottom {
margin-top: 6px;
color: var(--muted);
font-size: 10px;
}
.sync-badge {
color: var(--green);
font-weight: 900;
letter-spacing: 0.07em;
}
.control-label {
display: flex;
justify-content: space-between;
align-items: center;
margin: 14px 0 8px;
font-size: 11px;
font-weight: 800;
}
.control-value {
color: var(--green);
font-variant-numeric: tabular-nums;
}
input[type="range"] {
width: 100%;
accent-color: var(--green);
cursor: pointer;
}
.range-notes {
display: flex;
justify-content: space-between;
margin-top: 5px;
color: var(--muted);
font-size: 9px;
}
.button-row {
display: flex;
gap: 8px;
margin-top: 16px;
}
.button {
min-height: 38px;
padding: 0 13px;
border: 1px solid var(--line);
border-radius: 5px;
background: white;
font-size: 11px;
font-weight: 850;
cursor: pointer;
transition: transform .15s, background .15s, border-color .15s;
}
.button:hover {
transform: translateY(-1px);
border-color: #aeb7af;
}
.button.primary {
flex: 1;
border-color: var(--ink);
background: var(--ink);
color: white;
}
.speed-row {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 5px;
margin-top: 12px;
}
.speed-button {
padding: 8px 4px;
border: 1px solid var(--line);
border-radius: 4px;
background: transparent;
color: var(--muted);
font-size: 10px;
font-weight: 850;
cursor: pointer;
}
.speed-button.active {
border-color: var(--green);
background: var(--green-soft);
color: var(--green);
}
.legend {
display: grid;
gap: 9px;
margin-top: 14px;
}
.legend-item {
display: flex;
align-items: center;
gap: 9px;
color: var(--muted);
font-size: 11px;
}
.legend-swatch {
width: 14px;
height: 14px;
border-radius: 3px;
background: var(--swatch);
}
.center-column {
min-width: 0;
display: grid;
grid-template-rows: minmax(410px, 1fr) 296px;
gap: 14px;
}
.scene-panel {
position: relative;
overflow: hidden;
background: #e9e6dc;
}
#scene {
width: 100%;
height: 100%;
display: block;
cursor: grab;
touch-action: none;
}
#scene:active { cursor: grabbing; }
.scene-top {
position: absolute;
z-index: 2;
top: 16px;
left: 16px;
right: 16px;
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 14px;
pointer-events: none;
}
.scene-heading {
padding: 12px 14px;
background: rgba(248, 247, 241, 0.9);
border: 1px solid rgba(255,255,255,0.7);
border-radius: 6px;
box-shadow: 0 8px 20px rgba(38,45,40,.08);
backdrop-filter: blur(9px);
}
.scene-heading strong {
display: block;
font-size: 14px;
letter-spacing: -0.015em;
}
.scene-heading span {
display: block;
margin-top: 4px;
color: var(--muted);
font-size: 10px;
}
.view-buttons {
display: flex;
gap: 5px;
padding: 4px;
border-radius: 6px;
background: rgba(248,247,241,.9);
pointer-events: auto;
}
.view-button {
padding: 7px 9px;
border: 0;
border-radius: 4px;
background: transparent;
color: var(--muted);
font-size: 9px;
font-weight: 900;
cursor: pointer;
}
.view-button.active {
background: var(--ink);
color: white;
}
.scene-bottom {
position: absolute;
z-index: 2;
left: 16px;
bottom: 14px;
display: flex;
gap: 8px;
pointer-events: none;
}
.scene-hint,
.scene-tag {
padding: 7px 9px;
border-radius: 4px;
background: rgba(23,33,29,.82);
color: white;
font-size: 9px;
font-weight: 800;
letter-spacing: .06em;
text-transform: uppercase;
}
.scene-tag {
background: rgba(33,109,89,.92);
}
.timeline-panel {
overflow: hidden;
display: flex;
flex-direction: column;
}
.timeline-head {
display: flex;
justify-content: space-between;
align-items: center;
padding: 13px 16px 9px;
}
.timeline-head strong {
display: block;
font-size: 13px;
}
.timeline-head span {
display: block;
margin-top: 3px;
color: var(--muted);
font-size: 10px;
}
.timeline-key {
display: flex;
gap: 13px;
color: var(--muted);
font-size: 9px;
}
.key-item {
display: flex;
align-items: center;
gap: 5px;
}
.key-dot {
width: 7px;
height: 7px;
border-radius: 50%;
background: var(--key);
}
.timeline-scroll {
min-height: 0;
overflow: auto;
padding: 0 16px 14px;
}
.timeline-row {
min-width: 610px;
display: grid;
grid-template-columns: 112px 1fr;
align-items: center;
min-height: 25px;
}
.timeline-label {
padding-right: 10px;
color: var(--muted);
font-size: 9px;
font-weight: 800;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.timeline-label.plan-label {
color: var(--ink);
font-weight: 950;
letter-spacing: .08em;
}
.timeline-track {
position: relative;
height: 18px;
border-left: 1px solid #e0e3dc;
background-image: linear-gradient(to right, transparent 24.8%, rgba(99,110,102,.08) 25%, transparent 25.2%, transparent 49.8%, rgba(99,110,102,.08) 50%, transparent 50.2%, transparent 74.8%, rgba(99,110,102,.08) 75%, transparent 75.2%);
}
.window-range {
position: absolute;
top: 5px;
height: 8px;
border: 1px solid rgba(96,109,101,.22);
border-radius: 2px;
background: rgba(105,119,110,.07);
}
.planned-bar {
position: absolute;
top: 4px;
height: 10px;
border: 1px dashed #a9b0aa;
border-radius: 2px;
opacity: .72;
}
.execution-bar {
position: absolute;
top: 4px;
height: 10px;
min-width: 3px;
border-radius: 2px;
background: var(--bar-color);
box-shadow: inset 0 -2px rgba(0,0,0,.08);
}
.execution-bar.late {
background: repeating-linear-gradient(135deg, var(--bar-color), var(--bar-color) 4px, #b94e40 4px, #b94e40 7px);
}
.arrival-marker {
position: absolute;
z-index: 2;
top: 1px;
width: 0;
height: 0;
transform: translateX(-4px);
border-left: 4px solid transparent;
border-right: 4px solid transparent;
border-top: 6px solid var(--ink);
}
.deadline-marker {
position: absolute;
z-index: 1;
top: 2px;
width: 1px;
height: 14px;
background: rgba(184,66,54,.45);
}
.playhead {
position: absolute;
z-index: 4;
top: -2px;
bottom: -2px;
width: 1px;
background: var(--ink);
pointer-events: none;
}
.playhead::before {
content: "";
position: absolute;
top: -3px;
left: -3px;
width: 7px;
height: 7px;
background: var(--ink);
border-radius: 50%;
}
.reserve-bar {
position: absolute;
top: 5px;
height: 9px;
border-radius: 2px;
background: repeating-linear-gradient(135deg, #d8ebe2, #d8ebe2 4px, #bcdacb 4px, #bcdacb 7px);
border: 1px solid #a7cdbb;
}
.ticks {
display: grid;
grid-template-columns: 112px 1fr;
min-width: 610px;
}
.tick-track {
position: relative;
height: 19px;
color: var(--muted);
font-size: 8px;
font-variant-numeric: tabular-nums;
}
.tick {
position: absolute;
transform: translateX(-50%);
}
.right-panel .section { padding: 17px; }
.plan-summary {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 9px;
margin-top: 13px;
}
.summary-card {
padding: 12px;
border: 1px solid var(--line);
border-radius: 6px;
background: rgba(255,255,255,.7);
}
.summary-card.rigid { border-top: 4px solid var(--red); }
.summary-card.flex { border-top: 4px solid var(--green); }
.summary-card .label {
color: var(--muted);
font-size: 9px;
font-weight: 900;
letter-spacing: .09em;
text-transform: uppercase;
}
.summary-card strong {
display: block;
margin-top: 6px;
font-size: 27px;
letter-spacing: -.05em;
}
.summary-card span {
display: block;
margin-top: 2px;
color: var(--muted);
font-size: 9px;
}
.score-row {
margin-top: 13px;
}
.score-label {
display: flex;
justify-content: space-between;
margin-bottom: 5px;
font-size: 10px;
font-weight: 800;
}
.score-track {
height: 7px;
border-radius: 5px;
background: #e5e7e1;
overflow: hidden;
}
.score-fill {
height: 100%;
width: 25%;
border-radius: inherit;
background: var(--red);
transition: width .3s ease;
}
.score-fill.flex-fill {
width: 100%;
background: var(--green);
}
.comparison {
width: 100%;
margin-top: 14px;
border-collapse: collapse;
font-size: 10px;
}
.comparison th, .comparison td {
padding: 9px 3px;
border-bottom: 1px solid var(--line);
text-align: right;
font-variant-numeric: tabular-nums;
}
.comparison th:first-child,
.comparison td:first-child {
text-align: left;
color: var(--muted);
font-weight: 650;
}
.comparison thead th {
color: var(--muted);
font-size: 8px;
letter-spacing: .09em;
text-transform: uppercase;
}
.comparison .good {
color: var(--green);
font-weight: 900;
}
.comparison .bad {
color: var(--red);
font-weight: 900;
}
.decision-card {
margin-top: 14px;
padding: 14px;
border: 1px solid #bcd6c9;
border-radius: 6px;
background: var(--green-soft);
}
.decision-card .eyebrow { color: var(--green); }
.decision-card h3 {
margin-top: 7px;
font-size: 15px;
letter-spacing: -.02em;
}
.decision-card p {
margin-top: 7px;
color: #4c675d;
font-size: 11px;
line-height: 1.5;
}
.decision-stat {
display: flex;
justify-content: space-between;
margin-top: 12px;
padding-top: 10px;
border-top: 1px solid #bed6ca;
font-size: 10px;
font-weight: 800;
}
.plan-feature {
display: grid;
grid-template-columns: 36px 1fr;
gap: 10px;
margin-top: 13px;
align-items: start;
}
.feature-icon {
width: 36px;
height: 36px;
display: grid;
place-items: center;
border-radius: 5px;
background: #eceee8;
font-size: 16px;
}
.plan-feature strong {
display: block;
font-size: 11px;
}
.plan-feature span {
display: block;
margin-top: 3px;
color: var(--muted);
font-size: 10px;
line-height: 1.4;
}
@media (max-width: 1180px) {
.workspace {
grid-template-columns: 240px minmax(520px, 1fr);
}
.right-panel {
grid-column: 1 / -1;
display: grid;
grid-template-columns: repeat(3, 1fr);
overflow: visible;
}
.right-panel .section { border-bottom: 0; border-right: 1px solid var(--line); }
.right-panel .section:last-child { border-right: 0; }
}
@media (max-width: 800px) {
.topbar {
height: auto;
min-height: 78px;
grid-template-columns: 1fr auto;
padding: 14px;
}
.event-title { display: none; }
.workspace {
display: flex;
flex-direction: column;
padding: 10px;
}
.center-column {
order: 1;
grid-template-rows: 520px 310px;
}
.left-panel { order: 2; }
.right-panel { order: 3; display: block; }
.right-panel .section { border-right: 0; border-bottom: 1px solid var(--line); }
}
@media (max-width: 480px) {
.header-status .live-pill { display: none; }
.scene-heading span { max-width: 230px; }
.view-buttons { flex-direction: column; }
}
</style>
</head>
<body>
<div class="app">
<header class="topbar">
<div class="brand">
<div class="brand-icon" aria-hidden="true"><i></i><i></i><i></i><i></i></div>
<div>
<div class="brand-name">FIELDWORK</div>
<div class="brand-sub">Contingency systems</div>
</div>
</div>
<div class="event-title">
<span class="event-pill">Event 07</span>
<div>
<strong>Luma Field — Summer Sessions</strong>
<span>Doors open 10:00 · 4 delivery windows · 2 operating plans</span>
</div>
</div>
<div class="header-status">
<div class="live-pill"><span class="live-dot"></span> Model live</div>
<div class="clock" id="headerClock">08:38</div>
</div>
</header>
<main class="workspace">
<aside class="panel left-panel">
<section class="section">
<div class="eyebrow">Shared input</div>
<h1 class="section-title">One set of arrivals.<br>Two ways to absorb risk.</h1>
<p class="section-copy">Both plans receive the same trucks at the same minute. Only the buffers, sequencing, and substitute kits differ.</p>
<div class="arrival-list" id="arrivalList"></div>
</section>
<section class="section">
<div class="eyebrow">Uncertainty test</div>
<div class="control-label">
<span>D2 scenic van delay</span>
<span class="control-value" id="delayValue">+0 min</span>
</div>
<input id="delaySlider" type="range" min="0" max="11" value="0" step="1" />
<div class="range-notes"><span>On time</span><span>End of declared window</span></div>
<div class="button-row">
<button class="button primary" id="replayButton">↺ Replay</button>
<button class="button" id="pauseButton">Pause</button>
</div>
<div class="speed-row" aria-label="Playback speed">
<button class="speed-button" data-speed="1">1×</button>
<button class="speed-button active" data-speed="4">4×</button>
<button class="speed-button" data-speed="12">12×</button>
</div>
</section>
<section class="section">
<div class="eyebrow">Reading the model</div>
<div class="legend">
<div class="legend-item"><span class="legend-swatch" style="--swatch:#d95f4d"></span>Plan A · fixed handoffs</div>
<div class="legend-item"><span class="legend-swatch" style="--swatch:#216d59"></span>Plan B · buffered + substitutes</div>
<div class="legend-item"><span class="legend-swatch" style="--swatch:#d89c32"></span>Active delivery</div>
<div class="legend-item"><span class="legend-swatch" style="--swatch:#5376b9"></span>Stage + technical work</div>
<div class="legend-item"><span class="legend-swatch" style="--swatch:#8967ae"></span>Booth build</div>
</div>
</section>
</aside>
<section class="center-column">
<div class="panel scene-panel">
<canvas id="scene" aria-label="Interactive voxel comparison of two event site plans"></canvas>
<div class="scene-top">
<div class="scene-heading">
<strong>Live site comparison</strong>
<span>Voxel operations model · synchronized arrival clock</span>
</div>
<div class="view-buttons">
<button class="view-button" data-focus="-4.15">Plan A</button>
<button class="view-button active" data-focus="0">Both</button>
<button class="view-button" data-focus="4.15">Plan B</button>
</div>
</div>
<div class="scene-bottom">
<div class="scene-tag">Same arrivals</div>
<div class="scene-hint">Drag to orbit · scroll to zoom</div>
</div>
</div>
<div class="panel timeline-panel">
<div class="timeline-head">
<div>
<strong>Shared delivery timeline</strong>
<span>Outlined = committed plan · solid = actual execution</span>
</div>
<div class="timeline-key">
<span class="key-item"><i class="key-dot" style="--key:#17211d"></i>Arrival</span>
<span class="key-item"><i class="key-dot" style="--key:#d95f4d"></i>SLA slip</span>
<span class="key-item"><i class="key-dot" style="--key:#216d59"></i>Reserve</span>
</div>
</div>
<div class="timeline-scroll" id="timeline"></div>
</div>
</section>
<aside class="panel right-panel">
<section class="section">
<div class="eyebrow">Decision view</div>
<h2 class="section-title">Protect the opening,<br>not the paperwork.</h2>
<p class="section-copy">The resilient plan keeps the stage crew protected and uses pre-positioned substitutes when a declared window slips.</p>
<div class="plan-summary">
<div class="summary-card rigid">
<div class="label">Plan A · Rigid</div>
<strong id="rigidScore">25%</strong>
<span id="rigidSummary">1 of 4 tasks on time</span>
</div>
<div class="summary-card flex">
<div class="label">Plan B · Resilient</div>
<strong id="flexScore">100%</strong>
<span id="flexSummary">4 of 4 tasks on time</span>
</div>
</div>
<div class="score-row">
<div class="score-label"><span>Rigid SLA pass</span><span id="rigidPassLabel">1 / 4</span></div>
<div class="score-track"><div class="score-fill" id="rigidFill"></div></div>
</div>
<div class="score-row">
<div class="score-label"><span>Resilient SLA pass</span><span id="flexPassLabel">4 / 4</span></div>
<div class="score-track"><div class="score-fill flex-fill" id="flexFill"></div></div>
</div>
<table class="comparison" aria-label="Plan comparison">
<thead><tr><th>Measure</th><th>Rigid</th><th>Resilient</th></tr></thead>
<tbody>
<tr><td>Ready time</td><td id="rigidReady">10:09</td><td class="good" id="flexReady">10:00</td></tr>
<tr><td>Total slip</td><td class="bad" id="rigidSlip">11 min</td><td class="good" id="flexSlip">0 min</td></tr>
<tr><td>Worst slip</td><td class="bad" id="rigidWorst">+9 min</td><td class="good">0 min</td></tr>
<tr><td>Substitutes</td><td>0</td><td class="good">2</td></tr>
<tr><td>Shared reserve</td><td>0 min</td><td class="good">15 min</td></tr>
</tbody>
</table>
</section>
<section class="section">
<div class="eyebrow">Plan B playbook</div>
<div class="plan-feature">
<div class="feature-icon">◫</div>
<div><strong>15-minute protected reserve</strong><span>Holds the stage crew without consuming it before the critical arrival.</span></div>
</div>
<div class="plan-feature">
<div class="feature-icon">↔</div>
<div><strong>Priority sequence</strong><span>Technical setup is prioritized over general booth work when the yard gets busy.</span></div>
</div>
<div class="plan-feature">
<div class="feature-icon">✦</div>
<div><strong>Two substitute kits</strong><span>Prebuilt scenic panels and a chilled preparation cart remove the longest downstream work.</span></div>
</div>
</section>
<section class="section">
<div class="decision-card">
<div class="eyebrow">Recommended action</div>
<h3 id="decisionTitle">Activate Plan B before the D2 window closes.</h3>
<p id="decisionText">Keep the 15-minute reserve live, switch the scenic delivery to the prebuilt kit, and move booth assembly behind catering.</p>
<div class="decision-stat"><span>Risk absorbed</span><span id="absorbedValue">11 minutes</span></div>
</div>
</section>
</aside>
</main>
</div>
<script type="module">
import * as THREE from "https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
const $ = id => document.getElementById(id);
const clamp = THREE.MathUtils.clamp;
const lerp = THREE.MathUtils.lerp;
const TIMELINE_START = 8 * 60 + 15;
const TIMELINE_END = 10 * 60 + 15;
const TIMELINE_SPAN = TIMELINE_END - TIMELINE_START;
const jobs = [
{
id: "D1",
name: "AV + staging",
window: [510, 540],
actual: 521,
deadline: 560,
color: "#d89c32",
rigidStart: 510,
rigidUnload: 8,
rigidInstall: 14,
flexStart: 510,
flexUnload: 7,
flexInstall: 11,
target: [-1.85, -1.10],
substitute: "Pre-rigged AV flight case"
},
{
id: "D2",
name: "Scenic panels",
window: [525, 555],
actual: 544,
deadline: 568,
color: "#5376b9",
rigidStart: 525,
rigidUnload: 10,
rigidInstall: 15,
flexStart: 530,
flexUnload: 6,
flexInstall: 4,
target: [-0.25, -1.35],
substitute: "Prebuilt scenic kit"
},
{
id: "D3",
name: "Catering",
window: [560, 580],
actual: 571,
deadline: 590,
color: "#df624d",
rigidStart: 560,
rigidUnload: 9,
rigidInstall: 11,
flexStart: 560,
flexUnload: 6,
flexInstall: 7,
target: [2.25, -1.25],
substitute: "Chilled prep cart"
},
{
id: "D4",
name: "Booth build",
window: [575, 600],
actual: 584,
deadline: 600,
color: "#8967ae",
rigidStart: 575,
rigidUnload: 10,
rigidInstall: 15,
flexStart: 575,
flexUnload: 7,
flexInstall: 9,
target: [2.45, 0.20],
substitute: "Stackable booth frames"
}
];
let simMinutes = 518;
let playing = true;
let playbackSpeed = 4;
let d2Delay = 0;
let plans = {};
function formatTime(minutes) {
const rounded = Math.round(minutes);
const h = Math.floor(rounded / 60);
const m = rounded % 60;
return `${String(h).padStart(2, "0")}:${String(m).padStart(2, "0")}`;
}
function timelinePercent(minutes) {
return clamp((minutes - TIMELINE_START) / TIMELINE_SPAN * 100, 0, 100);
}
function buildPlans() {
jobs[1].actual = 544 + d2Delay;
plans = { rigid: [], flex: [] };
for (const job of jobs) {
const rigidStart = Math.max(job.actual, job.rigidStart);
const rigidEnd = rigidStart + job.rigidUnload + job.rigidInstall;
const flexStart = Math.max(job.actual, job.flexStart);
const flexEnd = flexStart + job.flexUnload + job.flexInstall;
plans.rigid.push({
start: rigidStart,
end: rigidEnd,
unloadEnd: rigidStart + job.rigidUnload,
plannedStart: job.rigidStart,
plannedEnd: job.rigidStart + job.rigidUnload + job.rigidInstall,
late: Math.max(0, rigidEnd - job.deadline)
});
plans.flex.push({
start: flexStart,
end: flexEnd,
unloadEnd: flexStart + job.flexUnload,
plannedStart: job.flexStart,
plannedEnd: job.flexStart + job.flexUnload + job.flexInstall,
late: Math.max(0, flexEnd - job.deadline)
});
}
}
function renderArrivals() {
$("arrivalList").innerHTML = jobs.map(job => {
const delayText = job.id === "D2" && d2Delay ? ` (+${d2Delay}m)` : "";
return `
<div class="arrival-row" style="--job-color:${job.color}">
<div class="arrival-top">
<strong>${job.id} · ${job.name}</strong>
<span class="arrival-time">${formatTime(job.actual)}${delayText}</span>
</div>
<div class="arrival-bottom">
<span>Window ${formatTime(job.window[0])}–${formatTime(job.window[1])}</span>
<span class="sync-badge">SYNCED</span>
</div>
</div>
`;
}).join("");
}
function renderTimeline() {
const ticks = [495, 525, 555, 585, 615];
let html = `<div class="ticks"><div></div><div class="tick-track">`;
ticks.forEach(t => {
html += `<span class="tick" style="left:${timelinePercent(t)}%">${formatTime(t)}</span>`;
});
html += `</div></div>`;
html += `<div class="timeline-row">
<div class="timeline-label">15m shared reserve</div>
<div class="timeline-track">
<div class="reserve-bar" style="left:${timelinePercent(525)}%;width:${timelinePercent(540) - timelinePercent(525)}%"></div>
</div>
</div>`;
for (const planName of ["rigid", "flex"]) {
html += `<div class="timeline-row">
<div class="timeline-label plan-label">${planName === "rigid" ? "A · RIGID" : "B · RESILIENT"}</div>
<div class="timeline-track"></div>
</div>`;
jobs.forEach((job, index) => {
const p = plans[planName][index];
const windowLeft = timelinePercent(job.window[0]);
const windowWidth = timelinePercent(job.window[1]) - windowLeft;
const plannedLeft = timelinePercent(p.plannedStart);
const plannedWidth = timelinePercent(p.plannedEnd) - plannedLeft;
const execLeft = timelinePercent(p.start);
const execWidth = Math.max(.8, timelinePercent(p.end) - execLeft);
const deadlineLeft = timelinePercent(job.deadline);
const arrivalLeft = timelinePercent(job.actual);
html += `<div class="timeline-row">
<div class="timeline-label" title="${job.name}">${job.id} · ${job.name}</div>
<div class="timeline-track">
<div class="window-range" style="left:${windowLeft}%;width:${windowWidth}%"></div>
<div class="planned-bar" style="left:${plannedLeft}%;width:${plannedWidth}%"></div>
<div class="deadline-marker" style="left:${deadlineLeft}%"></div>
<div class="execution-bar ${p.late ? "late" : ""}" style="--bar-color:${job.color};left:${execLeft}%;width:${execWidth}%"></div>
<div class="arrival-marker" style="left:${arrivalLeft}%"></div>
<div class="playhead"></div>
</div>
</div>`;
});
}
$("timeline").innerHTML = html;
}
function renderMetrics() {
const rigidOnTime = plans.rigid.filter((p, i) => p.end <= jobs[i].deadline).length;
const flexOnTime = plans.flex.filter((p, i) => p.end <= jobs[i].deadline).length;
const rigidLate = plans.rigid.reduce((sum, p) => sum + p.late, 0);
const flexLate = plans.flex.reduce((sum, p) => sum + p.late, 0);
const rigidWorst = Math.max(...plans.rigid.map(p => p.late));
const rigidReady = Math.max(...plans.rigid.map(p => p.end));
const flexReady = Math.max(...plans.flex.map(p => p.end));
$("rigidScore").textContent = `${rigidOnTime * 25}%`;
$("flexScore").textContent = `${flexOnTime * 25}%`;
$("rigidSummary").textContent = `${rigidOnTime} of 4 tasks on time`;
$("flexSummary").textContent = `${flexOnTime} of 4 tasks on time`;
$("rigidPassLabel").textContent = `${rigidOnTime} / 4`;
$("flexPassLabel").textContent = `${flexOnTime} / 4`;
$("rigidFill").style.width = `${rigidOnTime * 25}%`;
$("flexFill").style.width = `${flexOnTime * 25}%`;
$("rigidReady").textContent = formatTime(rigidReady);
$("flexReady").textContent = formatTime(flexReady);
$("rigidSlip").textContent = `${rigidLate} min`;
$("flexSlip").textContent = `${flexLate} min`;
$("rigidWorst").textContent = `+${rigidWorst} min`;
$("absorbedValue").textContent = `${rigidLate} minutes`;
if (flexOnTime === 4) {
$("decisionTitle").textContent = "Activate Plan B before the D2 window closes.";
$("decisionText").textContent =
"Keep the 15-minute reserve live, switch the scenic delivery to the prebuilt kit, and move booth assembly behind catering.";
} else {
$("decisionTitle").textContent = "Escalate before the final SLA expires.";
$("decisionText").textContent =
"The current delay exceeds the substitute plan's protection. Request a priority unload and release the reserve crew immediately.";
}
}
function updateAllData() {
buildPlans();
renderArrivals();
renderTimeline();
renderMetrics();
}
// ----- Three.js scene -----------------------------------------------------
const canvas = $("scene");
const scene = new THREE.Scene();
scene.background = new THREE.Color(0xe9e6dc);
const renderer = new THREE.WebGLRenderer({ canvas, antialias: true });
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
renderer.outputColorSpace = THREE.SRGBColorSpace;
const camera = new THREE.OrthographicCamera(-10, 10, 8, -8, 0.1, 100);
const cameraTarget = new THREE.Vector3(0, 0.2, 0);
let cameraGoalX = 0;
let yaw = 0.42;
let polar = 0.84;
let zoom = 1;
let dragging = false;
let previousPointer = { x: 0, y: 0 };
const ambient = new THREE.HemisphereLight(0xfff7e7, 0x758177, 2.2);
scene.add(ambient);
const sun = new THREE.DirectionalLight(0xfff5dd, 3.2);
sun.position.set(-8, 16, 10);
sun.castShadow = true;
sun.shadow.mapSize.set(2048, 2048);
sun.shadow.camera.left = -16;
sun.shadow.camera.right = 16;
sun.shadow.camera.top = 12;
sun.shadow.camera.bottom = -12;
sun.shadow.camera.near = 1;
sun.shadow.camera.far = 40;
sun.shadow.bias = -0.0004;
scene.add(sun);
const groundMaterial = new THREE.MeshStandardMaterial({ color: 0xe4e0d5, roughness: 1 });
const ground = new THREE.Mesh(new THREE.BoxGeometry(24, 0.18, 11), groundMaterial);
ground.position.set(0, -0.42, 0);
ground.receiveShadow = true;
scene.add(ground);
function material(color, roughness = 0.88) {
return new THREE.MeshStandardMaterial({ color, roughness, metalness: 0 });
}
function box(parent, w, h, d, color, x, y, z, customMaterial = null) {
const mesh = new THREE.Mesh(
new THREE.BoxGeometry(w, h, d),
customMaterial || material(color)
);
mesh.position.set(x, y, z);
mesh.castShadow = true;
mesh.receiveShadow = true;
parent.add(mesh);
return mesh;
}
function makeLabel(text, background, foreground, width = 2.65) {
const c = document.createElement("canvas");
c.width = 512;
c.height = 112;
const ctx = c.getContext("2d");
ctx.fillStyle = background;
ctx.fillRect(0, 0, c.width, c.height);
ctx.fillStyle = foreground;
ctx.font = "900 38px Arial";
ctx.textAlign = "center";
ctx.textBaseline = "middle";
ctx.fillText(text, 256, 58);
const texture = new THREE.CanvasTexture(c);
texture.colorSpace = THREE.SRGBColorSpace;
const sprite = new THREE.Sprite(new THREE.SpriteMaterial({
map: texture,
depthTest: false,
depthWrite: false
}));
sprite.scale.set(width, width * 112 / 512, 1);
sprite.renderOrder = 20;
return sprite;
}
function addTree(parent, x, z, scale = 1) {
const tree = new THREE.Group();
tree.position.set(x, 0, z);
tree.scale.setScalar(scale);
box(tree, .18, .9, .18, 0x8a6346, 0, .45, 0);
box(tree, .8, .62, .8, 0x678d63, 0, 1.15, 0);
box(tree, .58, .46, .58, 0x7ca06d, .12, 1.62, -.05);
parent.add(tree);
}
function addPerson(parent, x, z, color, scale = 1) {
const person = new THREE.Group();
person.position.set(x, 0, z);
person.scale.setScalar(scale);
box(person, .24, .42, .18, color, 0, .45, 0);
box(person, .25, .25, .23, 0xd9ac88, 0, .78, 0);
box(person, .11, .28, .12, 0x39413c, -.07, .13, 0);
box(person, .11, .28, .12, 0x39413c, .07, .13, 0);
parent.add(person);
}
function addTruck(parent, color) {
const truck = new THREE.Group();
box(truck, 1.65, .65, .72, 0xf1eee2, -.25, .55, 0);
box(truck, .74, .62, .72, color, .75, .48, 0);
box(truck, .1, .34, .58, 0x8db4c2, 1.12, .65, 0);
box(truck, .18, .65, .74, color, .62, .48, 0);
box(truck, 1.45, .12, .75, color, -.25, .88, 0);
const wheelMaterial = material(0x252a28);
for (const x of [-.72, .66]) {
for (const z of [-.39, .39]) {
box(truck, .35, .35, .16, 0x252a28, x, .23, z, wheelMaterial);
}
}
box(truck, .42, .18, .05, 0xf4d875, 1.13, .42, .24);
box(truck, .42, .18, .05, 0xf4d875, 1.13, .42, -.24);
parent.add(truck);
return truck;
}
function addKiosk(parent, x, z, accent) {
const kiosk = new THREE.Group();
kiosk.position.set(x, 0, z);
box(kiosk, 1.18, .16, 1.0, 0xcfbfa5, 0, .12, 0);
box(kiosk, 1.0, .85, .78, 0xf1e8d8, 0, .58, 0);
box(kiosk, 1.12, .16, .9, accent, 0, 1.08, 0);
box(kiosk, .82, .35, .05, 0x5e7470, 0, .68, .405);
box(kiosk, .72, .08, .36, 0xb8aa91, 0, .87, .52);
parent.add(kiosk);
}
function addBooths(parent, x, z, colors) {
const booth = new THREE.Group();
booth.position.set(x, 0, z);
box(booth, 1.35, .12, 1.1, 0xcfc6b3, 0, .08, 0);
box(booth, 1.15, 1.25, .15, colors[0], 0, .72, -.43);
box(booth, .15, 1.25, 1.0, colors[1], -.51, .72, .02);
box(booth, 1.16, .16, 1.0, colors[0], 0, 1.4, .02);
box(booth, .9, .62, .08, 0xebe6dc, 0, .68, -.32);
parent.add(booth);
}
function createSite(x, planName) {
const group = new THREE.Group();
group.position.x = x;
scene.add(group);
const accent = planName === "rigid" ? 0xd95f4d : 0x216d59;
const accentHex = planName === "rigid" ? "#d95f4d" : "#216d59";
box(group, 7.65, .3, 5.25, 0xcfc8b8, 0, -.16, 0);
box(group, 7.25, .08, 1.1, 0x555b57, 0, .03, 1.57);
box(group, 7.25, .07, .48, 0xb7b5aa, 0, .015, .82);
// Loading bay and road markings.
box(group, 1.45, .04, 1.0, planName === "rigid" ? 0xb7a69a : 0x9bb7a7, -2.78, .04, 1.55);
for (let i = 0; i < 5; i++) {
box(group, .28, .025, .055, 0xe6d8a5, -3.28 + i * .29, .075, 2.02);
}
// Main stage.
box(group, 3.35, .42, 1.55, 0x424a46, -1.05, .21, -1.42);
box(group, 3.4, .12, 1.62, planName === "rigid" ? 0xc75548 : 0x29705e, -1.05, .47, -1.42);
box(group, 2.85, 1.55, .16, 0xede7da, -1.05, 1.23, -2.03);
box(group, 2.35, .15, .22, accent, -1.05, 1.92, -1.93);
box(group, .12, 1.7, .12, 0x444b47, -2.47, 1.3, -1.83);
box(group, .12, 1.7, .12, 0x444b47, .37, 1.3, -1.83);
box(group, .42, .75, .35, 0x252b29, -2.38, .9, -1.12);
box(group, .42, .75, .35, 0x252b29, .28, .9, -1.12);
box(group, .55, .16, .42, 0xe4b75b, -1.6, .7, -1.3);
box(group, .55, .16, .42, 0xe4b75b, -.45, .7, -1.3);
// Entrance.
box(group, .16, 1.3, .16, 0x444b47, .55, .65, 1.86);
box(group, .16, 1.3, .16, 0x444b47, 1.65, .65, 1.86);
box(group, 1.3, .16, .16, accent, 1.1, 1.31, 1.86);
box(group, 1.05, .62, .09, 0xf5f0e6, 1.1, .82, 1.86);
for (let i = 0; i < 4; i++) {
box(group, .08, .65, .08, 0x505853, .18 + i * .55, .34, 1.13);
}
addKiosk(group, 2.32, -1.28, accent);
addBooths(group, 2.46, .25, [0x5e7d72, 0xd7a34e]);
addBooths(group, 2.45, -0.55, [0x647995, 0xc77962]);
addTree(group, -3.2, -2.08, .86);
addTree(group, 3.2, -2.08, .78);
addTree(group, 3.23, 1.92, .67);
addTree(group, -3.22, .48, .64);
addPerson(group, .88, 1.28, 0xd95f4d, .72);
addPerson(group, 1.26, 1.32, 0x5376b9, .72);
addPerson(group, 1.62, 1.3, 0xd89c32, .69);
addPerson(group, 2.03, 1.27, 0x8967ae, .72);
addPerson(group, -1.45, .85, 0x39413c, .75);
addPerson(group, -.92, .8, 0x39413c, .75);
// Plan-specific floor markings.
if (planName === "rigid") {
for (const px of [-3.35, -2.15]) {
box(group, .08, .05, .68, 0xd95f4d, px, .08, 1.04);
}
} else {
box(group, 1.3, .035, .72, 0x6ca087, -2.45, .075, .2);
box(group, .4, .06, .42, 0xdcebe4, -1.25, .08, .25);
box(group, .4, .06, .42, 0xdcebe4, -.65, .08, .25);
}
const label = makeLabel(
planName === "rigid" ? "A / FIXED HANDOFFS" : "B / BUFFERED + SUBSTITUTES",
accentHex,
"#ffffff",
planName === "rigid" ? 2.8 : 3.25
);
label.position.set(0, 3.5, -2.25);
group.add(label);
const trucks = [];
const packages = [];
const statuses = [];
const curves = [];
for (const job of jobs) {
const truck = addTruck(group, job.color);
truck.visible = false;
trucks.push(truck);
const pallet = new THREE.Group();
box(pallet, .48, .38, .48, job.color, 0, .22, 0);
box(pallet, .5, .06, .08, 0xf0dfb8, 0, .43, 0);
pallet.visible = false;
group.add(pallet);
packages.push(pallet);
const statusMaterial = material(0xa5ada8);
const status = box(group, .25, .25, .25, 0xa5ada8, job.target[0], .85, job.target[1], statusMaterial);
statuses.push(status);
const start = new THREE.Vector3(-2.78, .32, 1.48);
const mid = new THREE.Vector3(-2.55, .32, job.target[1] + .4);
const end = new THREE.Vector3(job.target[0], .34, job.target[1]);
const curve = new THREE.CatmullRomCurve3([start, mid, end], false, "catmullrom", .1);
curves.push(curve);
const geometry = new THREE.BufferGeometry().setFromPoints(curve.getPoints(32));
const lineMaterial = new THREE.LineBasicMaterial({
color: job.color,
transparent: true,
opacity: planName === "flex" ? .62 : .34
});
const line = new THREE.Line(geometry, lineMaterial);
group.add(line);
}
return { group, trucks, packages, statuses, curves, accent };
}
const rigidSite = createSite(-4.15, "rigid");
const flexSite = createSite(4.15, "flex");
const sites = { rigid: rigidSite, flex: flexSite };
function updateSite(site, planName) {
jobs.forEach((job, index) => {
const p = plans[planName][index];
const truck = site.trucks[index];
const pallet = site.packages[index];
const status = site.statuses[index];
const curve = site.curves[index];
const approachStart = job.actual - 4;
const departure = p.unloadEnd + 3;
if (simMinutes >= approachStart && simMinutes <= departure) {
truck.visible = true;
if (simMinutes < job.actual) {
const u = clamp((simMinutes - approachStart) / 4, 0, 1);
truck.position.set(lerp(-5.65, -2.8, u), .03, 1.58);
} else if (simMinutes <= p.unloadEnd) {
truck.position.set(-2.8, .03, 1.58);
} else {
const u = clamp((simMinutes - p.unloadEnd) / 3, 0, 1);
truck.position.set(lerp(-2.8, -5.7, u), .03, 1.58);
}
} else {
truck.visible = false;
}
if (simMinutes >= job.actual) {
pallet.visible = true;
if (simMinutes <= p.unloadEnd) {
pallet.position.set(-2.78, .07, 1.48);
pallet.rotation.y = 0;
} else if (simMinutes < p.end) {
const u = clamp((simMinutes - p.unloadEnd) / Math.max(1, p.end - p.unloadEnd), 0, 1);
const point = curve.getPoint(u);
pallet.position.copy(point);
pallet.rotation.y = Math.atan2(
curve.getTangent(Math.min(.999, u)).z,
curve.getTangent(Math.min(.999, u)).x
);
} else {
const point = curve.getPoint(1);
pallet.position.copy(point);
}
} else {
pallet.visible = false;
}
let statusColor = 0xa5ada8;
if (simMinutes >= job.actual && simMinutes < p.end) {
statusColor = 0xd89c32;
} else if (simMinutes >= p.end) {
statusColor = p.late > 0 ? 0xd95f4d : 0x2d8a6c;
}
status.material.color.setHex(statusColor);
status.position.y = .85 + Math.sin(simMinutes * 2 + index) * .06;
});
}
function applyCamera() {
const radius = 29;
const sinPolar = Math.sin(polar);
camera.position.set(
cameraTarget.x + radius * sinPolar * Math.sin(yaw),
cameraTarget.y + radius * Math.cos(polar),
cameraTarget.z + radius * sinPolar * Math.cos(yaw)
);
camera.lookAt(cameraTarget);
camera.zoom = zoom;
camera.updateProjectionMatrix();
}
function resizeScene() {
const width = canvas.clientWidth;
const height = canvas.clientHeight;
if (!width || !height) return;
renderer.setSize(width, height, false);
const aspect = width / height;
const viewHeight = Math.max(10.6, 18 / aspect);
camera.left = -viewHeight * aspect / 2;
camera.right = viewHeight * aspect / 2;
camera.top = viewHeight / 2;
camera.bottom = -viewHeight / 2;
camera.updateProjectionMatrix();
applyCamera();
}
new ResizeObserver(resizeScene).observe(canvas);
canvas.addEventListener("pointerdown", event => {
dragging = true;
previousPointer = { x: event.clientX, y: event.clientY };
canvas.setPointerCapture(event.pointerId);
});
canvas.addEventListener("pointermove", event => {
if (!dragging) return;
const dx = event.clientX - previousPointer.x;
const dy = event.clientY - previousPointer.y;
previousPointer = { x: event.clientX, y: event.clientY };
yaw -= dx * .006;
polar = clamp(polar + dy * .004, .52, 1.18);
applyCamera();
});
canvas.addEventListener("pointerup", event => {
dragging = false;
if (canvas.hasPointerCapture(event.pointerId)) canvas.releasePointerCapture(event.pointerId);
});
canvas.addEventListener("pointercancel", () => { dragging = false; });
canvas.addEventListener("wheel", event => {
event.preventDefault();
zoom = clamp(zoom * (event.deltaY > 0 ? .91 : 1.1), .72, 1.75);
applyCamera();
}, { passive: false });
canvas.addEventListener("dblclick", () => {
yaw = .42;
polar = .84;
zoom = 1;
cameraGoalX = 0;
document.querySelectorAll(".view-button").forEach(button => {
button.classList.toggle("active", button.dataset.focus === "0");
});
applyCamera();
});
document.querySelectorAll(".view-button").forEach(button => {
button.addEventListener("click", () => {
cameraGoalX = Number(button.dataset.focus);
document.querySelectorAll(".view-button").forEach(b => b.classList.remove("active"));
button.classList.add("active");
});
});
// ----- Interface controls -------------------------------------------------
$("delaySlider").addEventListener("input", event => {
d2Delay = Number(event.target.value);
$("delayValue").textContent = `+${d2Delay} min`;
updateAllData();
});
$("replayButton").addEventListener("click", () => {
simMinutes = TIMELINE_START;
playing = true;
$("pauseButton").textContent = "Pause";
});
$("pauseButton").addEventListener("click", () => {
playing = !playing;
$("pauseButton").textContent = playing ? "Pause" : "Play";
});
document.querySelectorAll(".speed-button").forEach(button => {
button.addEventListener("click", () => {
playbackSpeed = Number(button.dataset.speed);
document.querySelectorAll(".speed-button").forEach(b => b.classList.remove("active"));
button.classList.add("active");
});
});
let lastFrame = performance.now();
function animate(now) {
const delta = Math.min(.05, (now - lastFrame) / 1000);
lastFrame = now;
if (playing) {
simMinutes += delta * playbackSpeed;
if (simMinutes >= TIMELINE_END) {
simMinutes = TIMELINE_END;
playing = false;
$("pauseButton").textContent = "Replay";
}
}
cameraTarget.x = lerp(cameraTarget.x, cameraGoalX, .08);
applyCamera();
updateSite(rigidSite, "rigid");
updateSite(flexSite, "flex");
const clockText = formatTime(simMinutes);
$("headerClock").textContent = clockText;
document.querySelectorAll(".playhead").forEach(line => {
line.style.left = `${timelinePercent(simMinutes)}%`;
});
renderer.render(scene, camera);
requestAnimationFrame(animate);
}
updateAllData();
resizeScene();
requestAnimationFrame(animate);
</script>
</body>
</html>
```