Prompt specification
Build or customize the Three.js 3D scene "Plan Cards With Backup Branches" 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: Plan Cards With Backup Branches
Category: Art & Culture · Style: Procedural Solid / Shader 3D
License: MIT · Reference: https://three3d.app/scene/plan-cards-with-backup-branches-x3221
Scene Description Prompt:
Use Three.js from cdnjs to model a task board with a primary route and one labeled contingency branch. The backup should connect to the same goal while requiring different visible resources. Deliver one self-contained HTML file with stylized solid shapes.
Working Three.js Starter (plan-cards-with-backup-branches-x3221):
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Deployment Route Board</title>
<style>
:root {
color-scheme: dark;
--bg: #07111c;
--panel: rgba(10, 24, 38, 0.82);
--border: rgba(151, 194, 221, 0.18);
--text: #eaf6ff;
--muted: #91aabd;
--primary: #42e0c4;
--contingency: #ffb45b;
}
* {
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: var(--bg);
font-family:
Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
"Segoe UI", sans-serif;
color: var(--text);
}
#scene {
position: fixed;
inset: 0;
display: block;
width: 100%;
height: 100%;
outline: none;
touch-action: none;
}
.hud {
position: fixed;
z-index: 10;
pointer-events: none;
}
.intro {
top: 26px;
left: 28px;
width: min(430px, calc(100vw - 56px));
padding: 18px 20px;
border: 1px solid var(--border);
border-radius: 18px;
background:
linear-gradient(135deg, rgba(21, 45, 65, 0.88), rgba(7, 17, 28, 0.82));
box-shadow: 0 18px 60px rgba(0, 0, 0, 0.25);
backdrop-filter: blur(14px);
}
.eyebrow {
display: flex;
align-items: center;
gap: 9px;
margin-bottom: 10px;
color: var(--primary);
font-size: 11px;
font-weight: 800;
letter-spacing: 0.18em;
text-transform: uppercase;
}
.eyebrow::before {
content: "";
width: 22px;
height: 2px;
border-radius: 99px;
background: currentColor;
box-shadow: 0 0 14px currentColor;
}
h1 {
margin: 0;
font-size: clamp(23px, 2.4vw, 34px);
line-height: 1.08;
letter-spacing: -0.035em;
}
.intro p {
margin: 11px 0 0;
color: var(--muted);
font-size: 13px;
line-height: 1.55;
}
.detail {
top: 28px;
right: 28px;
width: 265px;
padding: 15px 17px;
border: 1px solid var(--border);
border-radius: 16px;
background: var(--panel);
box-shadow: 0 18px 60px rgba(0, 0, 0, 0.22);
backdrop-filter: blur(14px);
}
.detail-label {
color: var(--muted);
font-size: 10px;
font-weight: 800;
letter-spacing: 0.16em;
text-transform: uppercase;
}
#detail-title {
margin-top: 6px;
font-size: 16px;
font-weight: 750;
}
#detail-text {
margin-top: 5px;
color: var(--muted);
font-size: 12px;
line-height: 1.45;
}
.legend {
left: 28px;
bottom: 28px;
width: min(420px, calc(100vw - 56px));
padding: 15px 17px;
border: 1px solid var(--border);
border-radius: 16px;
background: var(--panel);
box-shadow: 0 18px 60px rgba(0, 0, 0, 0.22);
backdrop-filter: blur(14px);
}
.legend-row {
display: flex;
align-items: flex-start;
gap: 10px;
color: var(--muted);
font-size: 12px;
line-height: 1.4;
}
.legend-row + .legend-row {
margin-top: 10px;
}
.swatch {
flex: 0 0 auto;
width: 25px;
height: 7px;
margin-top: 4px;
border-radius: 99px;
background: var(--primary);
box-shadow: 0 0 12px rgba(66, 224, 196, 0.4);
}
.swatch.orange {
background: var(--contingency);
box-shadow: 0 0 12px rgba(255, 180, 91, 0.38);
}
.legend strong {
color: var(--text);
font-weight: 700;
}
.controls {
right: 28px;
bottom: 28px;
display: flex;
align-items: center;
gap: 12px;
pointer-events: auto;
}
.hint {
padding: 10px 13px;
border: 1px solid var(--border);
border-radius: 12px;
background: var(--panel);
color: var(--muted);
font-size: 11px;
backdrop-filter: blur(14px);
}
#reset {
min-height: 39px;
padding: 0 15px;
border: 1px solid rgba(66, 224, 196, 0.3);
border-radius: 12px;
background: rgba(66, 224, 196, 0.1);
color: var(--primary);
font: inherit;
font-size: 12px;
font-weight: 750;
cursor: pointer;
transition:
background 160ms ease,
transform 160ms ease;
}
#reset:hover {
background: rgba(66, 224, 196, 0.18);
transform: translateY(-1px);
}
#reset:focus-visible {
outline: 2px solid var(--primary);
outline-offset: 3px;
}
#loading {
position: fixed;
inset: 0;
z-index: 30;
display: grid;
place-items: center;
background: var(--bg);
color: var(--muted);
font-size: 12px;
letter-spacing: 0.16em;
text-transform: uppercase;
transition: opacity 350ms ease;
}
#loading.hidden {
opacity: 0;
pointer-events: none;
}
@media (max-width: 820px) {
.intro {
top: 14px;
left: 14px;
width: calc(100vw - 28px);
padding: 14px 16px;
}
.intro p {
display: none;
}
.detail {
display: none;
}
.legend {
left: 14px;
bottom: 14px;
width: calc(100vw - 28px);
}
.controls {
right: 14px;
bottom: 142px;
}
.hint {
display: none;
}
}
</style>
</head>
<body>
<canvas id="scene" aria-label="Interactive three-dimensional deployment task board"></canvas>
<section class="hud intro">
<div class="eyebrow">Operations / Deployment 07</div>
<h1>One goal. Two ways through.</h1>
<p>
The primary route uses the core team and standard bench. The labeled
contingency mobilizes a partner crew and mobile power, then reconnects
to the same launch goal.
</p>
</section>
<section class="hud detail" aria-live="polite">
<div class="detail-label">Board focus</div>
<div id="detail-title">Shared objective</div>
<div id="detail-text">Hover over a task to inspect its assigned resources.</div>
</section>
<section class="hud legend">
<div class="legend-row">
<span class="swatch"></span>
<span><strong>Primary route</strong> — core team + standard bench</span>
</div>
<div class="legend-row">
<span class="swatch orange"></span>
<span><strong>Contingency</strong> — partner crew + mobile power</span>
</div>
</section>
<div class="hud controls">
<div class="hint">Drag to orbit · Scroll to zoom · Double-click to reset</div>
<button id="reset" type="button">Reset view</button>
</div>
<div id="loading">Loading task board</div>
<script type="module">
import * as THREE from
"https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
const canvas = document.querySelector("#scene");
const loading = document.querySelector("#loading");
const detailTitle = document.querySelector("#detail-title");
const detailText = document.querySelector("#detail-text");
const scene = new THREE.Scene();
scene.background = new THREE.Color(0x07111c);
scene.fog = new THREE.Fog(0x07111c, 24, 48);
const renderer = new THREE.WebGLRenderer({
canvas,
antialias: true,
powerPreference: "high-performance"
});
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1.08;
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
const camera = new THREE.PerspectiveCamera(
42,
window.innerWidth / window.innerHeight,
0.1,
100
);
const target = new THREE.Vector3(0, -0.1, 0);
const spherical = new THREE.Spherical(17.2, Math.PI / 2 - 0.015, 0.025);
function updateCamera() {
camera.position.setFromSpherical(spherical).add(target);
camera.lookAt(target);
}
updateCamera();
const hemisphere = new THREE.HemisphereLight(
0x9edfff,
0x08111b,
1.45
);
scene.add(hemisphere);
const keyLight = new THREE.DirectionalLight(0xe8f6ff, 3.2);
keyLight.position.set(-5, 9, 13);
keyLight.castShadow = true;
keyLight.shadow.mapSize.set(2048, 2048);
keyLight.shadow.camera.left = -13;
keyLight.shadow.camera.right = 13;
keyLight.shadow.camera.top = 9;
keyLight.shadow.camera.bottom = -9;
keyLight.shadow.camera.near = 1;
keyLight.shadow.camera.far = 40;
keyLight.shadow.bias = -0.0003;
scene.add(keyLight);
const tealLight = new THREE.PointLight(0x42e0c4, 14, 18, 2);
tealLight.position.set(-6, 4, 7);
scene.add(tealLight);
const orangeLight = new THREE.PointLight(0xffa640, 12, 16, 2);
orangeLight.position.set(4, -4, 6);
scene.add(orangeLight);
const PRIMARY = 0x42e0c4;
const CONTINGENCY = 0xffb45b;
const INTERACTIVE = [];
const ROUTE_ANIMATIONS = [];
function roundedRectShape(width, height, radius) {
const x = -width / 2;
const y = -height / 2;
const r = Math.min(radius, width / 2, height / 2);
const shape = new THREE.Shape();
shape.moveTo(x + r, y);
shape.lineTo(x + width - r, y);
shape.quadraticCurveTo(x + width, y, x + width, y + r);
shape.lineTo(x + width, y + height - r);
shape.quadraticCurveTo(
x + width,
y + height,
x + width - r,
y + height
);
shape.lineTo(x + r, y + height);
shape.quadraticCurveTo(x, y + height, x, y + height - r);
shape.lineTo(x, y + r);
shape.quadraticCurveTo(x, y, x + r, y);
return shape;
}
function roundedMesh(
width,
height,
depth,
radius,
material,
bevelSize = 0.025
) {
const geometry = new THREE.ExtrudeGeometry(
roundedRectShape(width, height, radius),
{
depth,
bevelEnabled: true,
bevelSegments: 3,
steps: 1,
bevelSize,
bevelThickness: bevelSize,
curveSegments: 10
}
);
geometry.center();
const mesh = new THREE.Mesh(geometry, material);
mesh.castShadow = true;
mesh.receiveShadow = true;
return mesh;
}
function standardMaterial(color, roughness = 0.68, metalness = 0.05) {
return new THREE.MeshStandardMaterial({
color,
roughness,
metalness
});
}
function canvasRoundRect(ctx, x, y, w, h, radius) {
const r = Math.min(radius, w / 2, h / 2);
ctx.beginPath();
ctx.moveTo(x + r, y);
ctx.lineTo(x + w - r, y);
ctx.quadraticCurveTo(x + w, y, x + w, y + r);
ctx.lineTo(x + w, y + h - r);
ctx.quadraticCurveTo(x + w, y + h, x + w - r, y + h);
ctx.lineTo(x + r, y + h);
ctx.quadraticCurveTo(x, y + h, x, y + h - r);
ctx.lineTo(x, y + r);
ctx.quadraticCurveTo(x, y, x + r, y);
ctx.closePath();
}
function textPlane(
text,
width,
height,
{
color = "#eaf6ff",
background = null,
border = null,
fontSize = 120,
weight = 750,
padding = 36,
letterSpacing = 0
} = {}
) {
const textureHeight = 512;
const textureWidth = Math.min(
2048,
Math.max(256, Math.round(textureHeight * (width / height)))
);
const c = document.createElement("canvas");
c.width = textureWidth;
c.height = textureHeight;
const ctx = c.getContext("2d");
if (background) {
ctx.fillStyle = background;
canvasRoundRect(
ctx,
4,
4,
textureWidth - 8,
textureHeight - 8,
textureHeight * 0.24
);
ctx.fill();
}
if (border) {
ctx.strokeStyle = border;
ctx.lineWidth = Math.max(3, textureHeight * 0.018);
canvasRoundRect(
ctx,
7,
7,
textureWidth - 14,
textureHeight - 14,
textureHeight * 0.23
);
ctx.stroke();
}
let size = fontSize;
const family =
'Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif';
function fitText() {
ctx.font = `${weight} ${size}px ${family}`;
const measured = ctx.measureText(text).width + padding * 2;
return measured <= textureWidth - 16;
}
while (!fitText() && size > 18) {
size -= 2;
}
ctx.font = `${weight} ${size}px ${family}`;
ctx.textAlign = "center";
ctx.textBaseline = "middle";
ctx.fillStyle = color;
if (letterSpacing && "letterSpacing" in ctx) {
ctx.letterSpacing = `${letterSpacing}px`;
}
ctx.shadowColor = "rgba(0, 0, 0, 0.25)";
ctx.shadowBlur = size * 0.12;
ctx.fillText(text, textureWidth / 2, textureHeight / 2 + size * 0.025);
ctx.shadowBlur = 0;
const map = new THREE.CanvasTexture(c);
map.colorSpace = THREE.SRGBColorSpace;
map.anisotropy = Math.min(8, renderer.capabilities.getMaxAnisotropy());
map.minFilter = THREE.LinearMipmapLinearFilter;
map.magFilter = THREE.LinearFilter;
const material = new THREE.MeshBasicMaterial({
map,
transparent: true,
depthWrite: false,
depthTest: false,
toneMapped: false
});
const mesh = new THREE.Mesh(new THREE.PlaneGeometry(width, height), material);
mesh.renderOrder = 30;
return mesh;
}
function addPlaneText(
parent,
text,
width,
height,
x,
y,
z,
options = {}
) {
const label = textPlane(text, width, height, options);
label.position.set(x, y, z);
parent.add(label);
return label;
}
// Standing board and room.
const board = new THREE.Group();
scene.add(board);
const outerMaterial = standardMaterial(0x0c1c2c, 0.5, 0.15);
const outerBoard = roundedMesh(
18,
10,
0.46,
0.38,
outerMaterial,
0.065
);
outerBoard.position.z = -0.68;
board.add(outerBoard);
const innerMaterial = standardMaterial(0x10283a, 0.78, 0.02);
const innerBoard = roundedMesh(
17.55,
9.55,
0.14,
0.3,
innerMaterial,
0.035
);
innerBoard.position.z = -0.36;
board.add(innerBoard);
const floor = new THREE.Mesh(
new THREE.PlaneGeometry(70, 70),
standardMaterial(0x07111b, 0.94, 0)
);
floor.rotation.x = -Math.PI / 2;
floor.position.set(0, -5.18, 0);
floor.receiveShadow = true;
scene.add(floor);
// Subtle graph-paper grid.
const gridMaterial = new THREE.MeshBasicMaterial({
color: 0x6b9ab8,
transparent: true,
opacity: 0.095,
depthWrite: false
});
for (let x = -8; x <= 8; x += 1) {
const line = new THREE.Mesh(
new THREE.BoxGeometry(0.012, 9.05, 0.012),
gridMaterial
);
line.position.set(x, 0, -0.275);
board.add(line);
}
for (let y = -4; y <= 4; y += 1) {
const line = new THREE.Mesh(
new THREE.BoxGeometry(17.1, 0.012, 0.012),
gridMaterial
);
line.position.set(0, y, -0.275);
board.add(line);
}
// Route lanes.
const primaryLane = roundedMesh(
11.6,
2.25,
0.045,
0.3,
new THREE.MeshStandardMaterial({
color: 0x123d3d,
roughness: 0.85,
transparent: true,
opacity: 0.62,
depthWrite: false
}),
0.008
);
primaryLane.position.set(2.1, 2.2, -0.205);
primaryLane.castShadow = false;
board.add(primaryLane);
const contingencyLane = roundedMesh(
8.25,
2.25,
0.045,
0.3,
new THREE.MeshStandardMaterial({
color: 0x49351f,
roughness: 0.85,
transparent: true,
opacity: 0.58,
depthWrite: false
}),
0.008
);
contingencyLane.position.set(1.5, -2.05, -0.205);
contingencyLane.castShadow = false;
board.add(contingencyLane);
addPlaneText(
board,
"DEPLOYMENT / ROUTE 07",
7.8,
0.72,
-3.9,
4.12,
0.02,
{
color: "#e9f7ff",
fontSize: 142,
weight: 820
}
);
addPlaneText(
board,
"ONE DESTINATION · TWO RESOURCE PLANS",
6.8,
0.34,
-4.25,
3.59,
0.02,
{
color: "#7897aa",
fontSize: 74,
weight: 760,
letterSpacing: 3
}
);
addPlaneText(
board,
"PRIMARY ROUTE / CORE RESOURCES",
6.3,
0.43,
3.05,
3.27,
0.04,
{
color: "#9ff8e8",
background: "rgba(12, 57, 55, 0.94)",
border: "rgba(66, 224, 196, 0.55)",
fontSize: 66,
weight: 820,
padding: 55
}
);
addPlaneText(
board,
"CONTINGENCY / FIELD FALLBACK",
6.0,
0.43,
1.1,
-3.25,
0.04,
{
color: "#ffe0b5",
background: "rgba(73, 49, 25, 0.95)",
border: "rgba(255, 180, 91, 0.55)",
fontSize: 66,
weight: 820,
padding: 55
}
);
// Board corner fasteners.
const screwMaterial = standardMaterial(0x8aa8ba, 0.32, 0.72);
for (const x of [-8.35, 8.35]) {
for (const y of [-4.35, 4.35]) {
const screw = new THREE.Mesh(
new THREE.CylinderGeometry(0.075, 0.075, 0.055, 20),
screwMaterial
);
screw.rotation.x = Math.PI / 2;
screw.position.set(x, y, -0.18);
board.add(screw);
}
}
function addIcon(parent, icon, x, y, z = 0.47) {
icon.position.set(x, y, z);
parent.add(icon);
return icon;
}
function coreTeamIcon() {
const group = new THREE.Group();
const teal = standardMaterial(PRIMARY, 0.38, 0.22);
const pale = standardMaterial(0xbffcf0, 0.4, 0.08);
[-0.18, 0, 0.18].forEach((x, index) => {
const person = new THREE.Group();
const body = new THREE.Mesh(
new THREE.CapsuleGeometry(0.105, 0.25, 4, 10),
teal
);
body.position.y = -0.08;
body.scale.set(0.88, 1, 0.8);
body.castShadow = true;
person.add(body);
const head = new THREE.Mesh(
new THREE.SphereGeometry(0.125, 14, 10),
index === 1 ? pale : teal
);
head.position.y = 0.25;
head.castShadow = true;
person.add(head);
person.position.x = x;
person.position.y = index === 1 ? 0.04 : -0.02;
group.add(person);
});
return group;
}
function partnerCrewIcon() {
const group = new THREE.Group();
const orange = standardMaterial(CONTINGENCY, 0.43, 0.12);
const dark = standardMaterial(0x51351d, 0.72, 0.08);
const helmet = standardMaterial(0xffd477, 0.34, 0.18);
[-0.15, 0.15].forEach((x, index) => {
const person = new THREE.Group();
const body = new THREE.Mesh(
new THREE.CapsuleGeometry(0.12, 0.25, 4, 10),
orange
);
body.position.y = -0.08;
body.castShadow = true;
person.add(body);
const head = new THREE.Mesh(
new THREE.SphereGeometry(0.115, 14, 9),
dark
);
head.position.y = 0.25;
person.add(head);
const hat = new THREE.Mesh(
new THREE.SphereGeometry(
0.145,
16,
10,
0,
Math.PI * 2,
0,
Math.PI / 2
),
helmet
);
hat.position.y = 0.285;
hat.castShadow = true;
person.add(hat);
const brim = new THREE.Mesh(
new THREE.CylinderGeometry(0.175, 0.175, 0.035, 18),
helmet
);
brim.position.y = 0.285;
person.add(brim);
person.position.x = x;
person.position.y = index === 0 ? 0.02 : -0.03;
group.add(person);
});
return group;
}
function workbenchIcon() {
const group = new THREE.Group();
const teal = standardMaterial(PRIMARY, 0.42, 0.28);
const dark = standardMaterial(0x163242, 0.6, 0.18);
const light = standardMaterial(0xc7fff3, 0.3, 0.12);
const table = new THREE.Mesh(
new THREE.BoxGeometry(0.72, 0.12, 0.22),
teal
);
table.position.y = -0.18;
table.castShadow = true;
group.add(table);
for (const x of [-0.25, 0.25]) {
const leg = new THREE.Mesh(
new THREE.BoxGeometry(0.075, 0.34, 0.12),
teal
);
leg.position.set(x, -0.38, 0);
group.add(leg);
}
const frame = new THREE.Mesh(
new THREE.BoxGeometry(0.67, 0.42, 0.12),
teal
);
frame.position.set(0, 0.15, -0.04);
frame.castShadow = true;
group.add(frame);
const screen = new THREE.Mesh(
new THREE.BoxGeometry(0.48, 0.24, 0.035),
dark
);
screen.position.set(0, 0.17, 0.065);
group.add(screen);
const indicator = new THREE.Mesh(
new THREE.BoxGeometry(0.18, 0.035, 0.025),
light
);
indicator.position.set(-0.09, 0.18, 0.09);
group.add(indicator);
return group;
}
function generatorIcon() {
const group = new THREE.Group();
const orange = standardMaterial(CONTINGENCY, 0.45, 0.18);
const dark = standardMaterial(0x17202a, 0.78, 0.08);
const steel = standardMaterial(0x9db2bf, 0.35, 0.7);
const body = new THREE.Mesh(
new THREE.BoxGeometry(0.72, 0.42, 0.3),
orange
);
body.position.y = 0.03;
body.castShadow = true;
group.add(body);
const panel = new THREE.Mesh(
new THREE.BoxGeometry(0.42, 0.2, 0.035),
dark
);
panel.position.set(-0.04, 0.06, 0.17);
group.add(panel);
const handle = new THREE.Mesh(
new THREE.TorusGeometry(0.2, 0.035, 8, 20, Math.PI),
steel
);
handle.position.set(0.08, 0.27, 0);
handle.rotation.z = Math.PI;
group.add(handle);
for (const x of [-0.23, 0.23]) {
const wheel = new THREE.Mesh(
new THREE.CylinderGeometry(0.105, 0.105, 0.09, 18),
dark
);
wheel.rotation.x = Math.PI / 2;
wheel.position.set(x, -0.25, 0.16);
group.add(wheel);
}
const exhaust = new THREE.Mesh(
new THREE.CylinderGeometry(0.035, 0.045, 0.24, 10),
steel
);
exhaust.position.set(-0.27, 0.34, 0);
group.add(exhaust);
return group;
}
function startIcon() {
const group = new THREE.Group();
const ring = new THREE.Mesh(
new THREE.TorusGeometry(0.25, 0.045, 10, 28),
standardMaterial(PRIMARY, 0.35, 0.28)
);
group.add(ring);
const triangle = new THREE.Shape();
triangle.moveTo(-0.09, -0.13);
triangle.lineTo(0.16, 0);
triangle.lineTo(-0.09, 0.13);
triangle.closePath();
const play = new THREE.Mesh(
new THREE.ShapeGeometry(triangle),
standardMaterial(PRIMARY, 0.35, 0.18)
);
play.position.z = 0.02;
group.add(play);
return group;
}
function intakeIcon() {
const group = new THREE.Group();
const teal = standardMaterial(PRIMARY, 0.4, 0.22);
const pale = standardMaterial(0xcffff4, 0.4, 0.08);
const clipboard = new THREE.Mesh(
new THREE.BoxGeometry(0.46, 0.54, 0.12),
teal
);
clipboard.castShadow = true;
group.add(clipboard);
const clip = new THREE.Mesh(
new THREE.BoxGeometry(0.23, 0.1, 0.1),
pale
);
clip.position.y = 0.28;
group.add(clip);
const checkPoints = [
new THREE.Vector3(-0.12, 0.02, 0.09),
new THREE.Vector3(-0.03, -0.07, 0.09),
new THREE.Vector3(0.15, 0.14, 0.09)
];
const check = new THREE.Line(
new THREE.BufferGeometry().setFromPoints(checkPoints),
new THREE.LineBasicMaterial({ color: 0xffffff })
);
group.add(check);
return group;
}
function decisionIcon() {
const group = new THREE.Group();
const teal = standardMaterial(PRIMARY, 0.4, 0.2);
const orange = standardMaterial(CONTINGENCY, 0.4, 0.18);
const stem = new THREE.Mesh(
new THREE.BoxGeometry(0.055, 0.3, 0.08),
teal
);
stem.position.y = 0.02;
group.add(stem);
const top = new THREE.Mesh(
new THREE.SphereGeometry(0.09, 14, 10),
teal
);
top.position.y = 0.2;
group.add(top);
const leftStem = new THREE.Mesh(
new THREE.BoxGeometry(0.19, 0.045, 0.08),
orange
);
leftStem.position.set(-0.1, -0.12, 0);
group.add(leftStem);
const rightStem = new THREE.Mesh(
new THREE.BoxGeometry(0.19, 0.045, 0.08),
teal
);
rightStem.position.set(0.1, -0.12, 0);
group.add(rightStem);
const leftDot = new THREE.Mesh(
new THREE.SphereGeometry(0.085, 14, 10),
orange
);
leftDot.position.set(-0.2, -0.12, 0);
group.add(leftDot);
const rightDot = new THREE.Mesh(
new THREE.SphereGeometry(0.085, 14, 10),
teal
);
rightDot.position.set(0.2, -0.12, 0);
group.add(rightDot);
return group;
}
function goalIcon() {
const group = new THREE.Group();
const pole = new THREE.Mesh(
new THREE.CylinderGeometry(0.035, 0.035, 0.7, 12),
standardMaterial(0xdcecf4, 0.35, 0.55)
);
pole.position.y = 0.02;
pole.castShadow = true;
group.add(pole);
const flagShape = new THREE.Shape();
flagShape.moveTo(0, 0.28);
flagShape.lineTo(0.46, 0.14);
flagShape.lineTo(0.35, -0.02);
flagShape.lineTo(0, 0.08);
flagShape.closePath();
const flag = new THREE.Mesh(
new THREE.ShapeGeometry(flagShape),
standardMaterial(PRIMARY, 0.35, 0.16)
);
flag.position.set(0.025, 0, 0.025);
group.add(flag);
const base = new THREE.Mesh(
new THREE.CylinderGeometry(0.18, 0.22, 0.08, 18),
standardMaterial(0xc8d8df, 0.4, 0.42)
);
base.position.y = -0.34;
group.add(base);
return group;
}
function makeCard({
x,
y,
width = 2.25,
height = 1.5,
color = PRIMARY,
title,
resource,
icon,
type,
detail
}) {
const group = new THREE.Group();
group.position.set(x, y, 0);
const accentMaterial = standardMaterial(color, 0.42, 0.22);
const bodyMaterial = standardMaterial(0x132a3b, 0.68, 0.08);
bodyMaterial.emissive.set(color);
bodyMaterial.emissiveIntensity = 0.025;
const backing = roundedMesh(
width + 0.1,
height + 0.1,
0.11,
0.22,
accentMaterial,
0.025
);
backing.position.z = 0.09;
group.add(backing);
const body = roundedMesh(
width,
height,
0.29,
0.19,
bodyMaterial,
0.035
);
body.position.z = 0.19;
group.add(body);
const stripe = new THREE.Mesh(
new THREE.BoxGeometry(0.065, height * 0.58, 0.045),
accentMaterial
);
stripe.position.set(-width / 2 + 0.16, 0, 0.365);
group.add(stripe);
const textWidth = width * 0.61;
addPlaneText(
group,
title,
textWidth,
0.34,
-width * 0.11,
0.27,
0.39,
{
color: "#effaff",
fontSize: 112,
weight: 790
}
);
addPlaneText(
group,
resource,
textWidth,
0.25,
-width * 0.11,
-0.19,
0.39,
{
color: `#${new THREE.Color(color).getHexString()}`,
fontSize: 77,
weight: 760,
letterSpacing: 1
}
);
if (icon) {
addIcon(group, icon, width / 2 - 0.39, -0.01, 0.43);
}
const hitbox = new THREE.Mesh(
new THREE.BoxGeometry(width, height, 0.65),
new THREE.MeshBasicMaterial({
transparent: true,
opacity: 0,
depthWrite: false
})
);
hitbox.position.z = 0.25;
hitbox.userData = {
title,
detail,
type,
bodyMaterial
};
group.add(hitbox);
INTERACTIVE.push(hitbox);
board.add(group);
return group;
}
makeCard({
x: -7.15,
y: 2.2,
width: 1.65,
height: 1.35,
color: PRIMARY,
title: "Start",
resource: "Approved",
icon: startIcon(),
type: "Entry",
detail: "The deployment request is approved and ready for intake."
});
makeCard({
x: -4.85,
y: 2.2,
width: 1.75,
height: 1.35,
color: PRIMARY,
title: "Intake",
resource: "Scope set",
icon: intakeIcon(),
type: "Preparation",
detail: "Scope and acceptance criteria are confirmed before routing."
});
makeCard({
x: -2.45,
y: 2.2,
width: 1.75,
height: 1.35,
color: PRIMARY,
title: "Choose",
resource: "Route switch",
icon: decisionIcon(),
type: "Decision",
detail: "Select the primary resource plan or activate the contingency branch."
});
makeCard({
x: 0.3,
y: 2.2,
color: PRIMARY,
title: "Assemble",
resource: "Core team",
icon: coreTeamIcon(),
type: "Primary task",
detail: "The in-house core team performs the standard assembly work."
});
makeCard({
x: 3.15,
y: 2.2,
color: PRIMARY,
title: "Validate",
resource: "Standard bench",
icon: workbenchIcon(),
type: "Primary task",
detail: "The primary plan validates the assembly using the standard test bench."
});
makeCard({
x: 0.3,
y: -2.05,
color: CONTINGENCY,
title: "Mobilize",
resource: "Partner crew",
icon: partnerCrewIcon(),
type: "Contingency task",
detail: "The contingency branch mobilizes a visibly different partner crew."
});
makeCard({
x: 3.15,
y: -2.05,
color: CONTINGENCY,
title: "Restore",
resource: "Mobile power",
icon: generatorIcon(),
type: "Contingency task",
detail: "The field team restores service with the mobile power generator."
});
// Shared goal card, with both route colors.
const goalGroup = new THREE.Group();
goalGroup.position.set(6.95, 0, 0);
const goalBackingMaterial = standardMaterial(PRIMARY, 0.4, 0.24);
const goalBodyMaterial = standardMaterial(0x173245, 0.62, 0.12);
goalBodyMaterial.emissive.set(PRIMARY);
goalBodyMaterial.emissiveIntensity = 0.05;
const goalBacking = roundedMesh(
2.45,
1.85,
0.12,
0.25,
goalBackingMaterial,
0.035
);
goalBacking.position.z = 0.09;
goalGroup.add(goalBacking);
const goalBody = roundedMesh(
2.35,
1.75,
0.3,
0.22,
goalBodyMaterial,
0.04
);
goalBody.position.z = 0.19;
goalGroup.add(goalBody);
const goalStripePrimary = new THREE.Mesh(
new THREE.BoxGeometry(1.95, 0.055, 0.05),
standardMaterial(PRIMARY, 0.34, 0.28)
);
goalStripePrimary.position.set(-0.05, 0.63, 0.37);
goalGroup.add(goalStripePrimary);
const goalStripeOrange = new THREE.Mesh(
new THREE.BoxGeometry(1.95, 0.055, 0.05),
standardMaterial(CONTINGENCY, 0.36, 0.24)
);
goalStripeOrange.position.set(-0.05, -0.63, 0.37);
goalGroup.add(goalStripeOrange);
addPlaneText(
goalGroup,
"SHARED GOAL",
1.35,
0.31,
-0.22,
0.29,
0.39,
{
color: "#effaff",
fontSize: 92,
weight: 820,
letterSpacing: 2
}
);
addPlaneText(
goalGroup,
"Launch complete",
1.35,
0.25,
-0.22,
-0.18,
0.39,
{
color: "#a8f8e9",
fontSize: 74,
weight: 730
}
);
addIcon(goalGroup, goalIcon(), 0.76, 0.03, 0.42);
const goalHitbox = new THREE.Mesh(
new THREE.BoxGeometry(2.35, 1.75, 0.65),
new THREE.MeshBasicMaterial({
transparent: true,
opacity: 0,
depthWrite: false
})
);
goalHitbox.position.z = 0.25;
goalHitbox.userData = {
title: "Shared goal — Launch complete",
detail: "Both resource routes terminate at the same launch objective.",
type: "Shared objective",
bodyMaterial: goalBodyMaterial
};
goalGroup.add(goalHitbox);
INTERACTIVE.push(goalHitbox);
board.add(goalGroup);
// A subtle halo behind the goal.
const goalHalo = new THREE.Mesh(
new THREE.TorusGeometry(0.76, 0.025, 8, 64),
new THREE.MeshBasicMaterial({
color: PRIMARY,
transparent: true,
opacity: 0.2,
depthWrite: false
})
);
goalHalo.position.set(6.95, 0, -0.12);
board.add(goalHalo);
function createRoute(points, color, routeIndex) {
const curvePoints = points.map(
(point) => new THREE.Vector3(point[0], point[1], -0.015)
);
if (curvePoints.length === 2) {
const middle = curvePoints[0].clone().lerp(curvePoints[1], 0.5);
curvePoints.splice(1, 0, middle);
}
const curve = new THREE.CatmullRomCurve3(
curvePoints,
false,
"centripetal",
0.12
);
const outerMaterial = new THREE.MeshStandardMaterial({
color: 0x07131e,
roughness: 0.6,
metalness: 0.08
});
const routeMaterial = new THREE.MeshStandardMaterial({
color,
emissive: color,
emissiveIntensity: 0.38,
roughness: 0.36,
metalness: 0.18
});
const outerTube = new THREE.Mesh(
new THREE.TubeGeometry(curve, 64, 0.105, 10, false),
outerMaterial
);
outerTube.castShadow = true;
board.add(outerTube);
const innerTube = new THREE.Mesh(
new THREE.TubeGeometry(curve, 64, 0.064, 10, false),
routeMaterial
);
innerTube.castShadow = true;
board.add(innerTube);
const arrowMaterial = new THREE.MeshStandardMaterial({
color,
emissive: color,
emissiveIntensity: 0.7,
roughness: 0.32,
metalness: 0.18
});
const arrow = new THREE.Mesh(
new THREE.ConeGeometry(0.16, 0.38, 14),
arrowMaterial
);
const arrowT = 0.66;
arrow.position.copy(curve.getPointAt(arrowT));
const tangent = curve.getTangentAt(arrowT).normalize();
arrow.quaternion.setFromUnitVectors(
new THREE.Vector3(0, 1, 0),
tangent
);
arrow.castShadow = true;
board.add(arrow);
const pulse = new THREE.Mesh(
new THREE.SphereGeometry(0.085, 12, 8),
new THREE.MeshBasicMaterial({
color,
transparent: true,
opacity: 0.95,
toneMapped: false
})
);
board.add(pulse);
ROUTE_ANIMATIONS.push({
curve,
pulse,
routeIndex,
speed: 0.13 + (routeIndex % 3) * 0.018
});
}
// Primary route.
createRoute(
[
[-6.325, 2.2],
[-5.725, 2.2]
],
PRIMARY,
0
);
createRoute(
[
[-3.975, 2.2],
[-3.325, 2.2]
],
PRIMARY,
1
);
createRoute(
[
[-1.575, 2.2],
[-0.825, 2.2]
],
PRIMARY,
2
);
createRoute(
[
[1.425, 2.2],
[2.025, 2.2]
],
PRIMARY,
3
);
createRoute(
[
[4.275, 2.2],
[5.08, 2.2],
[5.52, 1.38],
[5.75, 0.43],
[5.775, 0]
],
PRIMARY,
4
);
// One continuous contingency branch: decision → partner crew →
// mobile power → the same shared goal.
createRoute(
[
[-2.45, 1.525],
[-2.45, 0.55],
[-1.35, 0.55],
[-1.35, -2.05],
[-0.825, -2.05]
],
CONTINGENCY,
5
);
createRoute(
[
[1.425, -2.05],
[2.025, -2.05]
],
CONTINGENCY,
6
);
createRoute(
[
[4.275, -2.05],
[5.08, -2.05],
[5.52, -1.38],
[5.75, -0.43],
[5.775, 0]
],
CONTINGENCY,
7
);
// Direct camera controls implemented without Three.js addons.
let dragging = false;
let pointerId = null;
let lastX = 0;
let lastY = 0;
let moved = false;
const raycaster = new THREE.Raycaster();
const pointer = new THREE.Vector2();
let hoveredHitbox = null;
function resetView() {
spherical.radius = 17.2;
spherical.phi = Math.PI / 2 - 0.015;
spherical.theta = 0.025;
target.set(0, -0.1, 0);
updateCamera();
}
function setHovered(hitbox) {
if (hoveredHitbox === hitbox) return;
if (hoveredHitbox) {
hoveredHitbox.userData.bodyMaterial.emissiveIntensity = 0.025;
}
hoveredHitbox = hitbox;
if (hoveredHitbox) {
hoveredHitbox.userData.bodyMaterial.emissiveIntensity = 0.2;
detailTitle.textContent = hoveredHitbox.userData.title;
detailText.textContent = hoveredHitbox.userData.detail;
} else {
detailTitle.textContent = "Shared objective";
detailText.textContent =
"Hover over a task to inspect its assigned resources.";
}
}
function updatePointer(event) {
const rect = canvas.getBoundingClientRect();
pointer.x = ((event.clientX - rect.left) / rect.width) * 2 - 1;
pointer.y = -((event.clientY - rect.top) / rect.height) * 2 + 1;
}
function inspectPointer(event) {
updatePointer(event);
raycaster.setFromCamera(pointer, camera);
const hits = raycaster.intersectObjects(INTERACTIVE, false);
setHovered(hits.length ? hits[0].object : null);
}
canvas.addEventListener("pointerdown", (event) => {
dragging = true;
moved = false;
pointerId = event.pointerId;
lastX = event.clientX;
lastY = event.clientY;
canvas.setPointerCapture(event.pointerId);
canvas.style.cursor = "grabbing";
});
canvas.addEventListener("pointermove", (event) => {
if (dragging && event.pointerId === pointerId) {
const dx = event.clientX - lastX;
const dy = event.clientY - lastY;
if (Math.abs(dx) + Math.abs(dy) > 1) moved = true;
spherical.theta = THREE.MathUtils.clamp(
spherical.theta - dx * 0.005,
-0.68,
0.68
);
spherical.phi = THREE.MathUtils.clamp(
spherical.phi + dy * 0.004,
1.2,
1.82
);
lastX = event.clientX;
lastY = event.clientY;
updateCamera();
} else {
inspectPointer(event);
}
});
function endDrag(event) {
if (event.pointerId !== pointerId) return;
dragging = false;
pointerId = null;
canvas.style.cursor = "grab";
inspectPointer(event);
}
canvas.addEventListener("pointerup", endDrag);
canvas.addEventListener("pointercancel", endDrag);
canvas.addEventListener(
"wheel",
(event) => {
event.preventDefault();
spherical.radius = THREE.MathUtils.clamp(
spherical.radius + event.deltaY * 0.012,
13,
25
);
updateCamera();
},
{ passive: false }
);
canvas.addEventListener("dblclick", resetView);
canvas.addEventListener("pointerleave", () => {
if (!dragging) setHovered(null);
});
document.querySelector("#reset").addEventListener("click", resetView);
window.addEventListener("keydown", (event) => {
if (event.key.toLowerCase() === "r") resetView();
});
function onResize() {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.setSize(window.innerWidth, window.innerHeight);
}
window.addEventListener("resize", onResize);
const clock = new THREE.Clock();
function animate() {
requestAnimationFrame(animate);
const elapsed = clock.getElapsedTime();
for (const animation of ROUTE_ANIMATIONS) {
const t = (elapsed * animation.speed + animation.routeIndex * 0.137) % 1;
const point = animation.curve.getPointAt(t);
animation.pulse.position.copy(point);
animation.pulse.position.z += 0.055;
const pulse = 0.82 + Math.sin(elapsed * 5 + animation.routeIndex) * 0.18;
animation.pulse.scale.setScalar(pulse);
}
const haloScale = 1 + Math.sin(elapsed * 1.7) * 0.045;
goalHalo.scale.setScalar(haloScale);
goalHalo.material.opacity = 0.18 + Math.sin(elapsed * 1.7) * 0.035;
renderer.render(scene, camera);
}
animate();
requestAnimationFrame(() => loading.classList.add("hidden"));
</script>
</body>
</html>
```