Prompt specification
Build or customize the Three.js 3D scene "Small community graduation ceremony" 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: Small community graduation ceremony
Category: Voxel Worlds · Style: Voxel 3D
License: MIT · Reference: https://three3d.app/scene/small-community-graduation-ceremony-x3871
Scene Description Prompt:
Please create one self-contained HTML file with Three.js from cdnjs showing a graduation ceremony and recipient order. Compose a school hall with stage, chairs, families, and display of student work; a few participants take turns while the audience remains readable and uncluttered. Voxel style.
Working Three.js Starter (small-community-graduation-ceremony-x3871):
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Class of 2026 — Voxel Graduation Ceremony</title>
<style>
:root {
--ink: #24343b;
--muted: #607276;
--paper: rgba(255, 253, 247, 0.93);
--line: rgba(36, 52, 59, 0.14);
--teal: #397c78;
--gold: #d6a444;
--coral: #d87360;
--mint: #78a89c;
--shadow: 0 18px 45px rgba(36, 52, 59, 0.16);
}
* {
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: #dce7e4;
color: var(--ink);
font-family:
Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
"Segoe UI", sans-serif;
}
button {
font: inherit;
}
#viewport {
position: fixed;
inset: 0;
}
canvas {
display: block;
width: 100%;
height: 100%;
touch-action: none;
cursor: grab;
}
canvas:active {
cursor: grabbing;
}
.panel {
position: fixed;
z-index: 5;
background: var(--paper);
border: 1px solid rgba(255, 255, 255, 0.72);
box-shadow: var(--shadow);
backdrop-filter: blur(12px);
-webkit-backdrop-filter: blur(12px);
}
.title-card {
top: 22px;
left: 22px;
width: min(430px, calc(100vw - 44px));
padding: 20px 22px 18px;
border-radius: 16px;
}
.eyebrow {
display: flex;
align-items: center;
gap: 9px;
margin-bottom: 9px;
color: var(--teal);
font-size: 11px;
font-weight: 800;
letter-spacing: 0.19em;
text-transform: uppercase;
}
.eyebrow::before {
content: "";
width: 10px;
height: 10px;
background: var(--gold);
box-shadow: 3px 3px 0 rgba(214, 164, 68, 0.25);
}
h1 {
margin: 0;
font-size: clamp(25px, 3vw, 38px);
line-height: 1.04;
letter-spacing: -0.045em;
}
.subtitle {
margin: 10px 0 0;
color: var(--muted);
font-size: 13px;
line-height: 1.55;
}
.live-row {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
margin-top: 15px;
}
.live-badge {
display: inline-flex;
align-items: center;
gap: 7px;
padding: 7px 10px;
border-radius: 999px;
background: rgba(57, 124, 120, 0.1);
color: var(--teal);
font-size: 10px;
font-weight: 800;
letter-spacing: 0.12em;
text-transform: uppercase;
}
.live-dot {
width: 7px;
height: 7px;
border-radius: 50%;
background: #55a78c;
box-shadow: 0 0 0 4px rgba(85, 167, 140, 0.14);
}
.date {
color: var(--muted);
font-size: 11px;
font-weight: 700;
}
.order-panel {
left: 22px;
bottom: 22px;
width: 326px;
padding: 17px;
border-radius: 16px;
}
.panel-heading {
display: flex;
align-items: baseline;
justify-content: space-between;
gap: 12px;
margin-bottom: 12px;
}
.panel-heading h2 {
margin: 0;
font-size: 14px;
letter-spacing: -0.015em;
}
.panel-heading span {
color: var(--muted);
font-size: 10px;
font-weight: 700;
letter-spacing: 0.1em;
text-transform: uppercase;
}
#order-list {
display: grid;
gap: 7px;
}
.recipient {
position: relative;
display: grid;
grid-template-columns: 35px 1fr 25px;
align-items: center;
gap: 10px;
width: 100%;
min-height: 58px;
padding: 8px 9px;
overflow: hidden;
border: 1px solid transparent;
border-radius: 10px;
background: rgba(255, 255, 255, 0.48);
color: var(--ink);
text-align: left;
cursor: pointer;
transition:
background 180ms ease,
border-color 180ms ease,
transform 180ms ease;
}
.recipient:hover {
transform: translateX(2px);
background: rgba(255, 255, 255, 0.9);
}
.recipient.current {
border-color: rgba(57, 124, 120, 0.28);
background: rgba(57, 124, 120, 0.09);
}
.recipient.completed {
background: rgba(57, 124, 120, 0.055);
}
.rank {
display: grid;
place-items: center;
width: 34px;
height: 34px;
border-radius: 8px;
background: var(--recipient-color);
color: white;
font-size: 12px;
font-weight: 900;
box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.12);
}
.recipient-name {
display: block;
margin-bottom: 2px;
font-size: 12px;
font-weight: 800;
}
.recipient-award {
display: block;
color: var(--muted);
font-size: 10px;
line-height: 1.3;
}
.recipient-status {
color: var(--muted);
font-size: 14px;
font-weight: 900;
text-align: center;
}
.recipient.current .recipient-status {
color: var(--teal);
}
.order-note {
margin: 12px 2px 0;
color: var(--muted);
font-size: 10px;
line-height: 1.45;
}
.award-card {
left: 50%;
bottom: 22px;
width: min(470px, calc(100vw - 760px));
min-width: 360px;
padding: 15px 18px 14px;
border-radius: 16px;
transform: translateX(-50%);
}
.award-meta {
display: flex;
align-items: center;
justify-content: space-between;
gap: 14px;
margin-bottom: 7px;
}
#phase-label {
color: var(--teal);
font-size: 10px;
font-weight: 900;
letter-spacing: 0.15em;
text-transform: uppercase;
}
#phase-count {
color: var(--muted);
font-size: 10px;
font-weight: 800;
}
#award-name {
margin: 0;
font-size: 19px;
letter-spacing: -0.025em;
}
#award-detail {
margin: 4px 0 11px;
color: var(--muted);
font-size: 11px;
}
.progress-track {
height: 5px;
overflow: hidden;
border-radius: 999px;
background: rgba(36, 52, 59, 0.1);
}
#progress-fill {
width: 0%;
height: 100%;
border-radius: inherit;
background: linear-gradient(90deg, var(--teal), var(--gold));
transition: width 80ms linear;
}
.controls {
top: 22px;
right: 22px;
width: 220px;
padding: 13px;
border-radius: 16px;
}
.control-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 7px;
}
.control-button {
min-height: 36px;
padding: 8px 9px;
border: 1px solid var(--line);
border-radius: 9px;
background: rgba(255, 255, 255, 0.72);
color: var(--ink);
font-size: 10px;
font-weight: 800;
cursor: pointer;
transition:
transform 150ms ease,
background 150ms ease;
}
.control-button:hover {
transform: translateY(-1px);
background: white;
}
.control-button.primary {
border-color: transparent;
background: var(--teal);
color: white;
}
.control-button:disabled {
opacity: 0.45;
cursor: default;
transform: none;
}
.view-hint {
top: 22px;
left: 50%;
padding: 9px 13px;
border: 1px solid rgba(255, 255, 255, 0.66);
border-radius: 999px;
background: rgba(255, 253, 247, 0.78);
color: var(--muted);
font-size: 10px;
font-weight: 750;
letter-spacing: 0.035em;
transform: translateX(-50%);
backdrop-filter: blur(8px);
}
.view-hint span {
color: var(--ink);
}
@media (max-width: 1100px) {
.award-card {
right: 22px;
left: auto;
width: 380px;
min-width: 0;
transform: none;
}
.view-hint {
display: none;
}
}
@media (max-width: 760px) {
.title-card {
top: 12px;
left: 12px;
width: calc(100vw - 24px);
padding: 14px 16px;
}
.title-card h1 {
font-size: 24px;
}
.subtitle {
display: none;
}
.live-row {
margin-top: 10px;
}
.controls {
top: 128px;
right: 12px;
width: 178px;
padding: 9px;
}
.control-grid {
gap: 5px;
}
.control-button {
min-height: 32px;
padding: 6px;
font-size: 9px;
}
.order-panel {
left: 12px;
bottom: 12px;
width: calc(100vw - 24px);
max-height: 40vh;
padding: 12px;
overflow-y: auto;
}
.order-note {
display: none;
}
.recipient {
min-height: 50px;
}
.award-card {
right: 12px;
bottom: calc(40vh + 24px);
width: calc(100vw - 24px);
padding: 12px 14px;
}
#award-name {
font-size: 16px;
}
}
</style>
</head>
<body>
<main id="viewport" aria-label="Interactive voxel graduation ceremony"></main>
<header class="title-card panel">
<div class="eyebrow">School Hall · Commencement</div>
<h1>Class of 2026</h1>
<p class="subtitle">
A bright, voxel-built graduation ceremony with families, student work,
and three awards presented in order.
</p>
<div class="live-row">
<span class="live-badge">
<span class="live-dot"></span>
<span id="live-text">Ceremony in progress</span>
</span>
<span class="date">June 14 · 10:00 AM</span>
</div>
</header>
<aside class="order-panel panel" aria-label="Recipient order">
<div class="panel-heading">
<h2>Recipient order</h2>
<span>Select to jump</span>
</div>
<div id="order-list"></div>
<p class="order-note">
Click a recipient to begin their part of the ceremony. The audience stays
seated while each honoree takes a turn at center stage.
</p>
</aside>
<section class="award-card panel" aria-live="polite">
<div class="award-meta">
<span id="phase-label">Processional</span>
<span id="phase-count">1 of 3</span>
</div>
<h2 id="award-name">Maya Chen</h2>
<p id="award-detail">Valedictorian Address</p>
<div class="progress-track" aria-hidden="true">
<div id="progress-fill"></div>
</div>
</section>
<nav class="controls panel" aria-label="Ceremony controls">
<div class="control-grid">
<button class="control-button primary" id="pause-button">Pause</button>
<button class="control-button" id="next-button">Next recipient</button>
<button class="control-button" id="replay-button">Replay</button>
<button class="control-button" id="stage-button">Stage view</button>
<button class="control-button" id="hall-button">Hall view</button>
<button class="control-button" id="reset-button">Reset camera</button>
</div>
</nav>
<div class="view-hint panel">
<span>Drag</span> to orbit · <span>Scroll</span> to zoom
</div>
<script type="module">
import * as THREE from
"https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
const viewport = document.getElementById("viewport");
const scene = new THREE.Scene();
scene.background = new THREE.Color("#dce7e4");
scene.fog = new THREE.Fog("#dce7e4", 30, 52);
const camera = new THREE.PerspectiveCamera(
42,
innerWidth / innerHeight,
0.1,
100
);
const renderer = new THREE.WebGLRenderer({
antialias: true,
powerPreference: "high-performance"
});
renderer.setPixelRatio(Math.min(devicePixelRatio, 2));
renderer.setSize(innerWidth, innerHeight);
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1.08;
viewport.appendChild(renderer.domElement);
const hemisphere = new THREE.HemisphereLight("#f8f3df", "#6b8790", 2.35);
scene.add(hemisphere);
const sun = new THREE.DirectionalLight("#fff0d0", 3.2);
sun.position.set(8, 16, 11);
sun.castShadow = true;
sun.shadow.mapSize.set(2048, 2048);
sun.shadow.camera.left = -18;
sun.shadow.camera.right = 18;
sun.shadow.camera.top = 18;
sun.shadow.camera.bottom = -18;
sun.shadow.camera.near = 1;
sun.shadow.camera.far = 45;
sun.shadow.bias = -0.0004;
sun.shadow.normalBias = 0.025;
scene.add(sun);
const fill = new THREE.DirectionalLight("#9dc8d1", 1.1);
fill.position.set(-10, 8, 6);
scene.add(fill);
const unitBox = new THREE.BoxGeometry(1, 1, 1);
const material = (color, extra = {}) =>
new THREE.MeshStandardMaterial({
color,
roughness: 0.83,
metalness: 0,
...extra
});
const M = {
floorA: material("#e9dfc9"),
floorB: material("#f3ead8"),
base: material("#b9aa91"),
wall: material("#d6e1dc"),
wallTrim: material("#557a73"),
stage: material("#b9744d"),
stageTop: material("#d99c6d"),
stageEdge: material("#985b3f"),
blue: material("#497b89"),
navy: material("#293f54"),
teal: material("#397c78"),
mint: material("#78a89c"),
coral: material("#d87360"),
gold: material("#d6a444", { metalness: 0.12, roughness: 0.62 }),
cream: material("#fff9e9"),
white: material("#fffdf5"),
ink: material("#26363c"),
brown: material("#78523d"),
wood: material("#a97851"),
green: material("#5f9074"),
greenDark: material("#3d705f"),
skin1: material("#e2b38f"),
skin2: material("#b97b5b"),
skin3: material("#855a43"),
skin4: material("#f0c6a4"),
hair1: material("#392b29"),
hair2: material("#6d4934"),
hair3: material("#b58a58"),
hair4: material("#25282a"),
outfit1: material("#d16f5d"),
outfit2: material("#5c8fa0"),
outfit3: material("#c29a54"),
outfit4: material("#6f8f78"),
outfit5: material("#8c7897"),
outfit6: material("#bc7357")
};
function cube(
w,
h,
d,
x,
y,
z,
mat,
parent = scene,
cast = true,
receive = true
) {
const mesh = new THREE.Mesh(unitBox, mat);
mesh.scale.set(w, h, d);
mesh.position.set(x, y, z);
mesh.castShadow = cast;
mesh.receiveShadow = receive;
parent.add(mesh);
return mesh;
}
const FLOOR_Y = 0.08;
const STAGE_Y = 0.76;
// -----------------------------------------------------------
// Hall shell and tiled floor
// -----------------------------------------------------------
cube(22.8, 0.52, 18.1, 0, -0.28, 0, M.base);
for (let row = 0; row < 10; row++) {
for (let col = 0; col < 12; col++) {
const mat = (row + col) % 2 === 0 ? M.floorA : M.floorB;
cube(
1.74,
0.1,
1.53,
-9.53 + col * 1.76,
0.01,
-7.05 + row * 1.55,
mat,
scene,
false,
true
);
}
}
cube(22.2, 6.45, 0.34, 0, 3.22, -8.35, M.wall);
cube(22.4, 0.24, 0.5, 0, 6.5, -8.34, M.wallTrim);
cube(0.32, 1.25, 17.8, -11.02, 0.65, 0, M.wall);
cube(0.32, 1.25, 17.8, 11.02, 0.65, 0, M.wall);
cube(0.45, 0.16, 17.8, -11.02, 1.33, 0, M.wallTrim);
cube(0.45, 0.16, 17.8, 11.02, 1.33, 0, M.wallTrim);
// Stage, boards, trim, and central steps.
cube(18.3, 0.64, 4.05, 0, 0.32, -5.55, M.stage);
for (let i = 0; i < 12; i++) {
cube(
1.47,
0.12,
3.94,
-8.25 + i * 1.5,
0.7,
-5.55,
i % 2 === 0 ? M.stageTop : material("#cf9165"),
scene,
false,
true
);
}
cube(18.4, 0.17, 0.18, 0, 0.67, -3.52, M.stageEdge);
cube(2.45, 0.25, 1.0, 0, 0.125, -3.04, M.stageEdge);
cube(2.1, 0.5, 0.72, 0, 0.25, -3.48, M.stage);
// -----------------------------------------------------------
// Pixel-style lettering made from small cubes
// -----------------------------------------------------------
const FONT = {
" ": ["000", "000", "000", "000", "000", "000", "000"],
A: ["01110", "10001", "10001", "11111", "10001", "10001", "10001"],
C: ["01111", "10000", "10000", "10000", "10000", "10000", "01111"],
D: ["11110", "10001", "10001", "10001", "10001", "10001", "11110"],
E: ["11111", "10000", "10000", "11110", "10000", "10000", "11111"],
F: ["11111", "10000", "10000", "11110", "10000", "10000", "10000"],
K: ["10001", "10010", "10100", "11000", "10100", "10010", "10001"],
L: ["10000", "10000", "10000", "10000", "10000", "10000", "11111"],
N: ["10001", "11001", "10101", "10011", "10001", "10001", "10001"],
O: ["01110", "10001", "10001", "10001", "10001", "10001", "01110"],
R: ["11110", "10001", "10001", "11110", "10100", "10010", "10001"],
S: ["01111", "10000", "10000", "01110", "00001", "00001", "11110"],
T: ["11111", "00100", "00100", "00100", "00100", "00100", "00100"],
U: ["10001", "10001", "10001", "10001", "10001", "10001", "01110"],
W: ["10001", "10001", "10001", "10101", "10101", "11011", "10001"],
"0": ["01110", "10001", "10011", "10101", "11001", "10001", "01110"],
"1": ["00100", "01100", "00100", "00100", "00100", "00100", "01110"],
"2": ["01110", "10001", "00001", "00010", "00100", "01000", "11111"],
"3": ["11110", "00001", "00001", "01110", "00001", "00001", "11110"],
"6": ["01110", "10000", "10000", "11110", "10001", "10001", "01110"]
};
function pixelText(text, cell, centerX, baselineY, z, mat, parent = scene) {
const group = new THREE.Group();
parent.add(group);
const width = (text.length * 6 - 1) * cell;
const startX = centerX - width / 2;
[...text.toUpperCase()].forEach((char, charIndex) => {
const pattern = FONT[char] || FONT[" "];
pattern.forEach((row, rowIndex) => {
[...row].forEach((pixel, colIndex) => {
if (pixel !== "1") return;
cube(
cell * 0.84,
cell * 0.84,
cell * 0.62,
startX + (charIndex * 6 + colIndex + 0.5) * cell,
baselineY + (6 - rowIndex + 0.5) * cell,
z,
mat,
group,
false,
false
);
});
});
});
return group;
}
// Student work display.
cube(8.5, 3.45, 0.15, -5.4, 3.18, -8.08, M.wood);
cube(8.15, 3.12, 0.16, -5.4, 3.18, -7.96, M.cream);
pixelText("STUDENT WORK", 0.145, -5.4, 5.03, -8.04, M.teal);
const artXs = [-7.8, -5.4, -3.0];
for (const x of artXs) {
cube(2.05, 2.25, 0.12, x, 3.13, -7.83, M.brown);
cube(1.77, 1.97, 0.13, x, 3.13, -7.73, M.white);
}
// Pixel rocket artwork.
cube(0.43, 0.95, 0.08, artXs[0], 3.25, -7.61, M.blue);
cube(0.28, 0.25, 0.09, artXs[0], 3.43, -7.60, M.gold);
cube(0.22, 0.35, 0.08, artXs[0] - 0.35, 2.88, -7.60, M.coral);
cube(0.22, 0.35, 0.08, artXs[0] + 0.35, 2.88, -7.60, M.coral);
cube(0.32, 0.23, 0.08, artXs[0], 2.55, -7.60, M.gold);
// Pixel flower artwork.
cube(0.13, 0.85, 0.08, artXs[1], 2.92, -7.61, M.green);
cube(0.42, 0.16, 0.08, artXs[1] - 0.25, 2.82, -7.61, M.green);
cube(0.4, 0.16, 0.08, artXs[1] + 0.25, 3.02, -7.61, M.green);
cube(0.36, 0.36, 0.08, artXs[1], 3.48, -7.60, M.coral);
cube(0.36, 0.36, 0.08, artXs[1] - 0.24, 3.48, -7.60, M.mint);
cube(0.36, 0.36, 0.08, artXs[1] + 0.24, 3.48, -7.60, M.mint);
cube(0.24, 0.24, 0.09, artXs[1], 3.48, -7.59, M.gold);
// Pixel mountain artwork.
cube(1.35, 0.35, 0.08, artXs[2], 2.45, -7.61, M.teal);
cube(0.9, 0.55, 0.08, artXs[2] - 0.2, 2.8, -7.60, M.navy);
cube(0.9, 0.55, 0.08, artXs[2] + 0.2, 2.8, -7.60, M.navy);
cube(0.42, 0.3, 0.09, artXs[2] - 0.2, 3.08, -7.59, M.white);
cube(0.42, 0.3, 0.09, artXs[2] + 0.2, 3.08, -7.59, M.white);
cube(0.23, 0.23, 0.09, artXs[2] + 0.45, 2.43, -7.59, M.gold);
// Class backdrop.
cube(8.05, 4.65, 0.15, 5.25, 3.1, -8.08, M.navy);
pixelText("CLASS OF", 0.165, 5.25, 5.13, -7.94, M.gold);
pixelText("2026", 0.225, 5.25, 3.8, -7.94, M.white);
// Voxel bunting.
cube(18.1, 0.055, 0.07, 0, 5.98, -7.95, M.gold);
const flagMats = [M.teal, M.gold, M.coral, M.mint, M.blue];
for (let i = 0; i < 17; i++) {
cube(
0.45,
0.32 + (i % 2) * 0.12,
0.1,
-8.1 + i * 1.01,
5.68 - (i % 2) * 0.1,
-7.91,
flagMats[i % flagMats.length],
scene,
false,
false
);
}
// -----------------------------------------------------------
// Voxel people
// -----------------------------------------------------------
const standingPeople = [];
const seatedPeople = [];
function createStandingPerson({
outfit = M.navy,
skin = M.skin1,
hair = M.hair1,
gown = false,
cap = false,
scale = 1,
phase = 0
}) {
const group = new THREE.Group();
group.scale.setScalar(scale);
scene.add(group);
cube(0.64, 0.66, 0.4, 0, 1.02, 0, outfit, group);
cube(0.16, 0.18, 0.16, 0, 1.4, 0, skin, group);
if (gown) {
cube(0.78, 0.27, 0.5, 0, 0.67, 0, outfit, group);
}
const legL = new THREE.Group();
const legR = new THREE.Group();
legL.position.set(-0.16, 0.7, 0);
legR.position.set(0.16, 0.7, 0);
group.add(legL, legR);
for (const leg of [legL, legR]) {
cube(0.22, 0.56, 0.25, 0, -0.28, 0, M.ink, leg);
cube(0.24, 0.1, 0.37, 0, -0.56, 0.07, M.ink, leg);
}
const armL = new THREE.Group();
const armR = new THREE.Group();
armL.position.set(-0.4, 1.29, 0);
armR.position.set(0.4, 1.29, 0);
group.add(armL, armR);
cube(0.18, 0.56, 0.22, 0, -0.28, 0, outfit, armL);
cube(0.18, 0.56, 0.22, 0, -0.28, 0, outfit, armR);
cube(0.16, 0.14, 0.17, 0, -0.57, 0, skin, armL);
cube(0.16, 0.14, 0.17, 0, -0.57, 0, skin, armR);
const headPivot = new THREE.Group();
headPivot.position.set(0, 1.34, 0);
group.add(headPivot);
cube(0.46, 0.46, 0.46, 0, 0.23, 0, skin, headPivot);
cube(0.49, 0.13, 0.49, 0, 0.45, 0, hair, headPivot);
cube(0.055, 0.055, 0.035, -0.1, 0.25, 0.242, M.ink, headPivot, false);
cube(0.055, 0.055, 0.035, 0.1, 0.25, 0.242, M.ink, headPivot, false);
if (cap) {
cube(0.69, 0.1, 0.62, 0, 0.53, 0, M.ink, headPivot);
cube(0.4, 0.17, 0.37, 0, 0.64, 0, M.ink, headPivot);
cube(0.055, 0.25, 0.055, 0.28, 0.4, 0.22, M.gold, headPivot);
cube(0.09, 0.09, 0.09, 0.28, 0.27, 0.25, M.gold, headPivot);
}
return {
group,
headPivot,
legL,
legR,
armL,
armR,
phase
};
}
function createSeatedPerson({
outfit,
skin,
hair,
scale = 1,
phase = 0
}) {
const group = new THREE.Group();
group.scale.setScalar(scale);
scene.add(group);
cube(0.58, 0.59, 0.36, 0, 0.91, 0, outfit, group);
cube(0.16, 0.14, 0.16, 0, 1.25, 0, skin, group);
cube(0.22, 0.22, 0.52, -0.15, 0.51, 0.24, M.navy, group);
cube(0.22, 0.22, 0.52, 0.15, 0.51, 0.24, M.navy, group);
cube(0.2, 0.42, 0.2, -0.15, 0.28, 0.47, M.navy, group);
cube(0.2, 0.42, 0.2, 0.15, 0.28, 0.47, M.navy, group);
cube(0.23, 0.1, 0.34, -0.15, 0.07, 0.53, M.ink, group);
cube(0.23, 0.1, 0.34, 0.15, 0.07, 0.53, M.ink, group);
const armL = new THREE.Group();
const armR = new THREE.Group();
armL.position.set(-0.36, 1.12, 0);
armR.position.set(0.36, 1.12, 0);
group.add(armL, armR);
cube(0.16, 0.44, 0.19, 0, -0.22, 0, outfit, armL);
cube(0.16, 0.44, 0.19, 0, -0.22, 0, outfit, armR);
cube(0.14, 0.12, 0.15, 0, -0.46, 0, skin, armL);
cube(0.14, 0.12, 0.15, 0, -0.46, 0, skin, armR);
const headPivot = new THREE.Group();
headPivot.position.set(0, 1.18, 0);
group.add(headPivot);
cube(0.44, 0.44, 0.44, 0, 0.23, 0, skin, headPivot);
cube(0.47, 0.13, 0.47, 0, 0.44, 0, hair, headPivot);
cube(0.05, 0.05, 0.035, -0.1, 0.25, 0.232, M.ink, headPivot, false);
cube(0.05, 0.05, 0.035, 0.1, 0.25, 0.232, M.ink, headPivot, false);
return {
group,
headPivot,
armL,
armR,
phase
};
}
function createChair(x, z, index) {
const group = new THREE.Group();
group.position.set(x, FLOOR_Y, z);
scene.add(group);
cube(0.78, 0.14, 0.74, 0, 0.48, 0, M.blue, group);
cube(0.78, 0.7, 0.12, 0, 0.82, 0.33, M.blue, group);
cube(0.1, 0.42, 0.1, -0.29, 0.23, -0.25, M.navy, group);
cube(0.1, 0.42, 0.1, 0.29, 0.23, -0.25, M.navy, group);
cube(0.1, 0.42, 0.1, -0.29, 0.23, 0.25, M.navy, group);
cube(0.1, 0.42, 0.1, 0.29, 0.23, 0.25, M.navy, group);
if (index % 3 === 0) {
cube(0.23, 0.035, 0.3, 0.2, 0.57, 0.05, M.cream, group, false);
}
}
const rows = [-0.55, 1.35, 3.25, 5.15];
const columns = [-6.2, -4.55, -2.9, 2.9, 4.55, 6.2];
const occupancy = [
[1, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 0, 1],
[1, 0, 1, 1, 1, 1],
[1, 1, 0, 0, 1, 1]
];
const outfitMats = [
M.outfit1,
M.outfit2,
M.outfit3,
M.outfit4,
M.outfit5,
M.outfit6,
M.teal,
M.navy
];
const skinMats = [M.skin1, M.skin2, M.skin3, M.skin4];
const hairMats = [M.hair1, M.hair2, M.hair3, M.hair4];
let audienceIndex = 0;
for (let row = 0; row < rows.length; row++) {
for (let col = 0; col < columns.length; col++) {
if (!occupancy[row][col]) continue;
const x = columns[col];
const z = rows[row];
createChair(x, z, audienceIndex);
const family = row === 0 && col >= 3;
const child = family && col === 4;
const outfit = family
? col === 4
? M.gold
: M.outfit5
: outfitMats[(audienceIndex * 3 + row) % outfitMats.length];
const skin = family
? M.skin2
: skinMats[(audienceIndex + row * 2) % skinMats.length];
const hair = family
? M.hair1
: hairMats[(audienceIndex + col) % hairMats.length];
const person = createSeatedPerson({
outfit,
skin,
hair,
scale: child ? 0.73 : 0.96 + (audienceIndex % 3) * 0.035,
phase: audienceIndex * 0.91
});
person.group.position.set(x, FLOOR_Y, z);
person.group.rotation.y = Math.PI;
seatedPeople.push(person);
audienceIndex++;
}
}
// Faculty members on stage.
const official = createStandingPerson({
outfit: M.navy,
skin: M.skin4,
hair: M.hair4,
scale: 0.98
});
official.group.position.set(3.35, STAGE_Y, -4.75);
official.group.rotation.y = -Math.PI / 2;
official.handAnchor = new THREE.Object3D();
official.handAnchor.position.set(0.42, 1.0, 0.32);
official.group.add(official.handAnchor);
standingPeople.push(official);
const announcer = createStandingPerson({
outfit: M.teal,
skin: M.skin3,
hair: M.hair4,
scale: 0.92
});
announcer.group.position.set(5.6, STAGE_Y, -6.15);
announcer.group.rotation.y = 0;
standingPeople.push(announcer);
// Podium and diploma table.
cube(1.05, 1.18, 0.85, 5.6, STAGE_Y + 0.59, -5.38, M.wood);
cube(1.3, 0.16, 1.05, 5.6, STAGE_Y + 1.24, -5.38, M.stageTop);
cube(2.25, 0.16, 0.88, 4.05, STAGE_Y + 0.85, -6.45, M.wood);
cube(0.15, 0.82, 0.68, 3.15, STAGE_Y + 0.41, -6.45, M.navy);
cube(0.15, 0.82, 0.68, 4.95, STAGE_Y + 0.41, -6.45, M.navy);
for (let i = 0; i < 5; i++) {
cube(
0.36,
0.055,
0.48,
4.25,
STAGE_Y + 0.97 + i * 0.055,
-6.38,
M.cream,
scene,
false
);
}
// Voxel planters.
for (const x of [-8.2, 8.2]) {
cube(0.72, 0.72, 0.72, x, STAGE_Y + 0.36, -6.35, M.coral);
cube(0.18, 0.65, 0.18, x, STAGE_Y + 0.97, -6.35, M.greenDark);
cube(0.58, 0.45, 0.55, x - 0.16, STAGE_Y + 1.22, -6.35, M.green);
cube(0.5, 0.45, 0.52, x + 0.18, STAGE_Y + 1.38, -6.35, M.greenDark);
}
// -----------------------------------------------------------
// Recipients and ceremony sequence
// -----------------------------------------------------------
const recipientData = [
{
name: "Maya Chen",
award: "Valedictorian Address",
shortAward: "Valedictorian",
color: M.mint,
cssColor: "#78a89c",
skin: M.skin4,
hair: M.hair4
},
{
name: "Leo Brooks",
award: "Highest Honors in Academics",
shortAward: "Highest Honors",
color: M.gold,
cssColor: "#d6a444",
skin: M.skin2,
hair: M.hair1
},
{
name: "Amara Patel",
award: "Leadership & Community Service",
shortAward: "Leadership Award",
color: M.coral,
cssColor: "#d87360",
skin: M.skin3,
hair: M.hair1
}
];
function createCertificate() {
const group = new THREE.Group();
cube(0.49, 0.65, 0.08, 0, 0, 0, M.gold, group);
cube(0.4, 0.56, 0.1, 0, 0, 0.015, M.cream, group);
cube(0.1, 0.1, 0.12, 0, -0.08, 0.085, M.coral, group, false);
group.visible = false;
scene.add(group);
return group;
}
const recipients = recipientData.map((data, index) => {
const person = createStandingPerson({
outfit: data.color,
skin: data.skin,
hair: data.hair,
gown: true,
cap: true,
phase: index * 1.7
});
const handAnchor = new THREE.Object3D();
handAnchor.position.set(0.42, 1.0, 0.32);
person.group.add(handAnchor);
const startZ = 6.4 + index * 0.85;
const start = new THREE.Vector3(8.3, FLOOR_Y, startZ);
const holding = new THREE.Vector3(8.3, FLOOR_Y, 1.0 + index * 0.9);
const frames = [
{ t: 0.0, p: start, yaw: -Math.PI / 2 },
{ t: 2.7, p: new THREE.Vector3(0, FLOOR_Y, startZ), yaw: -Math.PI / 2 },
{ t: 3.3, p: new THREE.Vector3(0, FLOOR_Y, startZ), yaw: Math.PI },
{ t: 5.7, p: new THREE.Vector3(0, FLOOR_Y, -2.45), yaw: Math.PI },
{ t: 6.4, p: new THREE.Vector3(0, STAGE_Y, -3.55), yaw: Math.PI },
{ t: 7.2, p: new THREE.Vector3(1.2, STAGE_Y, -4.25), yaw: 0 },
{ t: 10.2, p: new THREE.Vector3(1.2, STAGE_Y, -4.25), yaw: 0 },
{ t: 11.0, p: new THREE.Vector3(1.2, STAGE_Y, -3.55), yaw: Math.PI },
{ t: 11.6, p: new THREE.Vector3(0, FLOOR_Y, -2.45), yaw: Math.PI },
{ t: 12.4, p: new THREE.Vector3(0, FLOOR_Y, 6.4), yaw: Math.PI },
{ t: 13.0, p: new THREE.Vector3(8.3, FLOOR_Y, 6.4), yaw: -Math.PI / 2 },
{ t: 13.7, p: holding, yaw: Math.PI }
];
return {
...data,
person,
handAnchor,
certificate: createCertificate(),
frames,
start,
holding
};
});
// Small numbered signs show the recipient order beside the processional lane.
recipients.forEach((recipient, index) => {
const z = 6.4 + index * 0.85;
cube(0.08, 1.25, 0.08, 9.28, FLOOR_Y + 0.62, z, M.wood);
cube(0.7, 0.7, 0.13, 9.28, FLOOR_Y + 1.32, z, M.navy);
pixelText(
String(index + 1),
0.09,
9.28,
FLOOR_Y + 1.13,
z + 0.09,
M.gold
);
});
// -----------------------------------------------------------
// UI and ceremony state
// -----------------------------------------------------------
const orderList = document.getElementById("order-list");
const awardName = document.getElementById("award-name");
const awardDetail = document.getElementById("award-detail");
const phaseLabel = document.getElementById("phase-label");
const phaseCount = document.getElementById("phase-count");
const progressFill = document.getElementById("progress-fill");
const liveText = document.getElementById("live-text");
const pauseButton = document.getElementById("pause-button");
const nextButton = document.getElementById("next-button");
recipientData.forEach((recipient, index) => {
const button = document.createElement("button");
button.className = "recipient";
button.style.setProperty("--recipient-color", recipient.cssColor);
button.setAttribute("aria-label", `Play recipient ${index + 1}: ${recipient.name}`);
button.innerHTML = `
<span class="rank">${index + 1}</span>
<span>
<span class="recipient-name">${recipient.name}</span>
<span class="recipient-award">${recipient.shortAward}</span>
</span>
<span class="recipient-status">•</span>
`;
button.addEventListener("click", () => {
resetCeremony();
ceremonyTime = index * STEP;
paused = false;
pauseButton.textContent = "Pause";
});
orderList.appendChild(button);
recipients[index].button = button;
});
const STEP = 14;
const TOTAL = STEP * recipientData.length;
let ceremonyTime = 0;
let paused = false;
let worldTime = 0;
function resetCeremony() {
ceremonyTime = 0;
for (const recipient of recipients) {
recipient.person.group.position.copy(recipient.start);
recipient.person.group.rotation.y = -Math.PI / 2;
recipient.person.legL.rotation.x = 0;
recipient.person.legR.rotation.x = 0;
recipient.person.armL.rotation.x = -0.04;
recipient.person.armR.rotation.x = -0.04;
recipient.person.headPivot.rotation.set(0, 0, 0);
scene.add(recipient.certificate);
recipient.certificate.visible = false;
recipient.certificate.position.set(0, 0, 0);
recipient.certificate.rotation.set(0, 0, 0);
}
}
function lerpAngle(a, b, t) {
let delta = ((b - a + Math.PI) % (Math.PI * 2)) - Math.PI;
if (delta < -Math.PI) delta += Math.PI * 2;
return a + delta * t;
}
function samplePath(recipient, time) {
const frames = recipient.frames;
if (time <= frames[0].t) {
return {
position: frames[0].p.clone(),
yaw: frames[0].yaw,
moving: false
};
}
if (time >= frames[frames.length - 1].t) {
const last = frames[frames.length - 1];
return {
position: last.p.clone(),
yaw: last.yaw,
moving: false
};
}
for (let i = 0; i < frames.length - 1; i++) {
const a = frames[i];
const b = frames[i + 1];
if (time >= a.t && time <= b.t) {
const u = (time - a.t) / (b.t - a.t);
return {
position: a.p.clone().lerp(b.p, u),
yaw: lerpAngle(a.yaw, b.yaw, u),
moving: a.p.distanceTo(b.p) > 0.08
};
}
}
return {
position: frames[0].p.clone(),
yaw: frames[0].yaw,
moving: false
};
}
const tempStart = new THREE.Vector3();
const tempEnd = new THREE.Vector3();
function updateRecipients() {
let handoffAmount = 0;
recipients.forEach((recipient, index) => {
const localTime = ceremonyTime - index * STEP;
const sample = samplePath(recipient, Math.max(0, localTime));
const bob = sample.moving
? Math.abs(Math.sin(worldTime * 10 + recipient.person.phase)) * 0.035
: 0;
recipient.person.group.position.copy(sample.position);
recipient.person.group.position.y += bob;
recipient.person.group.rotation.y = sample.yaw;
const stride = sample.moving
? Math.sin(worldTime * 10 + recipient.person.phase) * 0.52
: 0;
recipient.person.legL.rotation.x = stride;
recipient.person.legR.rotation.x = -stride;
const onAwardArea =
localTime >= 7.2 && localTime <= 10.2;
const carrying = localTime >= 8.35;
if (carrying) {
recipient.person.armR.rotation.x = -1.0;
recipient.person.armL.rotation.x = -0.08;
} else if (onAwardArea) {
recipient.person.armR.rotation.x = -1.05;
recipient.person.armL.rotation.x = -0.35;
} else {
recipient.person.armL.rotation.x = -stride * 0.72 - 0.04;
recipient.person.armR.rotation.x = stride * 0.72 - 0.04;
}
const bow =
localTime >= 7.3 && localTime <= 9.7
? Math.sin(
Math.min(1, Math.max(0, (localTime - 7.3) / 0.45)) *
Math.PI
) * 0.16
: 0;
recipient.person.headPivot.rotation.x = bow;
recipient.person.headPivot.rotation.y = 0;
if (localTime >= 7.2 && localTime <= 8.35) {
handoffAmount = Math.max(
handoffAmount,
(localTime - 7.2) / 1.15
);
}
const certificate = recipient.certificate;
if (localTime < 7.2) {
certificate.visible = false;
if (certificate.parent !== scene) scene.add(certificate);
} else if (localTime < 8.35) {
certificate.visible = true;
if (certificate.parent !== scene) scene.add(certificate);
official.handAnchor.getWorldPosition(tempStart);
recipient.handAnchor.getWorldPosition(tempEnd);
const handoff = Math.min(
1,
Math.max(0, (localTime - 7.2) / 1.15)
);
const eased = handoff * handoff * (3 - 2 * handoff);
certificate.position.lerpVectors(tempStart, tempEnd, eased);
certificate.position.y += Math.sin(eased * Math.PI) * 0.38;
certificate.rotation.set(0, 0, Math.sin(eased * Math.PI) * 0.18);
} else {
certificate.visible = true;
if (certificate.parent !== recipient.person.group) {
recipient.person.group.add(certificate);
}
certificate.position.copy(recipient.handAnchor.position);
certificate.rotation.set(0, 0, 0.08);
}
});
official.armR.rotation.x =
handoffAmount > 0 ? -0.75 - handoffAmount * 0.35 : -0.05;
official.headPivot.rotation.y = -0.08;
announcer.armR.rotation.x = -0.92;
announcer.headPivot.rotation.y =
Math.sin(worldTime * 0.8) * 0.06;
}
function updateAudience() {
let applause = 0;
for (let i = 0; i < recipientData.length; i++) {
const localTime = ceremonyTime - i * STEP;
if (localTime >= 7.35 && localTime <= 9.65) {
const entrance = Math.min(
1,
Math.max(0, (localTime - 7.35) / 0.55)
);
const exit = Math.min(
1,
Math.max(0, (9.65 - localTime) / 0.55)
);
applause = Math.max(applause, entrance * exit);
}
}
for (const person of seatedPeople) {
const clap =
applause *
(0.5 + 0.5 * Math.sin(worldTime * 9.5 + person.phase));
person.armL.rotation.x = -0.62 + clap * 0.42;
person.armR.rotation.x = -0.62 - clap * 0.42;
person.headPivot.rotation.y =
Math.sin(worldTime * 0.55 + person.phase) * 0.08;
person.headPivot.rotation.x = applause * 0.035;
}
}
function updateUI() {
const complete = ceremonyTime >= TOTAL;
const currentIndex = complete
? recipientData.length - 1
: Math.min(
recipientData.length - 1,
Math.floor(ceremonyTime / STEP)
);
const localTime = ceremonyTime - currentIndex * STEP;
const current = recipientData[currentIndex];
recipients.forEach((recipient, index) => {
const itemComplete = ceremonyTime >= (index + 1) * STEP;
const isCurrent = !complete && index === currentIndex;
recipient.button.classList.toggle("completed", itemComplete);
recipient.button.classList.toggle("current", isCurrent);
recipient.button.querySelector(".recipient-status").textContent =
itemComplete ? "✓" : isCurrent ? "●" : "•";
});
if (complete) {
awardName.textContent = "Ceremony complete";
awardDetail.textContent = "Three honors presented to the Class of 2026";
phaseLabel.textContent = "Graduation complete";
phaseCount.textContent = "3 of 3";
liveText.textContent = "Ceremony complete";
nextButton.disabled = true;
nextButton.textContent = "Next recipient";
pauseButton.disabled = true;
} else {
awardName.textContent = current.name;
awardDetail.textContent = current.award;
phaseCount.textContent = `${currentIndex + 1} of ${recipientData.length}`;
liveText.textContent = paused ? "Ceremony paused" : "Ceremony in progress";
nextButton.disabled = false;
pauseButton.disabled = false;
if (localTime < 3.3) {
phaseLabel.textContent = "Processional";
} else if (localTime < 7.2) {
phaseLabel.textContent = "Approaching the stage";
} else if (localTime < 10.2) {
phaseLabel.textContent = "Award presentation";
} else if (localTime < 13.7) {
phaseLabel.textContent = "Returning to the family section";
} else {
phaseLabel.textContent = "Ready for the next honoree";
}
}
progressFill.style.width = `${Math.min(100, (ceremonyTime / TOTAL) * 100)}%`;
}
pauseButton.addEventListener("click", () => {
if (ceremonyTime >= TOTAL) return;
paused = !paused;
pauseButton.textContent = paused ? "Resume" : "Pause";
});
nextButton.addEventListener("click", () => {
const currentIndex = Math.min(
recipientData.length - 1,
Math.floor(ceremonyTime / STEP)
);
ceremonyTime = Math.min(TOTAL, (currentIndex + 1) * STEP);
paused = false;
pauseButton.textContent = "Pause";
});
document.getElementById("replay-button").addEventListener("click", () => {
resetCeremony();
paused = false;
pauseButton.textContent = "Pause";
});
// -----------------------------------------------------------
// Direct camera controls: orbit, zoom, and view presets
// -----------------------------------------------------------
const cameraTarget = new THREE.Vector3(0, 1.05, -0.35);
const cameraGoal = {
radius: 25.5,
phi: 0.86,
theta: 0.32
};
const cameraNow = {
radius: cameraGoal.radius,
phi: cameraGoal.phi,
theta: cameraGoal.theta
};
const canvas = renderer.domElement;
let dragging = false;
let pointerX = 0;
let pointerY = 0;
canvas.addEventListener("pointerdown", (event) => {
dragging = true;
pointerX = event.clientX;
pointerY = event.clientY;
canvas.setPointerCapture(event.pointerId);
});
canvas.addEventListener("pointermove", (event) => {
if (!dragging) return;
const dx = event.clientX - pointerX;
const dy = event.clientY - pointerY;
pointerX = event.clientX;
pointerY = event.clientY;
cameraGoal.theta -= dx * 0.005;
cameraGoal.phi = THREE.MathUtils.clamp(
cameraGoal.phi - dy * 0.004,
0.42,
1.32
);
});
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();
cameraGoal.radius = THREE.MathUtils.clamp(
cameraGoal.radius + event.deltaY * 0.012,
14,
34
);
},
{ passive: false }
);
function setHallView() {
cameraTarget.set(0, 1.05, -0.35);
cameraGoal.radius = 25.5;
cameraGoal.phi = 0.86;
cameraGoal.theta = 0.32;
}
function setStageView() {
cameraTarget.set(0.2, 2.05, -4.45);
cameraGoal.radius = 17;
cameraGoal.phi = 1.02;
cameraGoal.theta = 0.17;
}
document.getElementById("hall-button").addEventListener("click", setHallView);
document.getElementById("stage-button").addEventListener("click", setStageView);
document.getElementById("reset-button").addEventListener("click", setHallView);
function updateCamera() {
const smoothing = 0.085;
cameraNow.radius +=
(cameraGoal.radius - cameraNow.radius) * smoothing;
cameraNow.phi += (cameraGoal.phi - cameraNow.phi) * smoothing;
cameraNow.theta += (cameraGoal.theta - cameraNow.theta) * smoothing;
const spherical = new THREE.Spherical(
cameraNow.radius,
cameraNow.phi,
cameraNow.theta
);
camera.position.setFromSpherical(spherical).add(cameraTarget);
camera.lookAt(cameraTarget);
}
// -----------------------------------------------------------
// Resize and render loop
// -----------------------------------------------------------
function onResize() {
camera.aspect = innerWidth / innerHeight;
camera.updateProjectionMatrix();
renderer.setPixelRatio(Math.min(devicePixelRatio, 2));
renderer.setSize(innerWidth, innerHeight);
}
addEventListener("resize", onResize);
resetCeremony();
updateUI();
const clock = new THREE.Clock();
function animate() {
requestAnimationFrame(animate);
const dt = Math.min(clock.getDelta(), 0.05);
worldTime += dt;
if (!paused && ceremonyTime < TOTAL) {
ceremonyTime = Math.min(TOTAL, ceremonyTime + dt);
}
updateRecipients();
updateAudience();
updateCamera();
updateUI();
renderer.render(scene, camera);
}
animate();
</script>
</body>
</html>
```