Prompt specification
Build or customize the Three.js 3D scene "Festival Rehearsal Circle" 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: Festival Rehearsal Circle
Category: Voxel Worlds · Style: Voxel 3D
License: MIT · Reference: https://three3d.app/scene/festival-rehearsal-circle-x3299
Scene Description Prompt:
Build an imagined community dance rehearsal with alternating solo and group sections. Use original choreography and avoid attributing invented steps to a real cultural group. Build this with Three.js from cdnjs as a voxel scene in one self-contained HTML file.
Working Three.js Starter (festival-rehearsal-circle-x3299):
```html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Move Lab — Community Dance Rehearsal</title>
<style>
:root {
color-scheme: dark;
--ink: #172429;
--paper: #f7f0df;
--muted: rgba(247, 240, 223, 0.68);
--glass: rgba(18, 31, 35, 0.78);
--line: rgba(255, 255, 255, 0.14);
--solo: #ffca68;
--group: #71d6c6;
}
* {
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: #c9b99f;
font-family:
Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
"Segoe UI", sans-serif;
}
body {
color: var(--paper);
}
canvas {
display: block;
width: 100%;
height: 100%;
touch-action: none;
cursor: grab;
}
canvas.dragging {
cursor: grabbing;
}
.vignette {
position: fixed;
inset: 0;
pointer-events: none;
background:
linear-gradient(180deg, rgba(12, 23, 26, 0.22), transparent 24%),
linear-gradient(0deg, rgba(12, 23, 26, 0.48), transparent 37%),
radial-gradient(circle at center, transparent 46%, rgba(12, 23, 26, 0.18));
}
.topbar {
position: fixed;
top: 22px;
left: 24px;
right: 24px;
display: flex;
justify-content: space-between;
align-items: flex-start;
gap: 18px;
pointer-events: none;
}
.brand {
max-width: 440px;
text-shadow: 0 2px 16px rgba(0, 0, 0, 0.25);
}
.eyebrow {
margin-bottom: 7px;
color: var(--solo);
font-size: 11px;
font-weight: 800;
letter-spacing: 0.23em;
text-transform: uppercase;
}
h1 {
margin: 0;
font-size: clamp(27px, 4vw, 52px);
line-height: 0.96;
letter-spacing: -0.055em;
}
.brand p {
max-width: 370px;
margin: 12px 0 0;
color: rgba(255, 255, 255, 0.76);
font-size: 13px;
line-height: 1.5;
}
.badge {
display: flex;
align-items: center;
gap: 9px;
padding: 10px 13px;
border: 1px solid var(--line);
border-radius: 999px;
background: rgba(16, 30, 34, 0.64);
backdrop-filter: blur(12px);
font-size: 11px;
font-weight: 800;
letter-spacing: 0.12em;
text-transform: uppercase;
white-space: nowrap;
}
.badge-dot {
width: 8px;
height: 8px;
border-radius: 50%;
background: var(--solo);
box-shadow: 0 0 16px var(--solo);
}
.panel {
position: fixed;
border: 1px solid var(--line);
border-radius: 18px;
background: var(--glass);
backdrop-filter: blur(16px);
box-shadow: 0 18px 60px rgba(0, 0, 0, 0.22);
}
.section-card {
left: 24px;
bottom: 24px;
width: min(390px, calc(100vw - 48px));
padding: 18px 19px 16px;
}
.section-head {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 14px;
}
.section-kicker {
margin-bottom: 5px;
color: var(--solo);
font-size: 10px;
font-weight: 850;
letter-spacing: 0.18em;
text-transform: uppercase;
}
.section-title {
margin: 0;
font-size: 25px;
letter-spacing: -0.035em;
}
.section-number {
color: rgba(255, 255, 255, 0.25);
font-size: 30px;
font-weight: 850;
letter-spacing: -0.07em;
}
.section-description {
min-height: 38px;
margin: 8px 0 15px;
color: var(--muted);
font-size: 12px;
line-height: 1.45;
}
.timeline {
height: 4px;
overflow: hidden;
border-radius: 999px;
background: rgba(255, 255, 255, 0.12);
}
.timeline-fill {
width: 0;
height: 100%;
border-radius: inherit;
background: var(--solo);
box-shadow: 0 0 12px rgba(255, 202, 104, 0.6);
transition: background-color 0.25s;
}
.timeline-meta {
display: flex;
justify-content: space-between;
margin-top: 8px;
color: rgba(255, 255, 255, 0.5);
font-size: 10px;
font-weight: 700;
letter-spacing: 0.08em;
text-transform: uppercase;
}
.controls {
right: 24px;
bottom: 24px;
display: flex;
align-items: center;
gap: 7px;
padding: 9px;
}
button {
min-height: 38px;
padding: 0 13px;
border: 1px solid rgba(255, 255, 255, 0.12);
border-radius: 11px;
background: rgba(255, 255, 255, 0.07);
color: var(--paper);
font: inherit;
font-size: 11px;
font-weight: 800;
letter-spacing: 0.05em;
cursor: pointer;
transition:
background 0.18s ease,
border-color 0.18s ease,
transform 0.18s ease;
}
button:hover {
background: rgba(255, 255, 255, 0.14);
border-color: rgba(255, 255, 255, 0.25);
transform: translateY(-1px);
}
button.active {
color: var(--ink);
background: var(--solo);
border-color: var(--solo);
}
button.group-active {
color: var(--ink);
background: var(--group);
border-color: var(--group);
}
button:focus-visible {
outline: 2px solid #fff;
outline-offset: 3px;
}
.help {
position: fixed;
right: 25px;
top: 72px;
color: rgba(255, 255, 255, 0.6);
font-size: 10px;
font-weight: 700;
letter-spacing: 0.08em;
text-transform: uppercase;
pointer-events: none;
text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
.credit {
position: fixed;
left: 26px;
top: 72px;
color: rgba(255, 255, 255, 0.48);
font-size: 9px;
font-weight: 700;
letter-spacing: 0.08em;
text-transform: uppercase;
pointer-events: none;
}
@media (max-width: 760px) {
.topbar {
top: 16px;
left: 16px;
right: 16px;
}
.brand p,
.credit,
.help {
display: none;
}
.badge {
padding: 9px 10px;
font-size: 9px;
}
.section-card {
left: 14px;
bottom: 78px;
width: calc(100vw - 28px);
padding: 14px 15px;
}
.section-description {
min-height: 0;
margin-bottom: 11px;
}
.controls {
left: 14px;
right: 14px;
bottom: 14px;
justify-content: center;
overflow-x: auto;
}
button {
flex: 0 0 auto;
padding: 0 11px;
}
}
</style>
</head>
<body>
<div class="vignette"></div>
<header class="topbar">
<div class="brand">
<div class="eyebrow">An imagined community rehearsal</div>
<h1>MOVE LAB</h1>
<p>
A warm, voxel rehearsal room where one voice explores a phrase before
the whole group folds it into a shared pattern.
</p>
</div>
<div class="badge">
<span class="badge-dot"></span>
<span id="modeBadge">Solo study</span>
</div>
</header>
<div class="credit">Original abstract movement study</div>
<div class="help">Drag to orbit · Scroll to zoom</div>
<section class="panel section-card" aria-live="polite">
<div class="section-head">
<div>
<div class="section-kicker" id="sectionKicker">Section 01 · Solo phrase</div>
<h2 class="section-title" id="sectionTitle">Reach & Return</h2>
</div>
<div class="section-number" id="sectionNumber">01</div>
</div>
<p class="section-description" id="sectionDescription">
A lead phrase of side steps, high reaches, and soft turns.
</p>
<div class="timeline">
<div class="timeline-fill" id="timelineFill"></div>
</div>
<div class="timeline-meta">
<span id="timelineLabel">Solo · 12 seconds</span>
<span id="timeLabel">0.0 / 12</span>
</div>
</section>
<nav class="panel controls" aria-label="Rehearsal controls">
<button id="playButton" aria-label="Pause rehearsal">Pause</button>
<button id="soloButton" class="active">Solo</button>
<button id="groupButton">Group</button>
<button id="autoButton" class="active">Auto</button>
<button id="resetButton" aria-label="Reset camera">Reset view</button>
</nav>
<script type="module">
import * as THREE from
"https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
// -------------------------------------------------------------------------
// Renderer, scene, and camera
// -------------------------------------------------------------------------
const scene = new THREE.Scene();
scene.background = new THREE.Color(0xc9b99f);
scene.fog = new THREE.Fog(0xc9b99f, 18, 38);
const camera = new THREE.PerspectiveCamera(
42,
innerWidth / innerHeight,
0.1,
80
);
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.12;
document.body.prepend(renderer.domElement);
const target = new THREE.Vector3(0, 1.15, -0.1);
const cameraState = {
theta: 0.48,
phi: 1.03,
radius: 16.2,
desiredTheta: 0.48,
desiredPhi: 1.03,
desiredRadius: 16.2,
};
function updateCamera(dt, immediate = false) {
const smoothing = immediate ? 1 : 1 - Math.exp(-dt * 9);
cameraState.theta = THREE.MathUtils.lerp(
cameraState.theta,
cameraState.desiredTheta,
smoothing
);
cameraState.phi = THREE.MathUtils.lerp(
cameraState.phi,
cameraState.desiredPhi,
smoothing
);
cameraState.radius = THREE.MathUtils.lerp(
cameraState.radius,
cameraState.desiredRadius,
smoothing
);
const sinPhi = Math.sin(cameraState.phi);
camera.position.set(
target.x + cameraState.radius * sinPhi * Math.sin(cameraState.theta),
target.y + cameraState.radius * Math.cos(cameraState.phi),
target.z + cameraState.radius * sinPhi * Math.cos(cameraState.theta)
);
camera.lookAt(target);
}
updateCamera(1, true);
// Direct pointer camera controls; no addons are imported.
let dragging = false;
let pointerX = 0;
let pointerY = 0;
renderer.domElement.addEventListener("pointerdown", (event) => {
dragging = true;
pointerX = event.clientX;
pointerY = event.clientY;
renderer.domElement.setPointerCapture(event.pointerId);
renderer.domElement.classList.add("dragging");
});
renderer.domElement.addEventListener("pointermove", (event) => {
if (!dragging) return;
const dx = event.clientX - pointerX;
const dy = event.clientY - pointerY;
pointerX = event.clientX;
pointerY = event.clientY;
cameraState.desiredTheta -= dx * 0.006;
cameraState.desiredPhi = THREE.MathUtils.clamp(
cameraState.desiredPhi + dy * 0.005,
0.62,
1.35
);
});
function stopDragging(event) {
dragging = false;
renderer.domElement.classList.remove("dragging");
if (event?.pointerId !== undefined) {
if (renderer.domElement.hasPointerCapture(event.pointerId)) {
renderer.domElement.releasePointerCapture(event.pointerId);
}
}
}
renderer.domElement.addEventListener("pointerup", stopDragging);
renderer.domElement.addEventListener("pointercancel", stopDragging);
renderer.domElement.addEventListener(
"wheel",
(event) => {
event.preventDefault();
cameraState.desiredRadius = THREE.MathUtils.clamp(
cameraState.desiredRadius + event.deltaY * 0.012,
9.5,
25
);
},
{ passive: false }
);
// -------------------------------------------------------------------------
// Materials and construction helpers
// -------------------------------------------------------------------------
const materials = {
wall: new THREE.MeshStandardMaterial({
color: 0xe8dcc3,
roughness: 0.92,
}),
wallTrim: new THREE.MeshStandardMaterial({
color: 0x344b4e,
roughness: 0.84,
}),
dark: new THREE.MeshStandardMaterial({
color: 0x1c292d,
roughness: 0.78,
}),
wood: new THREE.MeshStandardMaterial({
color: 0xb87849,
roughness: 0.9,
}),
cream: new THREE.MeshStandardMaterial({
color: 0xf5e9ce,
roughness: 0.87,
}),
teal: new THREE.MeshStandardMaterial({
color: 0x4c9990,
roughness: 0.82,
}),
coral: new THREE.MeshStandardMaterial({
color: 0xe77761,
roughness: 0.82,
}),
mustard: new THREE.MeshStandardMaterial({
color: 0xe0ad45,
roughness: 0.84,
}),
glass: new THREE.MeshStandardMaterial({
color: 0x87aeb1,
emissive: 0x31575c,
emissiveIntensity: 0.22,
roughness: 0.38,
metalness: 0.05,
}),
lamp: new THREE.MeshStandardMaterial({
color: 0xffe3a1,
emissive: 0xffb95c,
emissiveIntensity: 1.8,
roughness: 0.45,
}),
green: new THREE.MeshStandardMaterial({
color: 0x5d9562,
roughness: 0.9,
}),
greenDark: new THREE.MeshStandardMaterial({
color: 0x315e47,
roughness: 0.92,
}),
pot: new THREE.MeshStandardMaterial({
color: 0xb96848,
roughness: 0.95,
}),
mirror: new THREE.MeshStandardMaterial({
color: 0x78999a,
roughness: 0.34,
metalness: 0.18,
}),
};
const boxGeometry = new THREE.BoxGeometry(1, 1, 1);
function box(
width,
height,
depth,
x,
y,
z,
material,
parent = scene,
castShadow = true,
receiveShadow = true
) {
const mesh = new THREE.Mesh(boxGeometry, material);
mesh.scale.set(width, height, depth);
mesh.position.set(x, y, z);
mesh.castShadow = castShadow;
mesh.receiveShadow = receiveShadow;
parent.add(mesh);
return mesh;
}
// -------------------------------------------------------------------------
// Voxel rehearsal hall
// -------------------------------------------------------------------------
const room = new THREE.Group();
scene.add(room);
// Raised foundation.
box(21.4, 0.42, 15.8, 0, -0.29, 0, materials.wood);
// Individual floor tiles create a visible voxel grid.
const tileCountX = 14;
const tileCountZ = 10;
const tileStep = 1.42;
const tiles = new THREE.InstancedMesh(
boxGeometry,
new THREE.MeshStandardMaterial({
color: 0xffffff,
roughness: 0.91,
}),
tileCountX * tileCountZ
);
const tileMatrix = new THREE.Matrix4();
const floorColors = [
new THREE.Color(0xd7b88b),
new THREE.Color(0xe1c79e),
new THREE.Color(0xcaa978),
new THREE.Color(0xdec098),
];
let tileIndex = 0;
for (let z = 0; z < tileCountZ; z++) {
for (let x = 0; x < tileCountX; x++) {
tileMatrix.makeTranslation(
(x - (tileCountX - 1) / 2) * tileStep,
-0.045,
(z - (tileCountZ - 1) / 2) * tileStep
);
tiles.setMatrixAt(tileIndex, tileMatrix);
const variation = (x * 7 + z * 3) % floorColors.length;
tiles.setColorAt(tileIndex, floorColors[variation]);
tileIndex++;
}
}
tiles.instanceMatrix.needsUpdate = true;
tiles.instanceColor.needsUpdate = true;
tiles.receiveShadow = true;
room.add(tiles);
// Dance-area border.
const borderMaterial = new THREE.MeshStandardMaterial({
color: 0x4f7d78,
roughness: 0.85,
});
box(14.5, 0.035, 0.16, 0, 0.055, -4.75, borderMaterial);
box(14.5, 0.035, 0.16, 0, 0.055, 4.75, borderMaterial);
box(0.16, 0.035, 9.65, -7.25, 0.055, 0, borderMaterial);
box(0.16, 0.035, 9.65, 7.25, 0.055, 0, borderMaterial);
// Back and left walls.
box(21.4, 7, 0.38, 0, 3.3, -7.85, materials.wall);
box(0.38, 7, 15.8, -10.52, 3.3, 0, materials.wall);
// Wall base and picture rail.
box(21.2, 0.45, 0.48, 0, 0.18, -7.62, materials.wallTrim);
box(0.48, 0.45, 15.7, -10.3, 0.18, 0, materials.wallTrim);
box(21.2, 0.13, 0.52, 0, 2.35, -7.58, materials.wood);
box(0.52, 0.13, 15.7, -10.26, 2.35, 0, materials.wood);
function makeWindow(x) {
box(3.75, 2.7, 0.13, x, 3.72, -7.60, materials.glass, room, false);
const trim = materials.cream;
box(4.05, 0.16, 0.18, x, 5.16, -7.49, trim);
box(4.05, 0.16, 0.18, x, 2.28, -7.49, trim);
box(0.16, 3.05, 0.18, x - 1.98, 3.72, -7.49, trim);
box(0.16, 3.05, 0.18, x + 1.98, 3.72, -7.49, trim);
box(0.12, 2.7, 0.17, x, 3.72, -7.47, trim);
box(3.8, 0.12, 0.17, x, 3.72, -7.47, trim);
}
makeWindow(-6.35);
makeWindow(6.35);
// Central mirror.
box(4.5, 2.9, 0.14, 0, 3.55, -7.60, materials.mirror);
box(4.8, 0.17, 0.19, 0, 5.08, -7.49, materials.cream);
box(4.8, 0.17, 0.19, 0, 2.02, -7.49, materials.cream);
box(0.17, 3.25, 0.19, -2.36, 3.55, -7.49, materials.cream);
box(0.17, 3.25, 0.19, 2.36, 3.55, -7.49, materials.cream);
// Voxel wall lettering.
const pixelFont = {
M: [
"10001",
"11011",
"10101",
"10101",
"10001",
"10001",
"10001",
],
O: [
"01110",
"10001",
"10001",
"10001",
"10001",
"10001",
"01110",
],
V: [
"10001",
"10001",
"10001",
"10001",
"10101",
"01010",
"00100",
],
E: [
"11111",
"10000",
"10000",
"11110",
"10000",
"10000",
"11111",
],
L: [
"10000",
"10000",
"10000",
"10000",
"10000",
"10000",
"11111",
],
A: [
"01110",
"10001",
"10001",
"11111",
"10001",
"10001",
"10001",
],
B: [
"11110",
"10001",
"10001",
"11110",
"10001",
"10001",
"11110",
],
" ": [
"00000",
"00000",
"00000",
"00000",
"00000",
"00000",
"00000",
],
};
function makeVoxelText(text, centerX, topY, z, pixel, material) {
const chars = [...text];
const totalWidth = chars.reduce(
(sum, char) => sum + (char === " " ? 3 : 6) * pixel,
0
);
let cursor = centerX - totalWidth / 2;
for (const char of chars) {
const rows = pixelFont[char] || pixelFont[" "];
const width = char === " " ? 3 : 5;
for (let row = 0; row < rows.length; row++) {
for (let col = 0; col < width; col++) {
if (rows[row][col] === "1") {
box(
pixel * 0.86,
pixel * 0.86,
0.07,
cursor + col * pixel,
topY - row * pixel,
z,
material,
room,
false
);
}
}
}
cursor += (width + 1) * pixel;
}
}
makeVoxelText(
"MOVE LAB",
0,
5.78,
-7.47,
0.135,
new THREE.MeshStandardMaterial({
color: 0xf0a15e,
roughness: 0.85,
})
);
// Acoustic blocks.
const acousticColors = [0x486d6e, 0x678b86, 0x36585d, 0x7c9d93];
for (let row = 0; row < 3; row++) {
for (let col = 0; col < 4; col++) {
const mat = new THREE.MeshStandardMaterial({
color: acousticColors[(row + col) % acousticColors.length],
roughness: 0.95,
});
box(
0.46,
0.46,
0.22,
-9.91,
3.05 + row * 0.57,
-4.3 + col * 0.58,
mat,
room,
false
);
}
}
// Practice barre along the left wall.
box(0.13, 0.13, 6.8, -9.98, 1.55, -1.5, materials.wood);
for (const z of [-4.5, -1.5, 1.5]) {
box(0.12, 1.45, 0.12, -10.12, 0.83, z, materials.wallTrim);
}
// Voxel bench.
box(3.1, 0.22, 0.75, -7.2, 0.78, -5.9, materials.wood);
box(0.28, 0.75, 0.62, -8.35, 0.38, -5.9, materials.dark);
box(0.28, 0.75, 0.62, -6.05, 0.38, -5.9, materials.dark);
// Speaker stacks.
function makeSpeaker(x, z) {
box(0.95, 1.85, 0.75, x, 0.94, z, materials.dark);
box(0.69, 0.55, 0.07, x, 1.28, z + 0.405, materials.wallTrim);
box(0.69, 0.55, 0.07, x, 0.54, z + 0.405, materials.wallTrim);
box(0.24, 0.24, 0.09, x, 1.28, z + 0.45, materials.teal);
box(0.24, 0.24, 0.09, x, 0.54, z + 0.45, materials.teal);
}
makeSpeaker(-9.15, -6.65);
makeSpeaker(9.15, -6.65);
// Voxel plants.
function makePlant(x, z, scale = 1) {
const plant = new THREE.Group();
plant.position.set(x, 0, z);
plant.scale.setScalar(scale);
room.add(plant);
box(0.78, 0.72, 0.78, 0, 0.37, 0, materials.pot, plant);
box(0.5, 0.15, 0.5, 0, 0.77, 0, materials.greenDark, plant);
box(0.15, 1.15, 0.15, 0, 1.18, 0, materials.greenDark, plant);
box(0.64, 0.4, 0.42, -0.26, 1.34, 0, materials.green, plant);
box(0.58, 0.42, 0.38, 0.28, 1.64, 0.02, materials.green, plant);
box(0.48, 0.38, 0.42, -0.05, 1.95, 0, materials.greenDark, plant);
}
makePlant(-8.7, -5.6, 1.05);
makePlant(8.7, -5.6, 1.05);
makePlant(8.9, 4.7, 0.78);
// Hanging cube lamps.
for (const [x, z] of [
[-4.7, -1.7],
[0, -1.7],
[4.7, -1.7],
]) {
box(0.045, 2.4, 0.045, x, 5.7, z, materials.dark);
box(1.0, 0.22, 1.0, x, 4.38, z, materials.dark);
box(0.72, 0.18, 0.72, x, 4.19, z, materials.lamp);
const light = new THREE.PointLight(0xffd18a, 18, 8, 2);
light.position.set(x, 3.95, z);
scene.add(light);
}
// -------------------------------------------------------------------------
// Lighting
// -------------------------------------------------------------------------
scene.add(new THREE.HemisphereLight(0xfff3dc, 0x60717a, 1.7));
const keyLight = new THREE.DirectionalLight(0xffefd5, 3.2);
keyLight.position.set(-5, 12, 9);
keyLight.castShadow = true;
keyLight.shadow.mapSize.set(2048, 2048);
keyLight.shadow.camera.left = -13;
keyLight.shadow.camera.right = 13;
keyLight.shadow.camera.top = 12;
keyLight.shadow.camera.bottom = -12;
keyLight.shadow.camera.near = 1;
keyLight.shadow.camera.far = 35;
keyLight.shadow.bias = -0.0004;
scene.add(keyLight);
const rimLight = new THREE.DirectionalLight(0x8bc8d1, 1.4);
rimLight.position.set(9, 7, -8);
scene.add(rimLight);
// -------------------------------------------------------------------------
// Articulated voxel dancers
// -------------------------------------------------------------------------
const dancers = [];
const skinColors = [
0xf2bd91,
0xd99568,
0xb96f4c,
0x855238,
0xe2a87c,
0xc9865d,
0xf0c39c,
];
const outfitColors = [
0x278b86, // lead: teal
0xe6785f,
0xd6a943,
0x557da9,
0x986682,
0x6f9d62,
0xd98247,
];
const trouserColors = [
0x263f4c,
0x594c5d,
0x40556a,
0x5c4e42,
0x334e52,
0x57464b,
0x455464,
];
function makeDancer(index) {
const root = new THREE.Group();
root.scale.setScalar(index === 0 ? 1.05 : 0.96 + (index % 3) * 0.025);
scene.add(root);
const skin = new THREE.MeshStandardMaterial({
color: skinColors[index],
roughness: 0.88,
});
const shirt = new THREE.MeshStandardMaterial({
color: outfitColors[index],
roughness: 0.83,
});
const pants = new THREE.MeshStandardMaterial({
color: trouserColors[index],
roughness: 0.88,
});
const shoe = new THREE.MeshStandardMaterial({
color: index === 0 ? 0xffcc63 : 0xf0dfbd,
roughness: 0.82,
});
const hair = new THREE.MeshStandardMaterial({
color: [0x272423, 0x4a3028, 0x171a1b, 0x6a4632][index % 4],
roughness: 0.95,
});
// Pelvis and torso.
box(0.61, 0.29, 0.38, 0, 1.04, 0, pants, root);
const torso = new THREE.Group();
torso.position.y = 1.35;
root.add(torso);
box(0.72, 0.61, 0.42, 0, 0, 0, shirt, torso);
box(0.75, 0.12, 0.44, 0, -0.2, 0, pants, torso);
// Neck and head.
box(0.18, 0.19, 0.18, 0, 0.41, 0, skin, torso);
const head = new THREE.Group();
head.position.set(0, 0.72, 0);
torso.add(head);
box(0.48, 0.49, 0.46, 0, 0, 0, skin, head);
box(0.5, 0.18, 0.48, 0, 0.19, -0.01, hair, head);
box(0.52, 0.24, 0.16, 0, 0.11, -0.19, hair, head);
if (index === 1 || index === 4) {
box(0.2, 0.42, 0.2, 0.24, -0.03, -0.2, hair, head);
}
const eyeMaterial = new THREE.MeshBasicMaterial({ color: 0x1c2526 });
box(0.065, 0.075, 0.03, -0.105, 0.035, 0.241, eyeMaterial, head, false);
box(0.065, 0.075, 0.03, 0.105, 0.035, 0.241, eyeMaterial, head, false);
box(0.11, 0.025, 0.03, 0, -0.105, 0.242, eyeMaterial, head, false);
// Nose.
box(0.075, 0.08, 0.06, 0, -0.025, 0.255, skin, head, false);
function makeArm(side) {
const shoulder = new THREE.Group();
shoulder.position.set(side * 0.48, 0.23, 0);
torso.add(shoulder);
box(0.2, 0.43, 0.23, 0, -0.215, 0, shirt, shoulder);
const elbow = new THREE.Group();
elbow.position.y = -0.43;
shoulder.add(elbow);
box(0.17, 0.39, 0.19, 0, -0.195, 0, skin, elbow);
box(0.19, 0.16, 0.22, 0, -0.43, 0.01, skin, elbow);
return { shoulder, elbow };
}
function makeLeg(side) {
const hip = new THREE.Group();
hip.position.set(side * 0.2, 1.02, 0);
root.add(hip);
box(0.23, 0.44, 0.25, 0, -0.22, 0, pants, hip);
const knee = new THREE.Group();
knee.position.y = -0.44;
hip.add(knee);
box(0.21, 0.43, 0.23, 0, -0.215, 0, pants, knee);
box(0.25, 0.15, 0.39, 0, -0.45, 0.09, shoe, knee);
return { hip, knee };
}
const leftArm = makeArm(-1);
const rightArm = makeArm(1);
const leftLeg = makeLeg(-1);
const rightLeg = makeLeg(1);
// A contrasting waistband helps the voxel silhouettes read clearly.
box(0.64, 0.08, 0.42, 0, 1.06, 0, shoe, root);
const dancer = {
root,
torso,
head,
leftArm,
rightArm,
leftLeg,
rightLeg,
};
dancers.push(dancer);
return dancer;
}
for (let i = 0; i < 7; i++) {
makeDancer(i);
}
// -------------------------------------------------------------------------
// Original choreography
//
// "Reach & Return" is an invented solo phrase.
// "Four-Corner Current" is an invented ensemble phrase.
// Neither is presented as a named cultural practice.
// -------------------------------------------------------------------------
const durations = {
solo: 12,
group: 14,
};
const soloPositions = [
[0, 3.65],
[-4.8, -1.4],
[-3.1, -2.4],
[-1.4, -2.7],
[1.4, -2.7],
[3.1, -2.4],
[4.8, -1.4],
];
const groupPositions = [
[-4.8, 0.7],
[-3.2, -1.4],
[-1.6, -0.2],
[0, 1.4],
[1.6, -0.2],
[3.2, -1.4],
[4.8, 0.7],
];
const soloPhrase = [
{
ra: 0.22,
la: 0.18,
rax: 0,
lax: 0,
rex: 0,
lex: 0,
lr: 0.04,
ll: -0.04,
lrx: 0,
llx: 0,
lean: 0,
twist: 0,
},
{
ra: 2.05,
la: 0.2,
rax: -0.38,
lax: 0.12,
rex: -0.65,
lex: -0.08,
lr: 0.3,
ll: -0.18,
lrx: -0.3,
llx: 0.2,
lean: -0.11,
twist: 0.1,
},
{
ra: 0.3,
la: 2.18,
rax: 0.12,
lax: -0.42,
rex: -0.08,
lex: -0.68,
lr: -0.26,
ll: 0.3,
lrx: 0.2,
llx: -0.3,
lean: 0.11,
twist: -0.1,
},
{
ra: 0.72,
la: 0.68,
rax: -0.72,
lax: -0.72,
rex: -0.22,
lex: -0.22,
lr: -0.34,
ll: 0.34,
lrx: 0.38,
llx: -0.38,
lean: 0,
twist: 0,
},
];
const groupPhrase = [
{
ra: 1.02,
la: 0.92,
rax: 0,
lax: 0,
rex: -0.08,
lex: -0.08,
lr: 0.05,
ll: -0.05,
lrx: 0,
llx: 0,
lean: 0,
twist: 0,
},
{
ra: 2.55,
la: 2.4,
rax: -0.08,
lax: -0.08,
rex: -0.18,
lex: -0.18,
lr: 0.08,
ll: -0.08,
lrx: -0.08,
llx: 0.08,
lean: -0.035,
twist: 0.025,
},
{
ra: 0.3,
la: 0.24,
rax: -0.5,
lax: -0.5,
rex: -0.7,
lex: -0.7,
lr: -0.14,
ll: 0.14,
lrx: 0.16,
llx: -0.16,
lean: 0.035,
twist: -0.025,
},
{
ra: 1.35,
la: 1.28,
rax: -0.2,
lax: -0.2,
rex: -0.28,
lex: -0.28,
lr: -0.18,
ll: 0.18,
lrx: 0.2,
llx: -0.2,
lean: 0,
twist: 0,
},
];
function smoothStep(value) {
return value * value * (3 - 2 * value);
}
function samplePhrase(phrase, time, phraseDuration = 4) {
const scaled = (time % phraseDuration) / phraseDuration;
const index = Math.floor(scaled * phrase.length);
const nextIndex = (index + 1) % phrase.length;
const amount = smoothStep((scaled * phrase.length) % 1);
const a = phrase[index];
const b = phrase[nextIndex];
const result = {};
for (const key of Object.keys(a)) {
result[key] = THREE.MathUtils.lerp(a[key], b[key], amount);
}
return result;
}
function applyPose(dancer, pose, t, energy = 1) {
const breathe = Math.sin(t * 2.1) * 0.018;
dancer.torso.rotation.z = pose.lean + breathe;
dancer.torso.rotation.y = pose.twist;
dancer.head.rotation.z = -pose.lean * 0.55;
dancer.head.rotation.y = pose.twist * 0.35;
dancer.rightArm.shoulder.rotation.z = pose.ra * energy;
dancer.leftArm.shoulder.rotation.z = -pose.la * energy;
dancer.rightArm.shoulder.rotation.x = pose.rax;
dancer.leftArm.shoulder.rotation.x = pose.lax;
dancer.rightArm.elbow.rotation.x = pose.rex;
dancer.leftArm.elbow.rotation.x = pose.lex;
dancer.rightLeg.hip.rotation.x = pose.lr;
dancer.leftLeg.hip.rotation.x = pose.ll;
dancer.rightLeg.knee.rotation.x = -Math.max(0, pose.lr) * 0.75;
dancer.leftLeg.knee.rotation.x = -Math.max(0, pose.ll) * 0.75;
}
function idlePose(dancer, t, index) {
const sway = Math.sin(t * 1.15 + index * 0.7);
applyPose(
dancer,
{
ra: 0.2 + sway * 0.05,
la: 0.18 - sway * 0.05,
rax: 0,
lax: 0,
rex: -0.08,
lex: -0.08,
lr: 0.03 + sway * 0.025,
ll: -0.03 - sway * 0.025,
lrx: 0,
llx: 0,
lean: sway * 0.018,
twist: sway * 0.035,
},
t,
1
);
}
// -------------------------------------------------------------------------
// Interface and section switching
// -------------------------------------------------------------------------
const playButton = document.querySelector("#playButton");
const soloButton = document.querySelector("#soloButton");
const groupButton = document.querySelector("#groupButton");
const autoButton = document.querySelector("#autoButton");
const resetButton = document.querySelector("#resetButton");
const modeBadge = document.querySelector("#modeBadge");
const sectionKicker = document.querySelector("#sectionKicker");
const sectionTitle = document.querySelector("#sectionTitle");
const sectionNumber = document.querySelector("#sectionNumber");
const sectionDescription = document.querySelector("#sectionDescription");
const timelineFill = document.querySelector("#timelineFill");
const timelineLabel = document.querySelector("#timelineLabel");
const timeLabel = document.querySelector("#timeLabel");
let phase = "solo";
let sectionTime = 0;
let playing = true;
let autoCycle = true;
let elapsed = 0;
const copy = {
solo: {
badge: "Solo study",
kicker: "Section 01 · Solo phrase",
title: "Reach & Return",
description:
"A lead phrase of side steps, high reaches, soft turns, and a return to center.",
},
group: {
badge: "Group study",
kicker: "Section 02 · Ensemble phrase",
title: "Four-Corner Current",
description:
"Seven dancers share an open–rise–fold–pulse sequence while tracing a small moving current.",
},
};
function updateButtons() {
playButton.textContent = playing ? "Pause" : "Play";
playButton.setAttribute("aria-label", playing ? "Pause rehearsal" : "Play rehearsal");
soloButton.classList.toggle("active", phase === "solo");
soloButton.classList.toggle("group-active", false);
groupButton.classList.toggle("active", phase === "group");
groupButton.classList.toggle("group-active", phase === "group");
autoButton.classList.toggle("active", autoCycle);
autoButton.setAttribute("aria-pressed", String(autoCycle));
const accent = phase === "solo" ? "#ffca68" : "#71d6c6";
document.documentElement.style.setProperty(
"--solo",
phase === "solo" ? "#ffca68" : "#71d6c6"
);
timelineFill.style.backgroundColor = accent;
modeBadge.style.color = accent;
}
function setPhase(nextPhase, manual = false) {
phase = nextPhase;
sectionTime = 0;
if (manual) {
autoCycle = false;
}
const content = copy[phase];
modeBadge.textContent = content.badge;
sectionKicker.textContent = content.kicker;
sectionTitle.textContent = content.title;
sectionDescription.textContent = content.description;
sectionNumber.textContent = phase === "solo" ? "01" : "02";
timelineLabel.textContent =
`${phase === "solo" ? "Solo" : "Group"} · ${durations[phase]} seconds`;
updateButtons();
}
playButton.addEventListener("click", () => {
playing = !playing;
updateButtons();
});
soloButton.addEventListener("click", () => setPhase("solo", true));
groupButton.addEventListener("click", () => setPhase("group", true));
autoButton.addEventListener("click", () => {
autoCycle = !autoCycle;
updateButtons();
});
resetButton.addEventListener("click", () => {
cameraState.desiredTheta = 0.48;
cameraState.desiredPhi = 1.03;
cameraState.desiredRadius = 16.2;
});
setPhase("solo");
// -------------------------------------------------------------------------
// Animation loop
// -------------------------------------------------------------------------
const clock = new THREE.Clock();
const desiredPosition = new THREE.Vector3();
function animate() {
requestAnimationFrame(animate);
const dt = Math.min(clock.getDelta(), 0.05);
elapsed += dt;
if (playing) {
sectionTime += dt;
if (autoCycle && sectionTime >= durations[phase]) {
setPhase(phase === "solo" ? "group" : "solo");
}
}
dancers.forEach((dancer, index) => {
const base =
phase === "solo" ? soloPositions[index] : groupPositions[index];
desiredPosition.set(base[0], 0, base[1]);
if (phase === "solo") {
if (index === 0) {
const step = Math.sin(sectionTime * 1.55);
desiredPosition.x += step * 0.42;
desiredPosition.z += Math.cos(sectionTime * 1.55) * 0.18;
} else {
desiredPosition.x += Math.sin(elapsed * 0.6 + index) * 0.035;
}
} else {
const individualPhase = elapsed * 0.86 + index * 0.31;
desiredPosition.x += Math.sin(individualPhase) * 0.22;
desiredPosition.z += Math.cos(individualPhase * 0.84) * 0.14;
}
const positionSmoothing = 1 - Math.exp(-dt * 4.2);
dancer.root.position.lerp(desiredPosition, positionSmoothing);
if (phase === "solo") {
if (index === 0) {
const pose = samplePhrase(soloPhrase, sectionTime);
applyPose(dancer, pose, elapsed, 1);
const turn = Math.sin(sectionTime * 0.73) * 0.18;
dancer.root.rotation.y = THREE.MathUtils.lerp(
dancer.root.rotation.y,
turn,
1 - Math.exp(-dt * 4)
);
dancer.root.position.y =
Math.abs(Math.sin(sectionTime * 3.1)) * 0.075;
} else {
idlePose(dancer, elapsed, index);
dancer.root.rotation.y = THREE.MathUtils.lerp(
dancer.root.rotation.y,
0,
1 - Math.exp(-dt * 4)
);
dancer.root.position.y = 0;
}
} else {
const pose = samplePhrase(groupPhrase, sectionTime);
applyPose(dancer, pose, elapsed + index * 0.025, 1);
const inward = index < 3 ? 0.04 : index > 3 ? -0.04 : 0;
dancer.root.rotation.y = THREE.MathUtils.lerp(
dancer.root.rotation.y,
inward + Math.sin(elapsed * 0.75 + index * 0.4) * 0.025,
1 - Math.exp(-dt * 4)
);
dancer.root.position.y =
Math.abs(Math.sin(sectionTime * Math.PI * 2)) * 0.035;
}
});
const progress = Math.min(sectionTime / durations[phase], 1);
timelineFill.style.width = `${progress * 100}%`;
timeLabel.textContent = `${sectionTime.toFixed(1)} / ${durations[phase]}`;
updateCamera(dt);
renderer.render(scene, camera);
}
animate();
window.addEventListener("resize", () => {
camera.aspect = innerWidth / innerHeight;
camera.updateProjectionMatrix();
renderer.setPixelRatio(Math.min(devicePixelRatio, 2));
renderer.setSize(innerWidth, innerHeight);
});
</script>
</body>
</html>
```