Prompt specification
Build or customize the Three.js 3D scene "Ceremony preparation dependency puzzle" 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: Ceremony preparation dependency puzzle
Category: Voxel Worlds · Style: Voxel 3D
License: MIT · Reference: https://three3d.app/scene/ceremony-preparation-dependency-puzzle-x3920
Scene Description Prompt:
Create a single self-contained HTML file using Three.js from cdnjs that shows wedding preparations, procession, and seating. Create a fictional event with seating, sound check, flowers, and arrivals as explicit tasks; users coordinate helpers so each prerequisite completes before its dependent scene begins. Voxel style.
Working Three.js Starter (ceremony-preparation-dependency-puzzle-x3920):
```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="#f3ebe0" />
<title>The Alder Wedding — Voxel Wedding Planner</title>
<style>
:root {
--cream: #f6efe5;
--paper: #fffaf2;
--ink: #292631;
--muted: #776e73;
--plum: #6e435f;
--plum-dark: #4e2f47;
--rose: #d77a68;
--sage: #718b76;
--gold: #c79a4b;
--line: #ded1c2;
--shadow: 0 14px 40px rgba(69, 43, 56, 0.12);
}
* { box-sizing: border-box; }
html, body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: var(--cream);
color: var(--ink);
font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
"Segoe UI", sans-serif;
}
button { font: inherit; }
.app-header {
height: 76px;
padding: 0 24px;
display: flex;
align-items: center;
justify-content: space-between;
gap: 18px;
background: rgba(255, 250, 242, 0.96);
border-bottom: 1px solid var(--line);
position: relative;
z-index: 20;
}
.brand {
display: flex;
align-items: center;
gap: 13px;
min-width: 0;
}
.brand-mark {
width: 42px;
height: 42px;
position: relative;
flex: 0 0 auto;
}
.brand-mark span {
position: absolute;
display: block;
width: 19px;
height: 19px;
transform: rotate(30deg) skew(-6deg, -6deg);
}
.brand-mark span:nth-child(1) {
left: 2px; top: 4px;
background: var(--plum);
}
.brand-mark span:nth-child(2) {
right: 2px; top: 4px;
background: var(--rose);
}
.brand-mark span:nth-child(3) {
left: 11px; bottom: 3px;
background: var(--sage);
}
.brand-copy { min-width: 0; }
.brand-copy h1 {
margin: 0;
font-family: Georgia, "Times New Roman", serif;
font-size: 21px;
line-height: 1.1;
font-weight: 600;
letter-spacing: -0.02em;
white-space: nowrap;
}
.brand-copy p {
margin: 4px 0 0;
color: var(--muted);
font-size: 12px;
white-space: nowrap;
}
.header-meta {
margin-left: auto;
display: flex;
align-items: center;
gap: 9px;
}
.meta-chip {
border: 1px solid var(--line);
border-radius: 999px;
padding: 7px 11px;
color: #5e555a;
font-size: 11px;
font-weight: 700;
letter-spacing: 0.06em;
text-transform: uppercase;
white-space: nowrap;
background: #fffdf8;
}
.header-actions {
display: flex;
gap: 8px;
}
.small-button {
border: 1px solid var(--line);
background: #fffdf8;
color: var(--ink);
border-radius: 10px;
min-height: 36px;
padding: 8px 11px;
font-size: 12px;
font-weight: 750;
cursor: pointer;
transition: transform .15s ease, border-color .15s ease, background .15s ease;
}
.small-button:hover {
transform: translateY(-1px);
border-color: #baa999;
background: white;
}
.workspace {
height: calc(100vh - 76px);
display: grid;
grid-template-columns: minmax(0, 1fr) 390px;
}
.viewport {
position: relative;
min-width: 0;
overflow: hidden;
background:
radial-gradient(circle at 50% 20%, rgba(255,255,255,.9), transparent 42%),
#e9e1d7;
}
#scene {
position: absolute;
inset: 0;
}
#scene canvas {
display: block;
width: 100%;
height: 100%;
touch-action: none;
cursor: grab;
}
#scene canvas.dragging { cursor: grabbing; }
.scene-heading {
position: absolute;
top: 22px;
left: 24px;
pointer-events: none;
max-width: min(440px, calc(100% - 230px));
}
.eyebrow {
color: var(--plum);
font-size: 10px;
letter-spacing: .18em;
font-weight: 850;
text-transform: uppercase;
}
.scene-heading h2 {
margin: 6px 0 0;
font-family: Georgia, "Times New Roman", serif;
font-size: clamp(24px, 3vw, 38px);
line-height: 1.04;
font-weight: 500;
letter-spacing: -.025em;
}
.scene-heading p {
margin: 8px 0 0;
color: #746a6c;
font-size: 12px;
line-height: 1.45;
}
.phase-badge {
position: absolute;
right: 22px;
top: 22px;
display: flex;
align-items: center;
gap: 8px;
padding: 10px 13px;
border: 1px solid rgba(110, 67, 95, .18);
border-radius: 999px;
background: rgba(255, 250, 242, .92);
backdrop-filter: blur(10px);
box-shadow: 0 7px 25px rgba(71, 42, 58, .1);
font-size: 10px;
font-weight: 850;
letter-spacing: .1em;
text-transform: uppercase;
pointer-events: none;
}
.phase-dot {
width: 8px;
height: 8px;
border-radius: 50%;
background: var(--rose);
box-shadow: 0 0 0 4px rgba(215, 122, 104, .16);
animation: phasePulse 1.8s ease-in-out infinite;
}
@keyframes phasePulse {
50% { box-shadow: 0 0 0 7px rgba(215, 122, 104, 0); }
}
.story-card {
position: absolute;
left: 22px;
bottom: 22px;
width: min(390px, calc(100% - 130px));
padding: 15px 17px;
border-radius: 15px;
border: 1px solid rgba(110, 67, 95, .13);
background: rgba(255, 250, 242, .92);
backdrop-filter: blur(12px);
box-shadow: var(--shadow);
pointer-events: none;
}
.story-card strong {
display: block;
margin-bottom: 4px;
font-family: Georgia, "Times New Roman", serif;
font-size: 17px;
font-weight: 600;
}
.story-card p {
margin: 0;
color: var(--muted);
font-size: 12px;
line-height: 1.5;
}
.camera-tools {
position: absolute;
right: 20px;
bottom: 20px;
display: flex;
gap: 6px;
padding: 6px;
border: 1px solid rgba(110, 67, 95, .13);
border-radius: 13px;
background: rgba(255, 250, 242, .92);
box-shadow: var(--shadow);
backdrop-filter: blur(12px);
}
.camera-tools button {
border: 0;
background: transparent;
border-radius: 8px;
min-width: 35px;
height: 35px;
color: var(--plum-dark);
cursor: pointer;
font-weight: 800;
font-size: 13px;
}
.camera-tools button:hover { background: #efe4da; }
.scene-legend {
position: absolute;
left: 24px;
top: 119px;
display: flex;
gap: 12px;
flex-wrap: wrap;
max-width: 430px;
pointer-events: none;
}
.legend-item {
display: inline-flex;
align-items: center;
gap: 6px;
color: #6f6569;
font-size: 10px;
font-weight: 700;
}
.legend-swatch {
width: 9px;
height: 9px;
border-radius: 2px;
}
.tooltip {
position: absolute;
z-index: 8;
max-width: 240px;
padding: 9px 11px;
border-radius: 9px;
background: rgba(43, 37, 43, .92);
color: white;
box-shadow: 0 8px 24px rgba(0,0,0,.18);
pointer-events: none;
opacity: 0;
transform: translate(-50%, calc(-100% - 12px));
transition: opacity .12s ease;
font-size: 11px;
line-height: 1.4;
}
.tooltip.visible { opacity: 1; }
.tooltip strong { display: block; font-size: 12px; margin-bottom: 2px; }
.planner-panel {
min-width: 0;
background: var(--paper);
border-left: 1px solid var(--line);
overflow-y: auto;
overscroll-behavior: contain;
scrollbar-width: thin;
scrollbar-color: #cdbbae transparent;
}
.panel-top {
padding: 21px 20px 16px;
border-bottom: 1px solid var(--line);
background:
linear-gradient(135deg, rgba(110,67,95,.06), transparent 55%),
#fffaf2;
}
.panel-top-row {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 12px;
}
.panel-top h2 {
margin: 5px 0 0;
font-family: Georgia, "Times New Roman", serif;
font-size: 23px;
font-weight: 600;
letter-spacing: -.02em;
}
.event-stamp {
width: 44px;
height: 44px;
flex: 0 0 auto;
display: grid;
place-items: center;
border: 1px solid #cbb5a4;
border-radius: 50%;
color: var(--plum);
font-family: Georgia, serif;
font-size: 10px;
line-height: 1.05;
text-align: center;
transform: rotate(5deg);
}
.panel-section {
padding: 18px 20px;
border-bottom: 1px solid var(--line);
}
.section-heading {
display: flex;
align-items: center;
justify-content: space-between;
gap: 10px;
margin-bottom: 12px;
}
.section-heading h3 {
margin: 0;
font-size: 11px;
letter-spacing: .13em;
text-transform: uppercase;
font-weight: 850;
}
.section-heading span {
color: var(--muted);
font-size: 10px;
}
.helper-list {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 8px;
}
.helper-card {
min-width: 0;
min-height: 55px;
padding: 9px 10px;
display: grid;
grid-template-columns: 27px minmax(0, 1fr);
gap: 8px;
align-items: center;
border: 1px solid var(--line);
border-radius: 11px;
background: #fffdf8;
color: var(--ink);
text-align: left;
cursor: pointer;
transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.helper-card:hover {
transform: translateY(-1px);
border-color: #bda99b;
}
.helper-card.active {
border-color: var(--plum);
box-shadow: 0 0 0 2px rgba(110, 67, 95, .1);
background: #fff;
}
.helper-card.busy { opacity: .68; }
.helper-avatar {
width: 27px;
height: 27px;
display: grid;
place-items: center;
border-radius: 7px;
color: white;
font-size: 11px;
font-weight: 900;
box-shadow: inset 0 -3px 0 rgba(0,0,0,.12);
}
.helper-name {
display: block;
font-size: 11px;
font-weight: 800;
line-height: 1.15;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.helper-role {
display: block;
margin-top: 2px;
color: var(--muted);
font-size: 9px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.instruction {
margin: 10px 0 0;
color: var(--muted);
font-size: 10px;
line-height: 1.45;
}
.task-list {
display: flex;
flex-direction: column;
gap: 10px;
}
.task-card {
position: relative;
padding: 13px 13px 12px;
border: 1px solid var(--line);
border-radius: 13px;
background: #fffdf9;
overflow: hidden;
transition: border-color .15s ease, box-shadow .15s ease;
}
.task-card.working {
border-color: rgba(110, 67, 95, .55);
box-shadow: 0 0 0 2px rgba(110, 67, 95, .07);
}
.task-card.done {
background: #f5f8f2;
border-color: #b9c8b6;
}
.task-card.blocked {
background:
repeating-linear-gradient(-45deg, rgba(110,67,95,.018), rgba(110,67,95,.018) 7px, transparent 7px, transparent 14px),
#fbf7f1;
}
.task-top {
display: grid;
grid-template-columns: 30px minmax(0, 1fr) auto;
align-items: start;
gap: 9px;
}
.task-number {
width: 30px;
height: 30px;
display: grid;
place-items: center;
border-radius: 8px;
background: #eee3d8;
color: var(--plum-dark);
font-size: 11px;
font-weight: 900;
}
.task-card.done .task-number {
background: var(--sage);
color: white;
}
.task-title {
margin: 1px 0 0;
font-size: 12px;
line-height: 1.2;
font-weight: 850;
}
.task-subtitle {
display: block;
margin-top: 4px;
color: var(--muted);
font-size: 9px;
line-height: 1.35;
}
.task-status {
border-radius: 999px;
padding: 5px 7px;
font-size: 8px;
font-weight: 900;
letter-spacing: .08em;
text-transform: uppercase;
white-space: nowrap;
background: #eee6dc;
color: #766d6d;
}
.task-status.ready { background: #eee5f1; color: var(--plum); }
.task-status.working { background: #f8e5dc; color: #a65243; }
.task-status.done { background: #dfeadf; color: #4d7055; }
.task-status.blocked { background: #e8e4df; color: #817a76; }
.dependencies {
margin: 10px 0 9px 39px;
display: flex;
flex-wrap: wrap;
gap: 5px;
}
.dependency {
display: inline-flex;
align-items: center;
gap: 4px;
border-radius: 6px;
padding: 4px 6px;
background: #f0ebe4;
color: #8b8380;
font-size: 8px;
font-weight: 750;
}
.dependency.met {
color: #52725a;
background: #e7efe5;
}
.dependency.pending {
color: #8c6a5d;
background: #f5e8e1;
}
.task-bottom {
display: flex;
align-items: center;
gap: 9px;
margin-left: 39px;
}
.assigned-helper {
min-width: 0;
flex: 1;
color: var(--muted);
font-size: 9px;
line-height: 1.2;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.assigned-helper strong { color: var(--ink); }
.task-action {
border: 0;
border-radius: 8px;
padding: 7px 9px;
min-width: 82px;
background: var(--plum);
color: white;
font-size: 9px;
font-weight: 850;
cursor: pointer;
transition: transform .15s ease, background .15s ease;
}
.task-action:hover:not(:disabled) {
transform: translateY(-1px);
background: var(--plum-dark);
}
.task-action:disabled {
cursor: default;
opacity: .48;
background: #aaa09a;
}
.task-card.done .task-action {
color: #52725a;
background: #dfeadf;
opacity: 1;
}
.progress-track {
height: 4px;
margin: 10px 0 0 39px;
border-radius: 999px;
overflow: hidden;
background: #e8dfd5;
}
.progress-fill {
width: 0;
height: 100%;
border-radius: inherit;
background: linear-gradient(90deg, var(--rose), var(--gold));
transition: width .1s linear;
}
.rule-note {
padding: 15px 20px 24px;
color: var(--muted);
font-size: 10px;
line-height: 1.5;
}
.rule-note strong { color: var(--plum-dark); }
.toast {
position: fixed;
left: 50%;
top: 90px;
z-index: 50;
max-width: min(480px, calc(100% - 30px));
padding: 11px 15px;
border-radius: 11px;
background: rgba(48, 38, 45, .94);
color: white;
box-shadow: 0 12px 35px rgba(0,0,0,.2);
transform: translate(-50%, -12px);
opacity: 0;
pointer-events: none;
transition: opacity .2s ease, transform .2s ease;
font-size: 11px;
font-weight: 650;
text-align: center;
}
.toast.show {
opacity: 1;
transform: translate(-50%, 0);
}
.loading {
position: absolute;
inset: 0;
z-index: 12;
display: grid;
place-items: center;
background: #e9e1d7;
color: var(--plum);
font-family: Georgia, serif;
font-size: 20px;
transition: opacity .35s ease;
}
.loading.hidden { opacity: 0; pointer-events: none; }
@media (max-width: 900px) {
.meta-chip { display: none; }
.workspace { grid-template-columns: minmax(0, 1fr) 340px; }
.scene-heading p { display: none; }
.scene-legend { display: none; }
}
@media (max-width: 700px) {
html, body { overflow: auto; }
.app-header {
height: 66px;
padding: 0 13px;
}
.brand-copy h1 { font-size: 17px; }
.brand-copy p { font-size: 9px; }
.brand-mark { transform: scale(.85); transform-origin: left center; }
.header-actions .small-button:first-child { display: none; }
.workspace {
height: auto;
min-height: calc(100vh - 66px);
display: flex;
flex-direction: column;
}
.viewport { height: 58vh; min-height: 430px; }
.planner-panel { overflow: visible; border-left: 0; border-top: 1px solid var(--line); }
.scene-heading { top: 17px; left: 17px; max-width: 65%; }
.scene-heading h2 { font-size: 25px; }
.phase-badge { right: 13px; top: 16px; padding: 8px 9px; font-size: 8px; }
.story-card { left: 13px; bottom: 13px; width: calc(100% - 88px); padding: 12px; }
.story-card strong { font-size: 14px; }
.story-card p { font-size: 10px; }
.camera-tools { right: 11px; bottom: 11px; flex-direction: column; }
.helper-list { grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) {
*, *::before, *::after {
animation-duration: .001ms !important;
animation-iteration-count: 1 !important;
transition-duration: .001ms !important;
}
}
</style>
</head>
<body>
<header class="app-header">
<div class="brand">
<div class="brand-mark" aria-hidden="true">
<span></span><span></span><span></span>
</div>
<div class="brand-copy">
<h1>The Alder Wedding</h1>
<p>Mara & Ellis · Saturday at 4:00 PM</p>
</div>
</div>
<div class="header-meta">
<span class="meta-chip">48 guests</span>
<span class="meta-chip">Alder courtyard</span>
<span class="meta-chip">5 helpers</span>
</div>
<div class="header-actions">
<button class="small-button" id="speedButton" title="Change simulation speed">1× speed</button>
<button class="small-button" id="resetButton">Reset day</button>
</div>
</header>
<main class="workspace">
<section class="viewport" id="viewport" aria-label="Interactive voxel wedding venue">
<div id="scene"></div>
<div class="loading" id="loading">Preparing the courtyard…</div>
<div class="scene-heading">
<div class="eyebrow">A fictional wedding, one task at a time</div>
<h2>Every detail,<br />in its right place.</h2>
<p>Select a helper, assign a task, then start the scene. Prerequisites open each new moment.</p>
</div>
<div class="phase-badge">
<span class="phase-dot"></span>
<span id="phaseLabel">Venue preparation</span>
</div>
<div class="scene-legend">
<span class="legend-item"><i class="legend-swatch" style="background:#718b76"></i>Helper</span>
<span class="legend-item"><i class="legend-swatch" style="background:#d77a68"></i>Active task</span>
<span class="legend-item"><i class="legend-swatch" style="background:#c7b9a8"></i>Locked scene</span>
</div>
<div class="story-card">
<strong id="storyTitle">Open the courtyard</strong>
<p id="storyText">Sound and flowers can begin together. The next scene waits for both.</p>
</div>
<div class="camera-tools" aria-label="Camera controls">
<button data-camera="reset" title="Reset camera" aria-label="Reset camera">⌂</button>
<button data-camera="in" title="Zoom in" aria-label="Zoom in">+</button>
<button data-camera="out" title="Zoom out" aria-label="Zoom out">−</button>
</div>
<div class="tooltip" id="tooltip"></div>
</section>
<aside class="planner-panel" aria-label="Wedding task planner">
<div class="panel-top">
<div class="panel-top-row">
<div>
<div class="eyebrow">Day-of coordinator</div>
<h2>Run of show</h2>
</div>
<div class="event-stamp">MA<br />&<br />EL</div>
</div>
</div>
<section class="panel-section">
<div class="section-heading">
<h3>Helper roster</h3>
<span id="activeHelperLabel">Active: Theo</span>
</div>
<div class="helper-list" id="helperList"></div>
<p class="instruction">Choose a helper here or click their voxel figure in the courtyard. Assign first, then start.</p>
</section>
<section class="panel-section">
<div class="section-heading">
<h3>Explicit tasks</h3>
<span>Prerequisites required</span>
</div>
<div class="task-list" id="taskList"></div>
</section>
<div class="rule-note">
<strong>Dependency rule:</strong> a dependent scene cannot begin until every linked task is complete.
Helpers may be assigned in advance, but the scene remains locked until its prerequisites are satisfied.
</div>
</aside>
</main>
<div class="toast" id="toast" role="status" aria-live="polite"></div>
<script type="module">
import * as THREE from 'https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js';
const $ = (selector) => document.querySelector(selector);
const helperDefinitions = [
{ id: 'theo', name: 'Theo', role: 'Audio tech', color: 0x5c6fd5, shirt: 0x596ac9, home: [-10, 8.8], skin: 0xc98f6b },
{ id: 'jules', name: 'Jules', role: 'Florist', color: 0xd56f78, shirt: 0xc96270, home: [-6.5, 10.2], skin: 0x8d563e },
{ id: 'noor', name: 'Noor', role: 'Guest liaison', color: 0x5f9b8b, shirt: 0x4f8e7d, home: [-2.3, 10.6], skin: 0xb97855 },
{ id: 'lina', name: 'Lina', role: 'Wedding party', color: 0xb48a3e, shirt: 0xb28435, home: [2.4, 10.6], skin: 0xe1ad84 },
{ id: 'mara', name: 'Mara', role: 'Lead usher', color: 0x9b69b2, shirt: 0x8f5ca7, home: [6.6, 10.1], skin: 0x6f4334 }
];
const taskDefinitions = [
{
id: 'sound',
number: '01',
title: 'Sound check',
subtitle: 'Balance the ceremony speaker and play the processional cue.',
deps: [],
duration: 4.8,
target: new THREE.Vector3(-6.2, 0, -4.6),
scene: 'sound',
outcome: 'The speaker, playlist, and microphone are ready.'
},
{
id: 'flowers',
number: '02',
title: 'Place the flowers',
subtitle: 'Dress the arch, aisle posts, and welcome bar in blush blooms.',
deps: [],
duration: 5.8,
target: new THREE.Vector3(6.1, 0, -2.9),
scene: 'flowers',
outcome: 'The floral aisle is complete and photo-ready.'
},
{
id: 'arrivals',
number: '03',
title: 'Guest arrivals',
subtitle: 'Greet the first guests and guide them to the courtyard.',
deps: ['sound', 'flowers'],
duration: 7.0,
target: new THREE.Vector3(-1.2, 0, 8.8),
scene: 'arrivals',
outcome: 'All forty-eight guests have arrived.'
},
{
id: 'procession',
number: '04',
title: 'The procession',
subtitle: 'Escort Mara and Ellis down the aisle when the music begins.',
deps: ['sound', 'flowers', 'arrivals'],
duration: 6.7,
target: new THREE.Vector3(-1.15, 0, 2),
scene: 'procession',
outcome: 'The couple has reached the altar.'
},
{
id: 'seating',
number: '05',
title: 'Seat the ceremony',
subtitle: 'Guide the remaining guests into their reserved places.',
deps: ['procession'],
duration: 5.6,
target: new THREE.Vector3(4.9, 0, 4.5),
scene: 'seating',
outcome: 'Every guest is seated and the ceremony can begin.'
}
];
const helpers = helperDefinitions.map(h => ({
...h,
taskId: null,
group: null,
arms: [],
target: new THREE.Vector3(h.home[0], 0, h.home[1])
}));
const tasks = taskDefinitions.map(t => ({
...t,
status: 'available',
assignedHelper: null,
progress: 0
}));
const helperById = Object.fromEntries(helpers.map(h => [h.id, h]));
const taskById = Object.fromEntries(tasks.map(t => [t.id, t]));
let activeHelperId = 'theo';
let simulationSpeed = 1;
let toastTimer = 0;
const viewport = $('#viewport');
const sceneHost = $('#scene');
const tooltip = $('#tooltip');
let renderer;
try {
renderer = new THREE.WebGLRenderer({ antialias: true, alpha: false });
} catch (error) {
$('#loading').textContent = 'This browser could not start the 3D venue.';
throw error;
}
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1.12;
sceneHost.appendChild(renderer.domElement);
const scene = new THREE.Scene();
scene.background = new THREE.Color(0xe9e1d7);
scene.fog = new THREE.Fog(0xe9e1d7, 38, 68);
const camera = new THREE.OrthographicCamera(-18, 18, 12, -12, 0.1, 100);
const cameraTarget = new THREE.Vector3(0, 1.2, 0);
const cameraState = { yaw: 0.64, pitch: 0.76, zoom: 1 };
const ambient = new THREE.HemisphereLight(0xfff5e8, 0x8f8790, 2.15);
scene.add(ambient);
const sunlight = new THREE.DirectionalLight(0xffe4c4, 3.4);
sunlight.position.set(-12, 22, 10);
sunlight.castShadow = true;
sunlight.shadow.mapSize.set(2048, 2048);
sunlight.shadow.camera.left = -22;
sunlight.shadow.camera.right = 22;
sunlight.shadow.camera.top = 22;
sunlight.shadow.camera.bottom = -22;
sunlight.shadow.camera.near = 1;
sunlight.shadow.camera.far = 55;
sunlight.shadow.bias = -0.0007;
scene.add(sunlight);
const fillLight = new THREE.DirectionalLight(0xcbd6ff, 1.1);
fillLight.position.set(15, 10, -12);
scene.add(fillLight);
const materialCache = new Map();
function material(color) {
if (!materialCache.has(color)) {
materialCache.set(color, new THREE.MeshStandardMaterial({
color,
roughness: 0.88,
metalness: 0.02
}));
}
return materialCache.get(color);
}
function addBox(parent, width, height, depth, color, x = 0, y = 0, z = 0) {
const mesh = new THREE.Mesh(
new THREE.BoxGeometry(width, height, depth),
material(color)
);
mesh.position.set(x, y, z);
mesh.castShadow = true;
mesh.receiveShadow = true;
parent.add(mesh);
return mesh;
}
function roundedRect(ctx, x, y, width, height, radius) {
const r = Math.min(radius, width / 2, height / 2);
ctx.beginPath();
ctx.moveTo(x + r, y);
ctx.lineTo(x + width - r, y);
ctx.quadraticCurveTo(x + width, y, x + width, y + r);
ctx.lineTo(x + width, y + height - r);
ctx.quadraticCurveTo(x + width, y + height, x + width - r, y + height);
ctx.lineTo(x + r, y + height);
ctx.quadraticCurveTo(x, y + height, x, y + height - r);
ctx.lineTo(x, y + r);
ctx.quadraticCurveTo(x, y, x + r, y);
ctx.closePath();
}
function createTextSprite(text, options = {}) {
const canvas = document.createElement('canvas');
canvas.width = options.width || 512;
canvas.height = options.height || 112;
const ctx = canvas.getContext('2d');
const bg = options.background || 'rgba(255,250,242,.95)';
const fg = options.color || '#4e2f47';
ctx.clearRect(0, 0, canvas.width, canvas.height);
roundedRect(ctx, 3, 3, canvas.width - 6, canvas.height - 6, 20);
ctx.fillStyle = bg;
ctx.fill();
ctx.strokeStyle = options.border || 'rgba(78,47,71,.16)';
ctx.lineWidth = 4;
ctx.stroke();
ctx.fillStyle = fg;
ctx.font = `700 ${options.fontSize || 35}px system-ui, sans-serif`;
ctx.textAlign = 'center';
ctx.textBaseline = 'middle';
ctx.fillText(text, canvas.width / 2, canvas.height / 2 + 1);
const texture = new THREE.CanvasTexture(canvas);
texture.colorSpace = THREE.SRGBColorSpace;
texture.minFilter = THREE.LinearFilter;
const material = new THREE.SpriteMaterial({
map: texture,
transparent: true,
depthTest: false,
depthWrite: false
});
const sprite = new THREE.Sprite(material);
sprite.scale.set(options.scaleX || 4.8, options.scaleY || 1.05, 1);
sprite.renderOrder = 8;
return sprite;
}
function createPerson({
x = 0,
z = 0,
shirt = 0x5367d9,
skin = 0xd69a76,
hair = 0x49372f,
scale = 1,
label = null,
bride = false,
groom = false
} = {}) {
const group = new THREE.Group();
group.position.set(x, 0, z);
group.scale.setScalar(scale);
addBox(group, 0.46, 0.68, 0.34, shirt, 0, 0.92, 0);
addBox(group, 0.44, 0.43, 0.42, skin, 0, 1.48, 0.01);
addBox(group, 0.47, 0.12, 0.44, hair, 0, 1.72, -0.01);
const leftLeg = addBox(group, 0.17, 0.53, 0.22, 0x3f4350, -0.13, 0.32, 0);
const rightLeg = addBox(group, 0.17, 0.53, 0.22, 0x3f4350, 0.13, 0.32, 0);
leftLeg.castShadow = rightLeg.castShadow = true;
const leftArm = addBox(group, 0.15, 0.59, 0.18, shirt, -0.32, 0.94, 0);
const rightArm = addBox(group, 0.15, 0.59, 0.18, shirt, 0.32, 0.94, 0);
leftArm.castShadow = rightArm.castShadow = true;
if (bride) {
addBox(group, 0.68, 0.64, 0.48, 0xf8f2e9, 0, 0.54, 0);
addBox(group, 0.86, 0.18, 0.62, 0xfffaf3, 0, 0.25, 0);
addBox(group, 0.50, 0.48, 0.08, 0xf4eee7, 0, 1.42, -0.25);
addBox(group, 0.16, 0.13, 0.16, 0xd8757b, 0.34, 0.92, 0.28);
addBox(group, 0.13, 0.12, 0.13, 0xe6a06f, 0.26, 0.98, 0.28);
addBox(group, 0.12, 0.11, 0.12, 0xf1c875, 0.42, 0.92, 0.28);
}
if (groom) {
addBox(group, 0.52, 0.30, 0.37, 0xf6f0e8, 0, 1.22, 0);
addBox(group, 0.12, 0.22, 0.10, 0xd56b72, 0, 1.25, 0.21);
addBox(group, 0.14, 0.58, 0.17, shirt, -0.33, 0.91, 0);
addBox(group, 0.14, 0.58, 0.17, shirt, 0.33, 0.91, 0);
}
if (label) {
const tag = createTextSprite(label, {
width: 256,
height: 72,
fontSize: 30,
scaleX: 1.5,
scaleY: 0.42,
background: 'rgba(255,250,242,.96)'
});
tag.position.set(0, 2.3, 0);
group.add(tag);
}
group.userData.arms = [leftArm, rightArm];
return group;
}
const world = new THREE.Group();
scene.add(world);
// Courtyard foundation and tiled border.
addBox(world, 31, 0.5, 24, 0xb8a89b, 0, -0.3, 0);
addBox(world, 28.5, 0.12, 21.5, 0xd9c9b8, 0, -0.02, 0);
addBox(world, 9.4, 0.82, 4.2, 0x73564b, 0, 0.38, -7.1);
addBox(world, 9.7, 0.13, 4.5, 0x9c7760, 0, 0.83, -7.1);
// Aisle runner.
addBox(world, 3.05, 0.09, 15.3, 0xa95863, 0, 0.09, 1.0);
addBox(world, 2.7, 0.03, 15.0, 0xc77a7f, 0, 0.145, 1.0);
// Tile seams.
for (let x = -12; x <= 12; x += 3) {
addBox(world, 0.025, 0.018, 20.6, 0xc5b4a6, x, 0.055, 0);
}
for (let z = -9; z <= 9; z += 3) {
addBox(world, 27.4, 0.018, 0.025, 0xc5b4a6, 0, 0.055, z);
}
// Ceremony arch structure.
addBox(world, 0.45, 4.9, 0.45, 0xf1dfcf, -2.7, 2.55, -5.5);
addBox(world, 0.45, 4.9, 0.45, 0xf1dfcf, 2.7, 2.55, -5.5);
addBox(world, 5.85, 0.42, 0.48, 0xf1dfcf, 0, 4.85, -5.5);
addBox(world, 6.5, 0.16, 0.18, 0xd7b99e, 0, 5.18, -5.45);
// Arch sign.
const altarSign = createTextSprite('MARA + ELLIS', {
width: 512,
height: 96,
fontSize: 32,
scaleX: 4.3,
scaleY: 0.72,
color: '#684659'
});
altarSign.position.set(0, 4.3, -5.2);
world.add(altarSign);
// Sound station.
const soundGroup = new THREE.Group();
world.add(soundGroup);
addBox(soundGroup, 1.7, 1.05, 1.15, 0x3d414b, -6.1, 0.53, -4.8);
addBox(soundGroup, 1.45, 0.09, 0.92, 0x23262d, -6.1, 1.1, -4.8);
for (let i = 0; i < 4; i++) {
addBox(soundGroup, 0.18, 0.08, 0.18, 0xb0a5a0, -6.65 + i * 0.36, 1.18, -4.52);
}
addBox(soundGroup, 0.85, 1.65, 0.72, 0x30343b, -7.6, 0.83, -5.4);
addBox(soundGroup, 0.58, 0.58, 0.08, 0x11151a, -7.6, 1.12, -5.0);
addBox(soundGroup, 0.85, 1.65, 0.72, 0x30343b, -4.65, 0.83, -5.4);
addBox(soundGroup, 0.58, 0.58, 0.08, 0x11151a, -4.65, 1.12, -5.0);
const soundBars = [];
for (let i = 0; i < 7; i++) {
const bar = addBox(soundGroup, 0.12, 0.45 + (i % 3) * 0.16, 0.12, 0xd77a68, -6.52 + i * 0.22, 1.35, -4.77);
soundBars.push(bar);
}
const soundSign = createTextSprite('SOUND', {
width: 256, height: 72, fontSize: 31, scaleX: 2.0, scaleY: 0.52
});
soundSign.position.set(-6.15, 2.25, -5.1);
world.add(soundSign);
// Floral work station.
const flowerCart = new THREE.Group();
world.add(flowerCart);
addBox(flowerCart, 2.2, 0.72, 1.25, 0x8d6a58, 6.0, 0.37, -3.0);
addBox(flowerCart, 2.35, 0.12, 1.4, 0xb88872, 6.0, 0.79, -3.0);
for (const x of [5.15, 6.85]) {
addBox(flowerCart, 0.17, 0.4, 1.1, 0x554f50, x, 0.16, -3.0);
}
addBox(flowerCart, 0.64, 0.52, 0.64, 0x9aab80, 5.35, 1.11, -3.0);
addBox(flowerCart, 0.57, 0.48, 0.57, 0xd8898a, 6.55, 1.07, -2.95);
const flowerSign = createTextSprite('FLORALS', {
width: 256, height: 72, fontSize: 30, scaleX: 2.0, scaleY: 0.52
});
flowerSign.position.set(6.0, 2.15, -3.0);
world.add(flowerSign);
// Floral decorations, animated from hidden to complete.
const flowersDecor = new THREE.Group();
scene.add(flowersDecor);
const blossoms = [];
function addBlossom(parent, x, y, z, color, size = 0.26, delay = 0) {
const bloom = new THREE.Group();
bloom.position.set(x, y, z);
addBox(bloom, size, size, size, color, 0, 0, 0);
addBox(bloom, size * 0.58, size * 0.58, size * 0.58, 0xf2cf83, 0, 0, 0);
bloom.userData.bloom = true;
bloom.userData.delay = delay;
bloom.userData.targetScale = 1;
bloom.scale.setScalar(0.001);
parent.add(bloom);
blossoms.push(bloom);
return bloom;
}
for (let i = 0; i < 14; i++) {
const t = i / 13;
const x = -2.55 + t * 5.1;
const y = 4.56 + Math.sin(t * Math.PI * 4) * 0.18;
addBlossom(flowersDecor, x, y, -5.15, i % 2 ? 0xd67c7e : 0xe5a09b, 0.32, i * 0.018);
if (i % 2 === 0) addBlossom(flowersDecor, x, 4.85, -5.12, 0x748d72, 0.38, i * 0.018);
}
for (let i = 0; i < 8; i++) {
const y = 0.65 + i * 0.49;
addBlossom(flowersDecor, -2.42, y, -5.08, i % 2 ? 0xd98687 : 0xe3a09a, 0.30, i * 0.022);
addBlossom(flowersDecor, 2.42, y, -5.08, i % 2 ? 0xd98687 : 0xe3a09a, 0.30, i * 0.022);
}
for (const x of [-1.48, 1.48]) {
addBox(flowersDecor, 0.18, 1.15, 0.18, 0x775d4c, x, 0.7, 6.6);
addBox(flowersDecor, 0.58, 0.32, 0.58, 0x7f9875, x, 1.32, 6.6);
for (let j = 0; j < 4; j++) {
addBlossom(flowersDecor, x + (j % 2 ? .18 : -.18), 1.48 + (j > 1 ? .15 : 0), 6.6, j % 2 ? 0xd77a79 : 0xe7a29b, .27, j * .03);
}
}
// Reception tables.
function createTable(x, z, clothColor, flowerColor) {
const table = new THREE.Group();
world.add(table);
addBox(table, 2.65, 0.22, 1.55, clothColor, x, 1.03, z);
for (const dx of [-1.05, 1.05]) {
for (const dz of [-0.55, 0.55]) {
addBox(table, 0.12, 0.92, 0.12, 0x65594f, x + dx, 0.5, z + dz);
}
}
addBox(table, 0.45, 0.42, 0.45, 0x7f9875, x, 1.34, z);
addBox(table, 0.32, 0.30, 0.32, flowerColor, x, 1.67, z);
addBox(table, 0.20, 0.20, 0.20, 0xf0c878, x + .14, 1.63, z + .08);
}
createTable(-9.1, -1.5, 0xe4d2bf, 0xd77b80);
createTable(9.2, -1.3, 0xc7d1bb, 0xe5a18f);
createTable(-9.2, 4.7, 0xc5d2bd, 0xd57c79);
createTable(9.1, 4.8, 0xe0cdbd, 0xdc8f91);
// Ceremony chairs and seat destinations.
const seatPositions = [];
for (let row = 0; row < 5; row++) {
const z = -3.05 + row * 2.3;
for (const side of [-1, 1]) {
for (let col = 0; col < 3; col++) {
const x = side * (2.35 + col * 1.08);
const chair = new THREE.Group();
chair.position.set(x, 0, z);
addBox(chair, 0.72, 0.12, 0.72, 0x8d7568, 0, 0.67, 0);
addBox(chair, 0.72, 0.72, 0.12, 0x9c8070, 0, 1.06, -0.3);
for (const dx of [-0.26, 0.26]) {
for (const dz of [-0.24, 0.24]) {
addBox(chair, 0.08, 0.62, 0.08, 0x66574f, dx, 0.35, dz);
}
}
world.add(chair);
seatPositions.push(new THREE.Vector3(x, 0, z + 0.08));
}
}
}
// Arrival gate.
addBox(world, 0.28, 3.4, 0.28, 0x7a675a, -3.7, 1.7, 9.1);
addBox(world, 0.28, 3.4, 0.28, 0x7a675a, 3.7, 1.7, 9.1);
addBox(world, 7.7, 0.28, 0.28, 0x7a675a, 0, 3.3, 9.1);
const welcomeSign = createTextSprite('WELCOME', {
width: 384, height: 82, fontSize: 34, scaleX: 3.5, scaleY: 0.7
});
welcomeSign.position.set(0, 3.1, 9.28);
world.add(welcomeSign);
// Trees and perimeter blocks.
function createTree(x, z, size = 1) {
const tree = new THREE.Group();
tree.position.set(x, 0, z);
tree.scale.setScalar(size);
addBox(tree, 0.55, 2.7, 0.55, 0x795542, 0, 1.35, 0);
addBox(tree, 2.25, 1.65, 2.1, 0x74896e, 0, 3.0, 0);
addBox(tree, 1.55, 1.25, 1.55, 0x85997b, -0.2, 3.9, 0.05);
addBox(tree, 1.0, 0.8, 1.0, 0x96a886, 0.55, 3.45, -0.2);
world.add(tree);
}
createTree(-13.2, -7.6, 1.05);
createTree(13.0, -7.3, 1.0);
createTree(-13.4, 6.4, .95);
createTree(13.3, 6.2, 1.05);
for (const x of [-12, -9, 9, 12]) {
addBox(world, 1.45, 0.55, 1.45, 0xa58b77, x, 0.25, -10);
}
// Fairy-light posts.
for (const x of [-8, -4, 4, 8]) {
addBox(world, 0.13, 2.5, 0.13, 0x78695f, x, 1.25, 8.9);
addBox(world, 0.30, 0.30, 0.30, 0xf3ce82, x, 2.55, 8.9);
}
// Guest arrival scene.
const arrivalGroup = new THREE.Group();
arrivalGroup.visible = false;
scene.add(arrivalGroup);
const arrivalGuests = [];
const guestPalette = [0x557e9a, 0xb85f68, 0x768f69, 0xc79548, 0x75639a, 0x4e9a91];
for (let i = 0; i < 14; i++) {
const side = i % 2 ? 1 : -1;
const start = new THREE.Vector3(side * (1.2 + (i % 4) * .35), 0, 10.4 + (i % 3) * .38);
const target = new THREE.Vector3(side * (7.2 + (i % 3) * .7), 0, 7.0 - Math.floor(i / 2) * 1.05);
const guest = createPerson({
x: start.x,
z: start.z,
shirt: guestPalette[i % guestPalette.length],
skin: [0xe0ae87, 0x9a6349, 0xc78a63, 0x6d4638][i % 4],
hair: [0x3b2d29, 0x8b5d3e, 0x22242b][i % 3],
scale: .88 + (i % 3) * .05
});
guest.userData.start = start;
guest.userData.target = target;
guest.userData.delay = i * .038;
arrivalGroup.add(guest);
arrivalGuests.push(guest);
}
// Procession scene.
const processionGroup = new THREE.Group();
processionGroup.visible = false;
scene.add(processionGroup);
const coupleGroup = new THREE.Group();
processionGroup.add(coupleGroup);
const groom = createPerson({
x: -0.48, z: 0, shirt: 0x334154, skin: 0xd4a17d, hair: 0x392c28,
groom: true, scale: 1.03
});
const bride = createPerson({
x: 0.52, z: 0, shirt: 0xfbf5eb, skin: 0xe4b38f, hair: 0x704632,
bride: true, scale: 1.0
});
coupleGroup.add(groom, bride);
const weddingParty = [];
for (let i = 0; i < 6; i++) {
const person = createPerson({
x: i % 2 ? 1.2 : -1.2,
z: 1.1 + Math.floor(i / 2) * 1.0,
shirt: guestPalette[(i + 2) % guestPalette.length],
skin: [0xd4a17d, 0x8d563e, 0xe0ae87][i % 3],
hair: [0x302825, 0x81583c][i % 2],
scale: .91
});
processionGroup.add(person);
weddingParty.push(person);
}
const petals = [];
for (let i = 0; i < 34; i++) {
const petal = addBox(
processionGroup,
.10,
.035,
.10,
i % 2 ? 0xe5a09a : 0xf0c2bd,
(Math.random() - .5) * 5,
Math.random() * 4,
7 - Math.random() * 12
);
petal.userData.seed = Math.random() * Math.PI * 2;
petals.push(petal);
}
// Seating scene.
const seatingGroup = new THREE.Group();
seatingGroup.visible = false;
scene.add(seatingGroup);
const seatingGuests = [];
for (let i = 0; i < 22; i++) {
const side = i % 2 ? 1 : -1;
const start = new THREE.Vector3(side * (7.0 + (i % 4) * .42), 0, 6.7 - Math.floor(i / 4) * 1.25);
const seat = seatPositions[(i * 3 + 2) % seatPositions.length].clone();
const guest = createPerson({
x: start.x,
z: start.z,
shirt: guestPalette[(i + 1) % guestPalette.length],
skin: [0xe0ae87, 0x9a6349, 0xc78a63, 0x6d4638][i % 4],
hair: [0x3b2d29, 0x8b5d3e, 0x22242b][i % 3],
scale: .88 + (i % 3) * .04
});
guest.userData.start = start;
guest.userData.target = seat;
guest.userData.delay = i * .024;
seatingGroup.add(guest);
seatingGuests.push(guest);
}
// Waiting helpers.
const helperPickables = [];
for (const helper of helpers) {
const group = createPerson({
x: helper.home[0],
z: helper.home[1],
shirt: helper.shirt,
skin: helper.skin,
hair: helper.id === 'lina' ? 0x2c2428 : 0x4c342c,
scale: .92,
label: helper.name.toUpperCase()
});
group.userData.helperId = helper.id;
helper.group = group;
helper.arms = group.userData.arms;
scene.add(group);
helperPickables.push(group);
}
// Task markers in the 3D scene.
const markerPositions = {
sound: [-6.2, 3.2, -4.8],
flowers: [6.0, 3.0, -3.0],
arrivals: [0, 3.9, 9.15],
procession: [0, 3.2, 1.0],
seating: [7.2, 3.4, 4.4]
};
const taskMarkers = [];
function drawTaskMarker(marker, task) {
const canvas = marker.userData.canvas;
const ctx = canvas.getContext('2d');
const blocked = taskIsBlocked(task);
const statusColor = task.status === 'done' ? '#52725a' :
task.status === 'working' ? '#b65e4d' :
blocked ? '#918985' : '#6e435f';
ctx.clearRect(0, 0, canvas.width, canvas.height);
roundedRect(ctx, 3, 3, canvas.width - 6, canvas.height - 6, 20);
ctx.fillStyle = 'rgba(255,250,242,.96)';
ctx.fill();
ctx.strokeStyle = blocked ? 'rgba(112,103,99,.2)' : 'rgba(78,47,71,.22)';
ctx.lineWidth = 4;
ctx.stroke();
ctx.fillStyle = statusColor;
roundedRect(ctx, 15, 14, 9, canvas.height - 28, 4);
ctx.fill();
ctx.fillStyle = '#3d3339';
ctx.font = '750 30px system-ui, sans-serif';
ctx.textAlign = 'left';
ctx.textBaseline = 'middle';
ctx.fillText(task.title.toUpperCase(), 38, 43);
ctx.fillStyle = statusColor;
ctx.font = '800 20px system-ui, sans-serif';
ctx.fillText(
task.status === 'done' ? 'COMPLETE' :
task.status === 'working' ? 'IN PROGRESS' :
blocked ? 'LOCKED' :
task.assignedHelper ? 'ASSIGNED' : 'READY',
38,
77
);
marker.userData.texture.needsUpdate = true;
marker.userData.ring.material.color.set(statusColor);
marker.userData.ring.material.opacity = blocked ? .35 : .8;
marker.userData.sprite.material.opacity = blocked ? .62 : 1;
}
for (const task of tasks) {
const group = new THREE.Group();
const pos = markerPositions[task.id];
group.position.set(pos[0], pos[1], pos[2]);
group.userData.taskId = task.id;
const canvas = document.createElement('canvas');
canvas.width = 512;
canvas.height = 112;
const texture = new THREE.CanvasTexture(canvas);
texture.colorSpace = THREE.SRGBColorSpace;
const sprite = new THREE.Sprite(new THREE.SpriteMaterial({
map: texture,
transparent: true,
depthTest: false,
depthWrite: false
}));
sprite.scale.set(4.5, .98, 1);
sprite.renderOrder = 10;
group.add(sprite);
const ring = new THREE.Mesh(
new THREE.TorusGeometry(.62, .065, 8, 32),
new THREE.MeshBasicMaterial({
color: 0x6e435f,
transparent: true,
opacity: .8,
depthTest: false
})
);
ring.rotation.x = Math.PI / 2;
ring.position.y = -1.95;
ring.renderOrder = 9;
group.add(ring);
const stem = new THREE.Mesh(
new THREE.CylinderGeometry(.025, .025, 1.9, 6),
new THREE.MeshBasicMaterial({ color: 0x6e435f, transparent: true, opacity: .38 })
);
stem.position.y = -1.0;
group.add(stem);
group.userData.canvas = canvas;
group.userData.texture = texture;
group.userData.sprite = sprite;
group.userData.ring = ring;
scene.add(group);
taskMarkers.push(group);
drawTaskMarker(group, task);
}
function taskIsBlocked(task) {
return task.deps.some(dep => taskById[dep].status !== 'done');
}
function statusLabel(task) {
if (task.status === 'done') return 'done';
if (task.status === 'working') return 'working';
if (taskIsBlocked(task)) return 'blocked';
return 'ready';
}
function renderUI() {
const active = helperById[activeHelperId];
$('#activeHelperLabel').textContent = `Active: ${active.name}`;
$('#helperList').innerHTML = helpers.map(helper => {
const busyTask = helper.taskId ? taskById[helper.taskId] : null;
const busy = busyTask && busyTask.status !== 'done';
return `
<button class="helper-card ${helper.id === activeHelperId ? 'active' : ''} ${busy ? 'busy' : ''}"
data-helper="${helper.id}" aria-pressed="${helper.id === activeHelperId}">
<span class="helper-avatar" style="background:#${helper.color.toString(16).padStart(6, '0')}">
${helper.name.slice(0, 1)}
</span>
<span>
<span class="helper-name">${helper.name}</span>
<span class="helper-role">${busy ? busyTask.title : helper.role}</span>
</span>
</button>
`;
}).join('');
$('#taskList').innerHTML = tasks.map(task => {
const blocked = taskIsBlocked(task);
const status = statusLabel(task);
const assigned = task.assignedHelper ? helperById[task.assignedHelper] : null;
let actionLabel = `Assign ${active.name}`;
let actionDisabled = false;
if (task.status === 'done') {
actionLabel = 'Complete ✓';
actionDisabled = true;
} else if (task.status === 'working') {
actionLabel = 'Working…';
actionDisabled = true;
} else if (assigned) {
actionLabel = blocked ? 'Needs dependency' : `Start with ${assigned.name}`;
actionDisabled = blocked;
}
const dependencies = task.deps.length
? task.deps.map(dep => {
const depTask = taskById[dep];
const met = depTask.status === 'done';
return `<span class="dependency ${met ? 'met' : 'pending'}">${met ? '✓' : '○'} ${depTask.title}</span>`;
}).join('')
: '<span class="dependency met">✓ Venue access</span>';
return `
<article class="task-card ${task.status} ${blocked ? 'blocked' : ''}" data-task-card="${task.id}">
<div class="task-top">
<div class="task-number">${task.status === 'done' ? '✓' : task.number}</div>
<div>
<h4 class="task-title">${task.title}</h4>
<span class="task-subtitle">${task.subtitle}</span>
</div>
<span class="task-status ${status}">${status}</span>
</div>
<div class="dependencies">${dependencies}</div>
<div class="task-bottom">
<span class="assigned-helper">${assigned ? `Helper: <strong>${assigned.name}</strong>` : 'No helper assigned'}</span>
<button class="task-action" data-task-action="${task.id}" ${actionDisabled ? 'disabled' : ''}>
${actionLabel}
</button>
</div>
<div class="progress-track" style="${task.status === 'working' ? '' : 'display:none'}">
<div class="progress-fill" id="progress-${task.id}"></div>
</div>
</article>
`;
}).join('');
taskMarkers.forEach((marker, i) => drawTaskMarker(marker, tasks[i]));
const phase = getPhase();
$('#phaseLabel').textContent = phase.label;
$('#storyTitle').textContent = phase.title;
$('#storyText').textContent = phase.text;
updateProgressUI();
}
function getPhase() {
const sound = taskById.sound.status === 'done';
const flowers = taskById.flowers.status === 'done';
const arrivals = taskById.arrivals.status === 'done';
const procession = taskById.procession.status === 'done';
const seating = taskById.seating.status === 'done';
if (seating) return {
label: 'The seat is set',
title: 'A full house, ready for vows',
text: 'Every guest is seated. The helpers have turned a run of show into a celebration.'
};
if (taskById.seating.status === 'working') return {
label: 'Seating guests',
title: 'Take your places',
text: 'Mara is guiding guests down the aisle and into their reserved seats.'
};
if (procession) return {
label: 'Procession complete',
title: 'The couple has reached the altar',
text: 'The seating task is now available. Assign Mara to guide the ceremony guests.'
};
if (taskById.procession.status === 'working') return {
label: 'The procession',
title: 'Here comes the couple',
text: 'The aisle is clear, the flowers are in place, and the processional cue is playing.'
};
if (arrivals) return {
label: 'Arrivals complete',
title: 'The courtyard is full',
text: 'With the room ready and all guests arrived, the procession can begin.'
};
if (taskById.arrivals.status === 'working') return {
label: 'Guest arrivals',
title: 'Welcome to the Alder',
text: 'Noor is greeting guests and directing them toward the ceremony courtyard.'
};
if (sound && flowers) return {
label: 'Ready for guests',
title: 'The room is ready',
text: 'Sound and flowers are complete. Assign Noor to open guest arrivals.'
};
if (taskById.sound.status === 'working' || taskById.flowers.status === 'working') return {
label: 'Venue preparation',
title: 'Finishing the essentials',
text: 'The helper is putting the final detail in place before guests arrive.'
};
return {
label: 'Venue preparation',
title: 'Open the courtyard',
text: 'Sound and flowers can begin together. The next scene waits for both.'
};
}
function updateProgressUI() {
for (const task of tasks) {
const fill = document.getElementById(`progress-${task.id}`);
if (fill) fill.style.width = `${Math.round(task.progress * 100)}%`;
}
}
function showToast(message) {
const el = $('#toast');
el.textContent = message;
el.classList.add('show');
clearTimeout(toastTimer);
toastTimer = setTimeout(() => el.classList.remove('show'), 2600);
}
function selectHelper(id) {
if (!helperById[id]) return;
activeHelperId = id;
renderUI();
}
function assignTask(taskId) {
const task = taskById[taskId];
const helper = helperById[activeHelperId];
if (task.status === 'done') return;
if (!task.assignedHelper) {
if (helper.taskId && taskById[helper.taskId].status === 'working') {
showToast(`${helper.name} is already working. Choose another helper.`);
return;
}
if (helper.taskId) {
const previous = taskById[helper.taskId];
previous.assignedHelper = null;
previous.status = 'available';
}
task.assignedHelper = helper.id;
task.status = 'assigned';
helper.taskId = task.id;
renderUI();
showToast(`${helper.name} assigned to ${task.title}. Click again to start.`);
return;
}
startTask(task.id);
}
function startTask(taskId) {
const task = taskById[taskId];
if (!task || task.status === 'working' || task.status === 'done') return;
if (!task.assignedHelper) {
showToast('Assign a helper before starting this task.');
return;
}
if (taskIsBlocked(task)) {
const missing = task.deps
.filter(dep => taskById[dep].status !== 'done')
.map(dep => taskById[dep].title)
.join(' and ');
showToast(`${task.title} is locked until ${missing} is complete.`);
return;
}
const helper = helperById[task.assignedHelper];
if (helper.taskId && helper.taskId !== task.id && taskById[helper.taskId].status === 'working') {
showToast(`${helper.name} is busy with another task.`);
return;
}
task.status = 'working';
task.progress = 0;
helper.taskId = task.id;
syncSceneVisibility();
renderUI();
showToast(`${helper.name} has started ${task.title.toLowerCase()}.`);
}
function completeTask(task) {
task.status = 'done';
task.progress = 1;
const helper = helperById[task.assignedHelper];
if (helper && helper.taskId === task.id) helper.taskId = null;
syncSceneVisibility();
renderUI();
showToast(`${task.title} complete. ${task.outcome}`);
}
function syncSceneVisibility() {
flowersDecor.visible = ['working', 'done'].includes(taskById.flowers.status);
const arrivalsVisible = taskById.arrivals.status === 'working' ||
(taskById.arrivals.status === 'done' && taskById.procession.status === 'available');
arrivalGroup.visible = arrivalsVisible;
processionGroup.visible = ['working', 'done'].includes(taskById.procession.status);
seatingGroup.visible = ['working', 'done'].includes(taskById.seating.status);
}
function resetDay() {
tasks.forEach(task => {
task.status = 'available';
task.assignedHelper = null;
task.progress = 0;
});
helpers.forEach(helper => {
helper.taskId = null;
helper.group.position.set(helper.home[0], 0, helper.home[1]);
helper.group.rotation.y = 0;
helper.group.scale.setScalar(.92);
helper.arms.forEach((arm, i) => arm.rotation.x = 0);
});
blossoms.forEach(bloom => bloom.scale.setScalar(.001));
coupleGroup.position.set(0, 0, 0);
weddingParty.forEach((person, i) => {
person.position.set(i % 2 ? 1.2 : -1.2, 0, 1.1 + Math.floor(i / 2));
});
seatingGuests.forEach(guest => {
guest.position.copy(guest.userData.start);
guest.scale.setScalar(.88 + (guest.userData.delay * 10) % .10);
});
arrivalGuests.forEach(guest => guest.position.copy(guest.userData.start));
activeHelperId = 'theo';
syncSceneVisibility();
renderUI();
showToast('The wedding day has been reset. You are in venue preparation.');
}
// Delegated UI controls.
$('#helperList').addEventListener('click', event => {
const button = event.target.closest('[data-helper]');
if (button) selectHelper(button.dataset.helper);
});
$('#taskList').addEventListener('click', event => {
const button = event.target.closest('[data-task-action]');
if (button) assignTask(button.dataset.taskAction);
});
$('#speedButton').addEventListener('click', () => {
simulationSpeed = simulationSpeed === 1 ? 2 : 1;
$('#speedButton').textContent = `${simulationSpeed}× speed`;
});
$('#resetButton').addEventListener('click', () => {
if (window.confirm('Reset all tasks and return to venue preparation?')) resetDay();
});
document.querySelectorAll('[data-camera]').forEach(button => {
button.addEventListener('click', () => {
const action = button.dataset.camera;
if (action === 'reset') {
cameraState.yaw = .64;
cameraState.pitch = .76;
cameraState.zoom = 1;
} else if (action === 'in') {
cameraState.zoom = Math.min(1.8, cameraState.zoom + .15);
} else {
cameraState.zoom = Math.max(.65, cameraState.zoom - .15);
}
updateCamera();
});
});
// Custom camera controls: no external controls addon.
const pointerState = { down: false, dragging: false, x: 0, y: 0, startX: 0, startY: 0 };
const raycaster = new THREE.Raycaster();
const pointer = new THREE.Vector2();
const pickables = [...helperPickables, ...taskMarkers];
function updatePointer(event) {
const rect = renderer.domElement.getBoundingClientRect();
pointer.x = ((event.clientX - rect.left) / rect.width) * 2 - 1;
pointer.y = -((event.clientY - rect.top) / rect.height) * 2 + 1;
}
function findInteractive(object) {
let current = object;
while (current) {
if (current.userData.helperId || current.userData.taskId) return current;
current = current.parent;
}
return null;
}
function hitTest(event) {
updatePointer(event);
raycaster.setFromCamera(pointer, camera);
const hits = raycaster.intersectObjects(pickables, true);
for (const hit of hits) {
const interactive = findInteractive(hit.object);
if (interactive) return interactive;
}
return null;
}
renderer.domElement.addEventListener('pointerdown', event => {
pointerState.down = true;
pointerState.dragging = false;
pointerState.x = pointerState.startX = event.clientX;
pointerState.y = pointerState.startY = event.clientY;
renderer.domElement.setPointerCapture(event.pointerId);
renderer.domElement.classList.add('dragging');
});
renderer.domElement.addEventListener('pointermove', event => {
if (pointerState.down) {
const dx = event.clientX - pointerState.x;
const dy = event.clientY - pointerState.y;
if (Math.abs(event.clientX - pointerState.startX) + Math.abs(event.clientY - pointerState.startY) > 5) {
pointerState.dragging = true;
}
if (pointerState.dragging) {
cameraState.yaw -= dx * .006;
cameraState.pitch = THREE.MathUtils.clamp(cameraState.pitch + dy * .004, .45, 1.12);
updateCamera();
}
pointerState.x = event.clientX;
pointerState.y = event.clientY;
tooltip.classList.remove('visible');
return;
}
const interactive = hitTest(event);
if (!interactive) {
tooltip.classList.remove('visible');
renderer.domElement.style.cursor = 'grab';
return;
}
renderer.domElement.style.cursor = 'pointer';
let title = '';
let body = '';
if (interactive.userData.helperId) {
const helper = helperById[interactive.userData.helperId];
const busyTask = helper.taskId ? taskById[helper.taskId] : null;
title = helper.name;
body = busyTask ? `Working on ${busyTask.title}` : `${helper.role} · click to select`;
} else if (interactive.userData.taskId) {
const task = taskById[interactive.userData.taskId];
title = task.title;
body = task.status === 'done' ? 'Complete' :
task.status === 'working' ? 'In progress' :
taskIsBlocked(task) ? 'Waiting on prerequisites' :
task.assignedHelper ? `Assigned to ${helperById[task.assignedHelper].name}` : 'Ready to assign';
}
const rect = viewport.getBoundingClientRect();
tooltip.innerHTML = `<strong>${title}</strong>${body}`;
tooltip.style.left = `${event.clientX - rect.left}px`;
tooltip.style.top = `${event.clientY - rect.top}px`;
tooltip.classList.add('visible');
});
renderer.domElement.addEventListener('pointerup', event => {
pointerState.down = false;
renderer.domElement.classList.remove('dragging');
if (!pointerState.dragging) {
const interactive = hitTest(event);
if (interactive?.userData.helperId) {
selectHelper(interactive.userData.helperId);
showToast(`${helperById[interactive.userData.helperId].name} is now the active helper.`);
} else if (interactive?.userData.taskId) {
assignTask(interactive.userData.taskId);
}
}
});
renderer.domElement.addEventListener('pointercancel', () => {
pointerState.down = false;
pointerState.dragging = false;
renderer.domElement.classList.remove('dragging');
});
renderer.domElement.addEventListener('pointerleave', () => {
tooltip.classList.remove('visible');
});
renderer.domElement.addEventListener('wheel', event => {
event.preventDefault();
cameraState.zoom = THREE.MathUtils.clamp(
cameraState.zoom * (event.deltaY > 0 ? .92 : 1.08),
.65,
1.8
);
updateCamera();
}, { passive: false });
renderer.domElement.addEventListener('dblclick', () => {
cameraState.yaw = .64;
cameraState.pitch = .76;
cameraState.zoom = 1;
updateCamera();
});
function updateCamera() {
const radius = 34;
const horizontal = radius * Math.cos(cameraState.pitch);
camera.position.set(
cameraTarget.x + Math.sin(cameraState.yaw) * horizontal,
cameraTarget.y + Math.sin(cameraState.pitch) * radius,
cameraTarget.z + Math.cos(cameraState.yaw) * horizontal
);
camera.lookAt(cameraTarget);
camera.zoom = cameraState.zoom;
camera.updateProjectionMatrix();
}
function resize() {
const width = viewport.clientWidth;
const height = viewport.clientHeight;
const aspect = width / Math.max(height, 1);
const frustumHeight = aspect >= 1.2 ? 24 : 32 / aspect;
camera.left = -frustumHeight * aspect / 2;
camera.right = frustumHeight * aspect / 2;
camera.top = frustumHeight / 2;
camera.bottom = -frustumHeight / 2;
camera.updateProjectionMatrix();
renderer.setSize(width, height, false);
updateCamera();
}
window.addEventListener('resize', resize);
const smoothstep = t => t * t * (3 - 2 * t);
const clamp01 = t => Math.max(0, Math.min(1, t));
function updateFlowerScene(progress) {
for (const bloom of blossoms) {
const local = clamp01((progress - bloom.userData.delay) / .42);
bloom.scale.setScalar(Math.max(.001, smoothstep(local)));
}
}
function updateArrivalScene(progress) {
for (const guest of arrivalGuests) {
const local = clamp01((progress - guest.userData.delay) / .62);
guest.visible = local > 0;
guest.position.lerpVectors(guest.userData.start, guest.userData.target, smoothstep(local));
guest.rotation.y = local < .95 ? Math.PI : 0;
}
}
function updateProcessionScene(progress, elapsed) {
const eased = smoothstep(progress);
coupleGroup.position.z = THREE.MathUtils.lerp(8.4, -5.4, eased);
coupleGroup.position.x = Math.sin(eased * Math.PI) * .08;
weddingParty.forEach((person, i) => {
person.position.z = THREE.MathUtils.lerp(9.7 + (i % 3) * .18, -3.8 + Math.floor(i / 2) * .5, eased);
});
petals.forEach((petal, i) => {
const seed = petal.userData.seed;
const travel = (elapsed * .34 + i * .11) % 1;
petal.position.y = 4.8 - travel * 4.8;
petal.position.x += Math.sin(elapsed * 1.5 + seed) * .002;
petal.rotation.x += .025;
petal.rotation.z += .018;
});
}
function updateSeatingScene(progress) {
for (const guest of seatingGuests) {
const local = clamp01((progress - guest.userData.delay) / .57);
guest.visible = local > 0;
guest.position.lerpVectors(guest.userData.start, guest.userData.target, smoothstep(local));
const sit = clamp01((local - .82) / .18);
guest.scale.y = guest.scale.x * THREE.MathUtils.lerp(1, .73, sit);
guest.rotation.y = local < .9 ? Math.PI : 0;
}
}
function helperTargetForTask(helper, task, progress) {
if (!helper || !task) return helper.target;
if (task.id === 'procession') {
return new THREE.Vector3(-1.15, 0, THREE.MathUtils.lerp(8.0, -4.0, smoothstep(progress)));
}
return task.target;
}
let previousTime = performance.now();
let elapsed = 0;
let uiAccumulator = 0;
function animate(now) {
requestAnimationFrame(animate);
const dt = Math.min((now - previousTime) / 1000, .05);
previousTime = now;
elapsed += dt;
for (const task of tasks) {
if (task.status !== 'working') continue;
task.progress = Math.min(1, task.progress + dt * simulationSpeed / task.duration);
const helper = helperById[task.assignedHelper];
if (helper) {
const target = helperTargetForTask(helper, task, task.progress);
helper.group.position.lerp(target, 1 - Math.exp(-dt * 4.5));
const walk = Math.sin(elapsed * 8) * .16;
helper.arms[0].rotation.x = walk;
helper.arms[1].rotation.x = -walk;
}
if (task.id === 'flowers') updateFlowerScene(task.progress);
if (task.id === 'arrivals') updateArrivalScene(task.progress);
if (task.id === 'procession') updateProcessionScene(task.progress, elapsed);
if (task.id === 'seating') updateSeatingScene(task.progress);
if (task.id === 'sound') {
const energy = task.progress < 1 ? .7 + Math.sin(elapsed * 7) * .3 : .35;
soundBars.forEach((bar, i) => {
bar.scale.y = energy * (.65 + (i % 3) * .25);
bar.material.color.set(task.status === 'done' ? 0x6f9a73 : 0xd77a68);
});
}
if (task.progress >= 1) completeTask(task);
}
// Gentle marker and helper ambience.
taskMarkers.forEach((marker, i) => {
marker.userData.ring.scale.setScalar(1 + Math.sin(elapsed * 2.3 + i) * .08);
});
helpers.forEach((helper, i) => {
if (!helper.taskId) {
helper.group.position.y = Math.sin(elapsed * 2 + i) * .025;
}
});
uiAccumulator += dt;
if (uiAccumulator > .08) {
updateProgressUI();
uiAccumulator = 0;
}
renderer.render(scene, camera);
}
resize();
syncSceneVisibility();
renderUI();
requestAnimationFrame(animate);
setTimeout(() => $('#loading').classList.add('hidden'), 450);
</script>
</body>
</html>
```