Prompt specification
Build or customize the Three.js 3D scene "Radial deployable-structure workshop" 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: Radial deployable-structure workshop
Category: Voxel Worlds · Style: Voxel 3D
License: MIT · Reference: https://three3d.app/scene/radial-deployable-structure-workshop-x0632
Scene Description Prompt:
Make one HTML file using Three.js from cdnjs for this voxel scene: Create umbrella, shade pavilion, and toy antenna models using related radial linkages; one control compares their deployment paths while preserving distinct final geometries and functions.
Working Three.js Starter (radial-deployable-structure-workshop-x0632):
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Radial Systems — Voxel Deployment Study</title>
<style>
:root {
--ink: #eef4ff;
--muted: #91a2be;
--panel: rgba(12, 20, 36, 0.82);
--line: rgba(176, 199, 235, 0.17);
--umbrella: #ff6864;
--pavilion: #55d8c4;
--antenna: #f7c75b;
--scrub: #f7c75b;
}
* {
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: #0b1220;
color: var(--ink);
font-family:
Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
"Segoe UI", sans-serif;
}
canvas {
display: block;
width: 100%;
height: 100%;
touch-action: none;
cursor: grab;
}
canvas:active {
cursor: grabbing;
}
#title {
position: fixed;
top: 22px;
left: 24px;
z-index: 5;
pointer-events: none;
}
#title .eyebrow {
margin-bottom: 7px;
color: var(--antenna);
font-size: 10px;
font-weight: 800;
letter-spacing: 0.24em;
text-transform: uppercase;
}
#title h1 {
margin: 0;
font-size: clamp(24px, 3vw, 42px);
line-height: 0.95;
letter-spacing: -0.05em;
}
#title p {
margin: 10px 0 0;
color: var(--muted);
font-size: 12px;
letter-spacing: 0.02em;
}
#cameraHint {
position: fixed;
top: 26px;
right: 26px;
z-index: 5;
padding: 9px 12px;
border: 1px solid var(--line);
border-radius: 999px;
background: rgba(12, 20, 36, 0.55);
color: var(--muted);
font-size: 10px;
font-weight: 700;
letter-spacing: 0.08em;
text-transform: uppercase;
pointer-events: none;
backdrop-filter: blur(10px);
}
#labels {
position: fixed;
inset: 0;
z-index: 4;
pointer-events: none;
overflow: hidden;
}
.model-label {
position: absolute;
min-width: 128px;
padding: 9px 11px;
border: 1px solid var(--line);
border-top: 2px solid var(--accent);
border-radius: 8px;
background: rgba(10, 17, 31, 0.78);
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
transform: translate(-50%, -100%);
backdrop-filter: blur(12px);
}
.model-label::after {
position: absolute;
bottom: -16px;
left: 50%;
width: 1px;
height: 15px;
background: linear-gradient(var(--accent), transparent);
content: "";
}
.model-label span {
display: block;
margin-bottom: 3px;
color: var(--accent);
font-size: 8px;
font-weight: 900;
letter-spacing: 0.17em;
}
.model-label b {
display: block;
font-size: 11px;
letter-spacing: 0.02em;
}
.model-label small {
display: block;
margin-top: 3px;
color: var(--muted);
font-size: 9px;
}
#controlPanel,
#graphPanel {
position: fixed;
z-index: 6;
border: 1px solid var(--line);
border-radius: 14px;
background: var(--panel);
box-shadow: 0 18px 60px rgba(0, 0, 0, 0.32);
backdrop-filter: blur(18px);
}
#controlPanel {
left: 24px;
bottom: 24px;
width: min(540px, calc(100vw - 48px));
padding: 17px 18px 15px;
}
.control-heading {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 16px;
margin-bottom: 14px;
}
.control-heading span {
display: block;
color: var(--muted);
font-size: 9px;
font-weight: 800;
letter-spacing: 0.16em;
text-transform: uppercase;
}
.control-heading strong {
display: block;
margin-top: 4px;
font-size: 14px;
letter-spacing: -0.01em;
}
#readout {
color: var(--scrub);
font-variant-numeric: tabular-nums;
font-size: 22px;
font-weight: 800;
letter-spacing: -0.04em;
}
#scrubber {
--pct: 0%;
width: 100%;
height: 6px;
margin: 3px 0 17px;
border: 0;
border-radius: 99px;
outline: none;
background:
linear-gradient(
to right,
var(--scrub) 0%,
var(--scrub) var(--pct),
rgba(161, 180, 211, 0.18) var(--pct),
rgba(161, 180, 211, 0.18) 100%
);
appearance: none;
cursor: ew-resize;
}
#scrubber::-webkit-slider-thumb {
width: 19px;
height: 19px;
border: 4px solid #18243a;
border-radius: 50%;
background: var(--scrub);
box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.35);
appearance: none;
}
#scrubber::-moz-range-thumb {
width: 12px;
height: 12px;
border: 4px solid #18243a;
border-radius: 50%;
background: var(--scrub);
box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.35);
}
#legend {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 12px;
}
.legend-item {
display: grid;
grid-template-columns: 8px 1fr auto;
align-items: center;
gap: 7px;
min-width: 0;
}
.legend-item i {
width: 7px;
height: 7px;
border-radius: 50%;
background: var(--color);
box-shadow: 0 0 12px color-mix(in srgb, var(--color), transparent 45%);
}
.legend-item span {
overflow: hidden;
color: #c8d4e9;
font-size: 9px;
font-weight: 800;
letter-spacing: 0.07em;
text-overflow: ellipsis;
white-space: nowrap;
}
.legend-item output {
color: var(--muted);
font-size: 9px;
font-variant-numeric: tabular-nums;
}
.legend-bar {
grid-column: 2 / 4;
height: 2px;
overflow: hidden;
border-radius: 99px;
background: rgba(255, 255, 255, 0.08);
}
.legend-bar b {
display: block;
width: 0%;
height: 100%;
background: var(--color);
transition: width 50ms linear;
}
#graphPanel {
right: 24px;
bottom: 24px;
width: 350px;
padding: 14px 15px 10px;
}
#graphPanel .graph-title {
display: flex;
justify-content: space-between;
color: var(--muted);
font-size: 9px;
font-weight: 800;
letter-spacing: 0.12em;
text-transform: uppercase;
}
#graphPanel svg {
display: block;
width: 100%;
height: auto;
margin-top: 7px;
overflow: visible;
}
.graph-note {
margin: 2px 0 0;
color: #72839e;
font-size: 9px;
line-height: 1.4;
}
@media (max-width: 960px) {
#graphPanel {
top: 94px;
right: 14px;
bottom: auto;
width: 260px;
}
#controlPanel {
left: 14px;
right: 14px;
bottom: 14px;
width: auto;
}
#cameraHint {
display: none;
}
}
@media (max-width: 580px) {
#title {
top: 15px;
left: 15px;
}
#title p {
max-width: 220px;
font-size: 10px;
}
#graphPanel {
top: 76px;
right: 10px;
width: 208px;
padding: 10px;
}
#graphPanel .graph-note {
display: none;
}
#controlPanel {
left: 10px;
right: 10px;
bottom: 10px;
padding: 14px;
}
#legend {
gap: 7px;
}
.legend-item {
grid-template-columns: 7px 1fr;
}
.legend-item output {
display: none;
}
.legend-bar {
grid-column: 2;
}
.model-label {
min-width: 104px;
padding: 7px 8px;
}
.model-label b {
font-size: 9px;
}
.model-label small {
font-size: 8px;
}
}
</style>
</head>
<body>
<header id="title">
<div class="eyebrow">Voxel mechanism study / 03</div>
<h1>RADIAL SYSTEMS</h1>
<p>One scrubber. Three related deployment paths.</p>
</header>
<div id="cameraHint">Drag to orbit · Scroll to zoom</div>
<div id="labels" aria-hidden="true">
<div
class="model-label"
id="label-umbrella"
style="--accent: var(--umbrella)"
>
<span>01 / UMBRELLA</span>
<b>RAIN SHIELD</b>
<small>folded</small>
</div>
<div
class="model-label"
id="label-pavilion"
style="--accent: var(--pavilion)"
>
<span>02 / PAVILION</span>
<b>SHADE + REST</b>
<small>packed</small>
</div>
<div
class="model-label"
id="label-antenna"
style="--accent: var(--antenna)"
>
<span>03 / ANTENNA</span>
<b>SIGNAL RELAY</b>
<small>stowed</small>
</div>
</div>
<section id="controlPanel">
<div class="control-heading">
<div>
<span>Single deployment control</span>
<strong>Compare synchronized motion</strong>
</div>
<output id="readout">000%</output>
</div>
<input
id="scrubber"
type="range"
min="0"
max="100"
step="0.1"
value="0"
aria-label="Compare all three deployment paths"
/>
<div id="legend">
<div class="legend-item" style="--color: var(--umbrella)">
<i></i>
<span>UMBRELLA</span>
<output id="pct-umbrella">0%</output>
<div class="legend-bar"><b id="bar-umbrella"></b></div>
</div>
<div class="legend-item" style="--color: var(--pavilion)">
<i></i>
<span>PAVILION</span>
<output id="pct-pavilion">0%</output>
<div class="legend-bar"><b id="bar-pavilion"></b></div>
</div>
<div class="legend-item" style="--color: var(--antenna)">
<i></i>
<span>ANTENNA</span>
<output id="pct-antenna">0%</output>
<div class="legend-bar"><b id="bar-antenna"></b></div>
</div>
</div>
</section>
<aside id="graphPanel">
<div class="graph-title">
<span>Deployment response</span>
<span>Common input →</span>
</div>
<svg
id="pathChart"
viewBox="0 0 320 92"
role="img"
aria-label="Graph comparing the three deployment paths"
></svg>
<p class="graph-note">
Each mechanism follows the same command, but uses a different response curve.
</p>
</aside>
<script type="module">
import * as THREE from "https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
const $ = (id) => document.getElementById(id);
const clamp = THREE.MathUtils.clamp;
const lerp = THREE.MathUtils.lerp;
const smooth = (x) => {
x = clamp(x, 0, 1);
return x * x * (3 - 2 * x);
};
const scene = new THREE.Scene();
scene.background = new THREE.Color(0x0b1220);
scene.fog = new THREE.Fog(0x0b1220, 17, 34);
const camera = new THREE.PerspectiveCamera(
42,
innerWidth / innerHeight,
0.1,
100
);
const renderer = new THREE.WebGLRenderer({
antialias: true,
alpha: false,
powerPreference: "high-performance"
});
renderer.setPixelRatio(Math.min(devicePixelRatio, 1.75));
renderer.setSize(innerWidth, innerHeight);
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1.16;
document.body.prepend(renderer.domElement);
const hemisphere = new THREE.HemisphereLight(0xd9efff, 0x26324a, 2.25);
scene.add(hemisphere);
const keyLight = new THREE.DirectionalLight(0xfff2d7, 3.1);
keyLight.position.set(5, 10, 7);
keyLight.castShadow = true;
keyLight.shadow.mapSize.set(2048, 2048);
keyLight.shadow.camera.left = -10;
keyLight.shadow.camera.right = 10;
keyLight.shadow.camera.top = 10;
keyLight.shadow.camera.bottom = -10;
keyLight.shadow.camera.near = 1;
keyLight.shadow.camera.far = 30;
keyLight.shadow.bias = -0.00035;
scene.add(keyLight);
const rimLight = new THREE.DirectionalLight(0x6ab9ff, 1.25);
rimLight.position.set(-7, 5, -6);
scene.add(rimLight);
const warmLight = new THREE.PointLight(0xffb56b, 22, 12, 2);
warmLight.position.set(5.5, 3.8, 3.5);
scene.add(warmLight);
const unitBox = new THREE.BoxGeometry(1, 1, 1);
const materialCache = new Map();
function getMaterial(color) {
if (!materialCache.has(color)) {
materialCache.set(
color,
new THREE.MeshStandardMaterial({
color,
roughness: 0.68,
metalness: 0.06
})
);
}
return materialCache.get(color);
}
function makeBox(w, h, d, color, parent, x = 0, y = 0, z = 0) {
const mesh = new THREE.Mesh(unitBox, getMaterial(color));
mesh.scale.set(w, h, d);
mesh.position.set(x, y, z);
mesh.castShadow = true;
mesh.receiveShadow = true;
parent.add(mesh);
return mesh;
}
function makeSegment(color, parent, thickness = 0.06) {
const mesh = new THREE.Mesh(unitBox, getMaterial(color));
mesh.castShadow = true;
mesh.receiveShadow = true;
parent.add(mesh);
mesh.userData.thickness = thickness;
return mesh;
}
const segmentAxis = new THREE.Vector3(0, 0, 1);
const segmentDelta = new THREE.Vector3();
const segmentMidpoint = new THREE.Vector3();
function setSegment(mesh, a, b, thickness = mesh.userData.thickness) {
segmentDelta.subVectors(b, a);
const length = segmentDelta.length();
segmentMidpoint.copy(a).add(b).multiplyScalar(0.5);
mesh.position.copy(segmentMidpoint);
mesh.quaternion.setFromUnitVectors(
segmentAxis,
segmentDelta.normalize()
);
mesh.scale.set(thickness, thickness, Math.max(length, 0.001));
}
// Ground and display platforms.
const floor = new THREE.Mesh(
new THREE.PlaneGeometry(60, 60),
new THREE.MeshStandardMaterial({
color: 0x111b2b,
roughness: 0.94,
metalness: 0
})
);
floor.rotation.x = -Math.PI / 2;
floor.position.y = -0.16;
floor.receiveShadow = true;
scene.add(floor);
const grid = new THREE.GridHelper(30, 30, 0x31445f, 0x203047);
grid.position.y = -0.145;
grid.material.transparent = true;
grid.material.opacity = 0.24;
scene.add(grid);
makeBox(3.9, 0.24, 3.65, 0x17243a, scene, -4.15, 0, 0);
makeBox(4.5, 0.24, 4.5, 0x17283b, scene, 0, 0, 0);
makeBox(3.9, 0.24, 3.65, 0x17243a, scene, 4.15, 0, 0);
makeBox(3.65, 0.045, 0.07, 0xff6864, scene, -4.15, 0.145, 1.78);
makeBox(4.2, 0.045, 0.07, 0x55d8c4, scene, 0, 0.145, 2.21);
makeBox(3.65, 0.045, 0.07, 0xf7c75b, scene, 4.15, 0.145, 1.78);
// ---------------------------------------------------------------------
// 01 — Umbrella
// ---------------------------------------------------------------------
const umbrella = new THREE.Group();
umbrella.position.x = -4.15;
scene.add(umbrella);
makeBox(0.12, 1.48, 0.12, 0x26364d, umbrella, 0, 1.31, 0);
makeBox(0.18, 0.16, 0.18, 0xf1d8b5, umbrella, 0, 2.08, 0);
// Block-built hooked handle.
makeBox(0.13, 0.39, 0.13, 0x18263a, umbrella, 0, 0.38, 0);
makeBox(0.58, 0.13, 0.13, 0x18263a, umbrella, 0.23, 0.19, 0);
makeBox(0.13, 0.34, 0.13, 0x18263a, umbrella, 0.52, 0.34, 0);
const umbrellaCanopy = new THREE.Group();
umbrella.add(umbrellaCanopy);
const umbrellaColors = [0xff625f, 0xff8174, 0xff9a83];
for (let ix = -4; ix <= 4; ix++) {
for (let iz = -4; iz <= 4; iz++) {
const x = ix * 0.32;
const z = iz * 0.32;
const radius = Math.hypot(x, z);
if (radius > 1.31) continue;
const y = 0.24 + (1.31 - radius) * 0.45;
const color = umbrellaColors[(ix + iz + 8) % umbrellaColors.length];
makeBox(
0.295,
0.19,
0.295,
color,
umbrellaCanopy,
x,
y,
z
);
}
}
const umbrellaRibs = [];
const umbrellaTips = [];
for (let i = 0; i < 8; i++) {
umbrellaRibs.push({
inner: makeSegment(0xffe3bf, umbrella, 0.055),
outer: makeSegment(0xffe3bf, umbrella, 0.05),
angle: (i / 8) * Math.PI * 2
});
umbrellaTips.push(
makeBox(
0.13,
0.13,
0.13,
i % 2 === 0 ? 0xffe3bf : 0xf3b991,
umbrella,
0,
0,
0
)
);
}
function updateUmbrella(q) {
const radialScale = lerp(0.1, 1, q);
const verticalScale = lerp(0.26, 1, q);
umbrellaCanopy.scale.set(radialScale, verticalScale, radialScale);
umbrellaCanopy.position.y = lerp(1.78, 1.42, q);
const radius = lerp(0.12, 1.31, q);
const hubY = 2.055;
const elbowRadius = radius * 0.55;
const elbowY = lerp(2.035, 1.98, q);
const tipY = lerp(1.78, 1.71, q);
for (let i = 0; i < umbrellaRibs.length; i++) {
const rib = umbrellaRibs[i];
const c = Math.cos(rib.angle);
const s = Math.sin(rib.angle);
const hub = new THREE.Vector3(0, hubY, 0);
const elbow = new THREE.Vector3(
c * elbowRadius,
elbowY,
s * elbowRadius
);
const tip = new THREE.Vector3(
c * radius,
tipY,
s * radius
);
setSegment(rib.inner, hub, elbow);
setSegment(rib.outer, elbow, tip);
umbrellaTips[i].position.copy(tip);
}
}
// ---------------------------------------------------------------------
// 02 — Shade pavilion
// ---------------------------------------------------------------------
const pavilion = new THREE.Group();
scene.add(pavilion);
const pavilionRoof = new THREE.Group();
pavilion.add(pavilionRoof);
const roofColors = [0x55d8c4, 0x72dfcf, 0x91eadb];
for (let ix = -4; ix <= 4; ix++) {
for (let iz = -4; iz <= 4; iz++) {
const x = ix * 0.38;
const z = iz * 0.38;
const norm = Math.max(Math.abs(x), Math.abs(z));
if (norm > 1.54) continue;
const y = 0.18 + (1 - norm / 1.54) * 0.35;
const color = roofColors[(ix * 2 + iz + 8) % roofColors.length];
makeBox(
0.355,
0.16,
0.355,
color,
pavilionRoof,
x,
y,
z
);
}
}
// Crisp roof border.
makeBox(3.28, 0.17, 0.12, 0xcaf8ed, pavilionRoof, 0, 0.18, 1.53);
makeBox(3.28, 0.17, 0.12, 0xcaf8ed, pavilionRoof, 0, 0.18, -1.53);
makeBox(0.12, 0.17, 3.28, 0xcaf8ed, pavilionRoof, 1.53, 0.18, 0);
makeBox(0.12, 0.17, 3.28, 0xcaf8ed, pavilionRoof, -1.53, 0.18, 0);
makeBox(0.48, 0.26, 0.48, 0xf1d7ae, pavilion, 0, 2.93, 0);
makeBox(0.16, 0.16, 0.16, 0x55d8c4, pavilion, 0, 3.11, 0);
const pavilionPosts = [];
for (const [x, z] of [
[-1.5, -1.5],
[1.5, -1.5],
[-1.5, 1.5],
[1.5, 1.5]
]) {
makeBox(
0.31,
0.18,
0.31,
0x385069,
pavilion,
x,
0.21,
z
);
pavilionPosts.push({
x,
z,
lower: makeBox(0.22, 1, 0.22, 0xd39a64, pavilion, x, 1, z),
upper: makeBox(0.16, 1, 0.16, 0xf0cf99, pavilion, x, 2, z)
});
}
const pavilionArms = [];
for (let i = 0; i < 8; i++) {
pavilionArms.push({
angle: (i / 8) * Math.PI * 2,
mesh: makeSegment(0xffe5b5, pavilion, 0.07)
});
}
// A small bench makes the pavilion's shade/rest function explicit.
makeBox(1.45, 0.14, 0.48, 0xc77f52, pavilion, 0, 0.53, 0.48);
makeBox(1.45, 0.55, 0.12, 0xe2a46c, pavilion, 0, 0.86, 0.72);
makeBox(0.15, 0.38, 0.38, 0x774b38, pavilion, -0.55, 0.34, 0.48);
makeBox(0.15, 0.38, 0.38, 0x774b38, pavilion, 0.55, 0.34, 0.48);
function updatePavilion(q) {
const radialScale = lerp(0.12, 1, q);
const verticalScale = lerp(0.25, 1, q);
pavilionRoof.scale.set(radialScale, verticalScale, radialScale);
pavilionRoof.position.y = lerp(2.70, 2.42, q);
const lowerHeight = lerp(0.25, 1.45, q);
const upperHeight = lerp(0.20, 1.10, q);
const baseY = 0.14;
for (const post of pavilionPosts) {
post.lower.scale.y = lowerHeight;
post.lower.position.y = baseY + lowerHeight / 2;
post.upper.scale.y = upperHeight;
post.upper.position.y =
baseY + lowerHeight + upperHeight / 2;
}
const crown = new THREE.Vector3(0, 2.92, 0);
for (const arm of pavilionArms) {
const c = Math.cos(arm.angle);
const s = Math.sin(arm.angle);
const squareRadius =
1.57 / Math.max(Math.abs(c), Math.abs(s));
const radius = lerp(0.14, squareRadius, q);
const tipY = lerp(2.80, 2.60, q);
const tip = new THREE.Vector3(
c * radius,
tipY,
s * radius
);
setSegment(arm.mesh, crown, tip);
}
}
// ---------------------------------------------------------------------
// 03 — Toy antenna
// ---------------------------------------------------------------------
const antenna = new THREE.Group();
antenna.position.x = 4.15;
scene.add(antenna);
makeBox(1.5, 0.28, 1.15, 0x3e5870, antenna, 0, 0.27, 0);
makeBox(1.15, 0.08, 0.82, 0x7892a4, antenna, 0, 0.45, 0);
// Tuner face and buttons.
makeBox(0.76, 0.32, 0.05, 0x182a3d, antenna, 0, 0.61, 0.52);
makeBox(0.11, 0.11, 0.06, 0xff6864, antenna, -0.22, 0.61, 0.56);
makeBox(0.11, 0.11, 0.06, 0x55d8c4, antenna, 0, 0.61, 0.56);
makeBox(0.11, 0.11, 0.06, 0xf7c75b, antenna, 0.22, 0.61, 0.56);
const antennaMast = [
makeBox(0.18, 1, 0.18, 0xf1d7ae, antenna, 0, 1, 0),
makeBox(0.13, 1, 0.13, 0xf7c75b, antenna, 0, 2, 0),
makeBox(0.09, 1, 0.09, 0xf5f1df, antenna, 0, 3, 0)
];
const antennaHub = makeBox(
0.31,
0.25,
0.31,
0xf7c75b,
antenna,
0,
3.2,
0
);
const beaconMaterial = new THREE.MeshStandardMaterial({
color: 0xff5a63,
emissive: 0xff1f44,
emissiveIntensity: 2,
roughness: 0.4
});
const beacon = new THREE.Mesh(unitBox, beaconMaterial);
beacon.scale.set(0.18, 0.18, 0.18);
beacon.position.set(0, 3.45, 0);
beacon.castShadow = true;
antenna.add(beacon);
const upperSpokes = [];
const lowerSpokes = [];
for (let i = 0; i < 8; i++) {
upperSpokes.push({
angle: (i / 8) * Math.PI * 2,
mesh: makeSegment(0xf6f0d7, antenna, 0.065),
tip: makeBox(
0.15,
0.15,
0.15,
i % 2 === 0 ? 0xff6864 : 0x55d8c4,
antenna
)
});
}
for (let i = 0; i < 6; i++) {
lowerSpokes.push({
angle: (i / 6) * Math.PI * 2 + Math.PI / 6,
mesh: makeSegment(0xb8c8d2, antenna, 0.05),
tip: makeBox(
0.11,
0.11,
0.11,
0xf7c75b,
antenna
)
});
}
function updateAntenna(q) {
const lowerDelayed = smooth((q - 0.12) / 0.88);
const heights = [
lerp(0.35, 1.07, q),
lerp(0.28, 0.96, q),
lerp(0.20, 0.86, q)
];
let cursor = 0.43;
for (let i = 0; i < antennaMast.length; i++) {
const height = heights[i];
antennaMast[i].scale.y = height;
antennaMast[i].position.y = cursor + height / 2;
cursor += height;
}
const hubY = cursor + 0.05;
antennaHub.position.y = hubY;
beacon.position.y = hubY + 0.19;
const upperRadius = lerp(0.12, 1.48, q);
for (const spoke of upperSpokes) {
const c = Math.cos(spoke.angle);
const s = Math.sin(spoke.angle);
const hub = new THREE.Vector3(0, hubY, 0);
const tip = new THREE.Vector3(
c * upperRadius,
hubY + 0.08 * q + (spoke.angle % 1) * 0.03 * q,
s * upperRadius
);
setSegment(spoke.mesh, hub, tip);
spoke.tip.position.copy(tip);
}
const lowerHub = new THREE.Vector3(0, hubY - 0.52, 0);
const lowerRadius = lerp(0.1, 0.92, lowerDelayed);
for (const spoke of lowerSpokes) {
const c = Math.cos(spoke.angle);
const s = Math.sin(spoke.angle);
const tip = new THREE.Vector3(
c * lowerRadius,
lowerHub.y,
s * lowerRadius
);
setSegment(spoke.mesh, lowerHub, tip);
spoke.tip.position.copy(tip);
}
}
// ---------------------------------------------------------------------
// Deployment response curves
// ---------------------------------------------------------------------
const paths = {
umbrella: (t) => smooth(t / 0.86),
pavilion: (t) => smooth((t - 0.12) / 0.80),
antenna: (t) => smooth((t - 0.02) / 0.66)
};
const pathColors = {
umbrella: "#ff6864",
pavilion: "#55d8c4",
antenna: "#f7c75b"
};
function chartPoint(t, value) {
return {
x: 10 + t * 300,
y: 80 - value * 66
};
}
function makePath(key) {
const points = [];
for (let i = 0; i <= 100; i++) {
const t = i / 100;
const point = chartPoint(t, paths[key](t));
points.push(`${point.x.toFixed(2)},${point.y.toFixed(2)}`);
}
return `M ${points.join(" L ")}`;
}
$("pathChart").innerHTML = `
<g stroke="rgba(157,180,214,0.10)" stroke-width="1">
<line x1="10" y1="14" x2="310" y2="14"></line>
<line x1="10" y1="47" x2="310" y2="47"></line>
<line x1="10" y1="80" x2="310" y2="80"></line>
<line x1="10" y1="14" x2="10" y2="80"></line>
<line x1="110" y1="14" x2="110" y2="80"></line>
<line x1="210" y1="14" x2="210" y2="80"></line>
<line x1="310" y1="14" x2="310" y2="80"></line>
</g>
<path
d="${makePath("umbrella")}"
fill="none"
stroke="${pathColors.umbrella}"
stroke-width="2.5"
stroke-linecap="round"
></path>
<path
d="${makePath("pavilion")}"
fill="none"
stroke="${pathColors.pavilion}"
stroke-width="2.5"
stroke-linecap="round"
></path>
<path
d="${makePath("antenna")}"
fill="none"
stroke="${pathColors.antenna}"
stroke-width="2.5"
stroke-linecap="round"
></path>
<circle id="dot-umbrella" r="4" fill="${pathColors.umbrella}"
stroke="#0b1220" stroke-width="2"></circle>
<circle id="dot-pavilion" r="4" fill="${pathColors.pavilion}"
stroke="#0b1220" stroke-width="2"></circle>
<circle id="dot-antenna" r="4" fill="${pathColors.antenna}"
stroke="#0b1220" stroke-width="2"></circle>
<text x="10" y="90" fill="#71839f" font-size="8">0</text>
<text x="303" y="90" fill="#71839f" font-size="8">100</text>
`;
const scrubber = $("scrubber");
function stateLabel(q, words) {
if (q < 0.08) return words[0];
if (q < 0.96) return words[1];
return words[2];
}
function updateProgress(t) {
const qU = paths.umbrella(t);
const qP = paths.pavilion(t);
const qA = paths.antenna(t);
updateUmbrella(qU);
updatePavilion(qP);
updateAntenna(qA);
$("readout").textContent =
`${String(Math.round(t * 100)).padStart(3, "0")}%`;
scrubber.style.setProperty("--pct", `${t * 100}%`);
for (const [key, q] of [
["umbrella", qU],
["pavilion", qP],
["antenna", qA]
]) {
const percent = Math.round(q * 100);
$(`bar-${key}`).style.width = `${percent}%`;
$(`pct-${key}`).textContent = `${percent}%`;
const point = chartPoint(t, q);
const dot = $(`dot-${key}`);
dot.setAttribute("cx", point.x);
dot.setAttribute("cy", point.y);
}
$("label-umbrella").querySelector("small").textContent =
stateLabel(qU, ["folded", "opening", "open · rain shield"]);
$("label-pavilion").querySelector("small").textContent =
stateLabel(qP, ["packed", "unfolding", "deployed · shaded"]);
$("label-antenna").querySelector("small").textContent =
stateLabel(qA, ["stowed", "transmitting", "live · signal relay"]);
}
scrubber.addEventListener("input", () => {
autoPlay = false;
updateProgress(Number(scrubber.value) / 100);
});
// ---------------------------------------------------------------------
// Custom camera controls — no external controls addon
// ---------------------------------------------------------------------
const cameraState = {
azimuth: 0.18,
elevation: 0.39,
radius: 12.4,
target: new THREE.Vector3(0, 1.25, 0),
dragging: false,
pointerX: 0,
pointerY: 0
};
function updateCamera() {
const fit = Math.max(1, 0.92 / camera.aspect);
const radius = cameraState.radius * fit;
const elevation = cameraState.elevation;
const azimuth = cameraState.azimuth;
camera.position.set(
cameraState.target.x +
radius * Math.cos(elevation) * Math.sin(azimuth),
cameraState.target.y + radius * Math.sin(elevation),
cameraState.target.z +
radius * Math.cos(elevation) * Math.cos(azimuth)
);
camera.lookAt(cameraState.target);
camera.updateMatrixWorld();
}
renderer.domElement.addEventListener("pointerdown", (event) => {
cameraState.dragging = true;
cameraState.pointerX = event.clientX;
cameraState.pointerY = event.clientY;
renderer.domElement.setPointerCapture(event.pointerId);
});
renderer.domElement.addEventListener("pointermove", (event) => {
if (!cameraState.dragging) return;
const dx = event.clientX - cameraState.pointerX;
const dy = event.clientY - cameraState.pointerY;
cameraState.pointerX = event.clientX;
cameraState.pointerY = event.clientY;
cameraState.azimuth -= dx * 0.006;
cameraState.elevation = clamp(
cameraState.elevation + dy * 0.005,
0.18,
1.02
);
updateCamera();
});
const endDrag = (event) => {
cameraState.dragging = false;
if (renderer.domElement.hasPointerCapture(event.pointerId)) {
renderer.domElement.releasePointerCapture(event.pointerId);
}
};
renderer.domElement.addEventListener("pointerup", endDrag);
renderer.domElement.addEventListener("pointercancel", endDrag);
renderer.domElement.addEventListener(
"wheel",
(event) => {
event.preventDefault();
cameraState.radius = clamp(
cameraState.radius + event.deltaY * 0.009,
7.5,
18
);
updateCamera();
},
{ passive: false }
);
// ---------------------------------------------------------------------
// Screen-space model labels
// ---------------------------------------------------------------------
const labelAnchors = {
umbrella: { x: -4.15, y: 2.55, z: 0 },
pavilion: { x: 0, y: 3.35, z: 0 },
antenna: { x: 4.15, y: 3.85, z: 0 }
};
const projected = new THREE.Vector3();
function positionLabel(id, anchor) {
const element = $(id);
projected.set(anchor.x, anchor.y, anchor.z).project(camera);
if (projected.z < -1 || projected.z > 1) {
element.style.opacity = "0";
return;
}
element.style.opacity = "1";
element.style.left = `${(projected.x * 0.5 + 0.5) * innerWidth}px`;
element.style.top = `${(-projected.y * 0.5 + 0.5) * innerHeight}px`;
}
function resize() {
camera.aspect = innerWidth / innerHeight;
camera.updateProjectionMatrix();
renderer.setPixelRatio(Math.min(devicePixelRatio, 1.75));
renderer.setSize(innerWidth, innerHeight);
updateCamera();
}
addEventListener("resize", resize);
updateCamera();
// ---------------------------------------------------------------------
// Main loop
// ---------------------------------------------------------------------
const reducedMotion = matchMedia("(prefers-reduced-motion: reduce)").matches;
let autoPlay = !reducedMotion;
const autoStart = performance.now();
const autoDuration = 6200;
let lastProgress = -1;
function animate(now) {
requestAnimationFrame(animate);
if (autoPlay) {
const elapsed = (now - autoStart) / autoDuration;
const t = clamp(elapsed, 0, 1);
scrubber.value = (t * 100).toFixed(2);
if (t >= 1) autoPlay = false;
}
const progress = Number(scrubber.value) / 100;
if (Math.abs(progress - lastProgress) > 0.00001) {
updateProgress(progress);
lastProgress = progress;
}
const pulse = 0.5 + 0.5 * Math.sin(now * 0.006);
beacon.scale.y = 0.18 * (0.88 + pulse * 0.22);
beaconMaterial.emissiveIntensity = 1.2 + pulse * 1.4;
labelAnchors.umbrella.y = 2.48 + paths.umbrella(progress) * 0.12;
labelAnchors.pavilion.y = 3.25 + paths.pavilion(progress) * 0.12;
labelAnchors.antenna.y = 3.72 + paths.antenna(progress) * 0.10;
positionLabel("label-umbrella", labelAnchors.umbrella);
positionLabel("label-pavilion", labelAnchors.pavilion);
positionLabel("label-antenna", labelAnchors.antenna);
renderer.render(scene, camera);
}
updateProgress(0);
requestAnimationFrame(animate);
</script>
</body>
</html>
```