Prompt specification
Build or customize the Three.js 3D scene "Three Invention Nodes and Prerequisite Links" 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: Three Invention Nodes and Prerequisite Links
Category: Games & Play · Style: Procedural Solid / Shader 3D
License: MIT · Reference: https://three3d.app/scene/three-invention-nodes-and-prerequisite-links-x3581
Scene Description Prompt:
Please use Three.js from cdnjs for a stylized scene based on this idea: three invention nodes and prerequisite links. Arrange three fictional invention blocks with a forked dependency graph. Distinguish a required prerequisite from a merely nearby or historically associated idea. Return one self-contained HTML file.
Working Three.js Starter (three-invention-nodes-and-prerequisite-links-x3581):
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Atlas of Inventions — Forked Dependency Graph</title>
<style>
:root {
--paper: #f1ede4;
--paper-light: #faf8f2;
--ink: #183130;
--muted: #6f7a76;
--line: rgba(24, 49, 48, 0.16);
--required: #e45f43;
--associated: #758987;
--caliper: #e26b43;
--chronometer: #168b84;
--orrery: #7365b2;
}
* {
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
color: var(--ink);
background:
radial-gradient(circle at 48% 38%, rgba(255, 255, 255, 0.92), transparent 43%),
linear-gradient(145deg, #f6f2e9 0%, #e9e4da 100%);
font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
"Segoe UI", sans-serif;
}
body {
-webkit-font-smoothing: antialiased;
}
canvas {
display: block;
width: 100%;
height: 100%;
touch-action: none;
outline: none;
}
button,
[role="button"] {
font: inherit;
}
#loading {
position: fixed;
inset: 0;
display: grid;
place-items: center;
z-index: 20;
color: var(--muted);
background: var(--paper);
font-size: 11px;
font-weight: 700;
letter-spacing: 0.2em;
text-transform: uppercase;
transition: opacity 300ms ease;
}
#loading.hidden {
opacity: 0;
pointer-events: none;
}
.hud {
position: fixed;
inset: 0;
z-index: 5;
pointer-events: none;
}
.masthead {
position: absolute;
top: 30px;
left: 34px;
width: min(390px, calc(100vw - 68px));
}
.eyebrow {
display: flex;
align-items: center;
gap: 10px;
margin-bottom: 13px;
color: var(--muted);
font-size: 10px;
font-weight: 800;
letter-spacing: 0.18em;
text-transform: uppercase;
}
.eyebrow::before {
width: 18px;
height: 8px;
border: 2px solid var(--required);
content: "";
}
h1 {
margin: 0;
font-family: Georgia, "Times New Roman", serif;
font-size: clamp(32px, 4.3vw, 62px);
font-weight: 500;
line-height: 0.95;
letter-spacing: -0.045em;
}
h1 em {
color: var(--required);
font-weight: 500;
}
.masthead p {
max-width: 350px;
margin: 17px 0 0;
color: var(--muted);
font-size: 12px;
line-height: 1.65;
}
.legend {
position: absolute;
top: 30px;
right: 30px;
width: 246px;
padding: 15px 16px 14px;
border: 1px solid var(--line);
border-radius: 12px;
background: rgba(250, 248, 242, 0.76);
box-shadow: 0 12px 35px rgba(48, 55, 50, 0.07);
backdrop-filter: blur(12px);
pointer-events: auto;
}
.legend-title {
margin-bottom: 12px;
color: var(--muted);
font-size: 9px;
font-weight: 800;
letter-spacing: 0.18em;
text-transform: uppercase;
}
.legend-row {
display: flex;
align-items: center;
min-height: 27px;
gap: 10px;
color: #43524f;
font-size: 10px;
font-weight: 650;
}
.legend-row + .legend-row {
margin-top: 6px;
}
.legend-arrow {
position: relative;
width: 34px;
height: 2px;
flex: 0 0 auto;
background: var(--required);
}
.legend-arrow::after {
position: absolute;
top: -4px;
right: -1px;
width: 0;
height: 0;
border-top: 5px solid transparent;
border-bottom: 5px solid transparent;
border-left: 7px solid var(--required);
content: "";
}
.legend-dots {
position: relative;
width: 34px;
height: 15px;
flex: 0 0 auto;
border-top: 2px dashed var(--associated);
border-radius: 50%;
transform: rotate(-7deg);
}
.legend-block {
position: relative;
width: 31px;
height: 15px;
flex: 0 0 auto;
border: 2px solid var(--ink);
background: rgba(255, 255, 255, 0.55);
transform: skewY(-8deg);
}
.detail-card {
position: absolute;
left: 30px;
bottom: 28px;
width: 344px;
padding: 18px 19px 17px;
border: 1px solid var(--line);
border-radius: 14px;
background: rgba(250, 248, 242, 0.87);
box-shadow: 0 18px 55px rgba(40, 50, 45, 0.1);
backdrop-filter: blur(14px);
pointer-events: auto;
}
.detail-top {
display: flex;
align-items: center;
justify-content: space-between;
gap: 15px;
margin-bottom: 8px;
}
.detail-kicker {
color: var(--selected-color, var(--required));
font-size: 9px;
font-weight: 850;
letter-spacing: 0.17em;
text-transform: uppercase;
}
.detail-status {
padding: 5px 7px;
border: 1px solid var(--line);
border-radius: 999px;
color: var(--muted);
font-size: 8px;
font-weight: 800;
letter-spacing: 0.11em;
text-transform: uppercase;
}
.detail-card h2 {
margin: 0;
font-family: Georgia, "Times New Roman", serif;
font-size: 25px;
font-weight: 500;
letter-spacing: -0.025em;
}
.detail-role {
margin: 3px 0 0;
color: var(--selected-color, var(--required));
font-size: 10px;
font-weight: 800;
letter-spacing: 0.11em;
text-transform: uppercase;
}
.detail-card p {
margin: 13px 0 14px;
color: #5d6966;
font-size: 11px;
line-height: 1.65;
}
.dependency {
display: flex;
align-items: flex-start;
gap: 9px;
padding-top: 12px;
border-top: 1px solid var(--line);
color: #40514e;
font-size: 10px;
line-height: 1.45;
}
.dependency-mark {
width: 8px;
height: 8px;
margin-top: 3px;
flex: 0 0 auto;
border-radius: 50%;
background: var(--selected-color, var(--required));
box-shadow: 0 0 0 4px color-mix(in srgb, var(--selected-color, var(--required)) 15%, transparent);
}
.controls {
position: absolute;
right: 30px;
bottom: 29px;
display: flex;
align-items: center;
gap: 12px;
color: var(--muted);
font-size: 9px;
font-weight: 750;
letter-spacing: 0.1em;
text-transform: uppercase;
pointer-events: auto;
}
.reset-button {
padding: 9px 12px;
border: 1px solid var(--line);
border-radius: 999px;
color: var(--ink);
background: rgba(250, 248, 242, 0.8);
cursor: pointer;
font-size: 9px;
font-weight: 800;
letter-spacing: 0.1em;
text-transform: uppercase;
transition: background 160ms ease, transform 160ms ease;
}
.reset-button:hover {
background: #fff;
transform: translateY(-1px);
}
.node-label {
--accent: var(--required);
position: absolute;
z-index: 7;
min-width: 150px;
padding: 9px 11px 10px;
border: 1px solid rgba(24, 49, 48, 0.16);
border-top: 3px solid var(--accent);
border-radius: 8px;
color: var(--ink);
background: rgba(250, 248, 242, 0.9);
box-shadow: 0 9px 28px rgba(36, 48, 42, 0.09);
transform: translate(-50%, -100%);
backdrop-filter: blur(10px);
cursor: pointer;
pointer-events: auto;
transition:
border-color 180ms ease,
box-shadow 180ms ease,
opacity 180ms ease,
scale 180ms ease;
}
.node-label::after {
position: absolute;
top: 100%;
left: 50%;
width: 1px;
height: 15px;
background: var(--accent);
content: "";
opacity: 0.65;
}
.node-label:hover,
.node-label.active {
border-color: color-mix(in srgb, var(--accent) 65%, white);
box-shadow: 0 12px 35px rgba(36, 48, 42, 0.15);
scale: 1.025;
}
.node-label .node-kicker {
display: block;
margin-bottom: 3px;
color: var(--accent);
font-size: 8px;
font-weight: 850;
letter-spacing: 0.16em;
text-transform: uppercase;
}
.node-label strong {
display: block;
font-family: Georgia, "Times New Roman", serif;
font-size: 16px;
font-weight: 600;
letter-spacing: -0.015em;
}
.node-label .node-sub {
display: block;
margin-top: 3px;
color: var(--muted);
font-size: 8px;
font-weight: 750;
letter-spacing: 0.09em;
text-transform: uppercase;
}
.link-label {
position: absolute;
z-index: 4;
padding: 4px 6px;
border: 1px solid rgba(228, 95, 67, 0.26);
border-radius: 999px;
color: #b74330;
background: rgba(250, 248, 242, 0.88);
box-shadow: 0 5px 15px rgba(60, 40, 30, 0.06);
transform: translate(-50%, -50%);
font-size: 7px;
font-weight: 900;
letter-spacing: 0.13em;
text-transform: uppercase;
white-space: nowrap;
pointer-events: none;
}
.association-label {
position: absolute;
z-index: 4;
min-width: 135px;
padding: 7px 9px;
border: 1px dashed rgba(117, 137, 135, 0.75);
border-radius: 7px;
color: #657775;
background: rgba(245, 244, 238, 0.72);
transform: translate(-50%, -100%);
text-align: center;
pointer-events: none;
}
.association-label strong {
display: block;
color: #536a67;
font-family: Georgia, "Times New Roman", serif;
font-size: 12px;
font-weight: 600;
}
.association-label span {
display: block;
margin-top: 2px;
font-size: 7px;
font-weight: 850;
letter-spacing: 0.1em;
text-transform: uppercase;
}
@media (max-width: 760px) {
.masthead {
top: 18px;
left: 18px;
width: calc(100vw - 36px);
}
.masthead h1 {
font-size: 34px;
}
.masthead p {
display: none;
}
.legend {
top: 143px;
right: 16px;
width: 202px;
padding: 11px 12px;
}
.legend-title {
margin-bottom: 8px;
}
.legend-row {
min-height: 22px;
font-size: 8px;
}
.detail-card {
right: 14px;
bottom: 14px;
left: 14px;
width: auto;
padding: 14px 15px;
}
.detail-card h2 {
font-size: 21px;
}
.detail-card p {
margin: 9px 0 10px;
font-size: 10px;
}
.controls {
display: none;
}
.node-label {
min-width: 112px;
padding: 7px 8px 8px;
}
.node-label strong {
font-size: 12px;
}
.node-label .node-sub {
display: none;
}
.link-label {
font-size: 6px;
}
.association-label {
min-width: 112px;
}
}
@media (max-height: 650px) and (min-width: 761px) {
.masthead p {
display: none;
}
.detail-card {
bottom: 18px;
}
}
@media (prefers-reduced-motion: reduce) {
*,
*::before,
*::after {
scroll-behavior: auto !important;
transition-duration: 0.01ms !important;
animation-duration: 0.01ms !important;
}
}
</style>
</head>
<body>
<div id="loading">Constructing the dependency atlas…</div>
<div class="hud">
<header class="masthead">
<div class="eyebrow">Cabinet of causes / Plate 03</div>
<h1>Three inventions,<br /><em>one forked logic.</em></h1>
<p>
Solid coral links carry necessity. A dotted gray marker shows proximity or
historical association — never a required dependency.
</p>
</header>
<aside class="legend" aria-label="Dependency legend">
<div class="legend-title">Reading the graph</div>
<div class="legend-row">
<span class="legend-arrow" aria-hidden="true"></span>
<span>Required prerequisite</span>
</div>
<div class="legend-row">
<span class="legend-dots" aria-hidden="true"></span>
<span>Nearby / associated only</span>
</div>
<div class="legend-row">
<span class="legend-block" aria-hidden="true"></span>
<span>Invention block</span>
</div>
</aside>
<section class="detail-card" id="detailCard" aria-live="polite">
<div class="detail-top">
<span class="detail-kicker" id="detailKicker">Block 03 · Branch B</span>
<span class="detail-status" id="detailStatus">Terminal</span>
</div>
<h2 id="detailTitle">THE ORRERY</h2>
<p class="detail-role" id="detailRole">Mechanical Cosmos</p>
<p id="detailText"></p>
<div class="dependency">
<span class="dependency-mark" aria-hidden="true"></span>
<span id="detailDependency"></span>
</div>
</section>
<div class="controls">
<span>Drag to orbit · Scroll to zoom · 1–3 to inspect</span>
<button class="reset-button" id="resetButton" type="button">Reset view</button>
</div>
</div>
<script type="module">
import * as THREE from "https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
const loading = document.getElementById("loading");
const canvas = document.createElement("canvas");
canvas.setAttribute("aria-label", "Interactive 3D diagram of three invention blocks and their prerequisite links");
canvas.tabIndex = 0;
document.body.prepend(canvas);
const COLORS = {
paper: 0xeee9df,
ink: 0x183130,
required: 0xe45f43,
requiredSoft: 0xf3c4b5,
associated: 0x758987,
caliper: 0xe26b43,
chronometer: 0x168b84,
orrery: 0x7365b2
};
const nodeData = [
{
id: "01",
title: "THE CALIPER",
role: "Shared Standard",
kicker: "Block 01 · Origin",
status: "Root",
color: COLORS.caliper,
description:
"A fictional measuring gauge establishes a common baseline. Its output forks into two independent invention branches.",
dependency: "Branches into two required paths: 02 Chronometer and 03 Orrery.",
anchor: new THREE.Vector3(-3.1, 2.68, 0.2),
position: new THREE.Vector3(-3.1, 0, 0.2)
},
{
id: "02",
title: "THE CHRONOMETER",
role: "Portable Time",
kicker: "Block 02 · Branch A",
status: "Branch",
color: COLORS.chronometer,
description:
"A sealed clock preserves a measured interval while the mechanism moves. It depends on the shared scale created by the caliper.",
dependency: "Requires 01 The Caliper as a standardized measuring prerequisite.",
anchor: new THREE.Vector3(1.45, 1.82, -0.65),
position: new THREE.Vector3(1.45, 0, -0.65)
},
{
id: "03",
title: "THE ORRERY",
role: "Mechanical Cosmos",
kicker: "Block 03 · Branch B",
status: "Terminal",
color: COLORS.orrery,
description:
"A hand-driven model translates measured time into a miniature sky. It inherits the same standardized scale as the chronometer.",
dependency:
"Requires 01 The Caliper. The nearby armillary is associated by period, but it is not a prerequisite.",
anchor: new THREE.Vector3(2.1, 2.72, -0.25),
position: new THREE.Vector3(2.1, 0, -0.25)
}
];
const scene = new THREE.Scene();
scene.fog = new THREE.Fog(COLORS.paper, 19, 38);
const camera = new THREE.PerspectiveCamera(38, innerWidth / innerHeight, 0.1, 100);
const renderer = new THREE.WebGLRenderer({
canvas,
antialias: true,
alpha: true,
powerPreference: "high-performance"
});
renderer.setPixelRatio(Math.min(devicePixelRatio, 2));
renderer.setSize(innerWidth, innerHeight);
renderer.setClearColor(COLORS.paper, 0);
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1.08;
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
const hemisphere = new THREE.HemisphereLight(0xfffbf2, 0x867d70, 2.35);
scene.add(hemisphere);
const keyLight = new THREE.DirectionalLight(0xfff7e9, 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 fillLight = new THREE.DirectionalLight(0xc6ddff, 1.2);
fillLight.position.set(7, 4, -6);
scene.add(fillLight);
const world = new THREE.Group();
scene.add(world);
const floor = new THREE.Mesh(
new THREE.PlaneGeometry(50, 50),
new THREE.MeshStandardMaterial({
color: 0xe8e2d7,
roughness: 0.96,
metalness: 0
})
);
floor.rotation.x = -Math.PI / 2;
floor.position.y = -0.63;
floor.receiveShadow = true;
world.add(floor);
const grid = new THREE.GridHelper(30, 30, 0x9a988f, 0xb8b3a8);
grid.position.y = -0.615;
grid.material.transparent = true;
grid.material.opacity = 0.18;
grid.material.depthWrite = false;
world.add(grid);
function roundedBoxTexture(number, color) {
const c = document.createElement("canvas");
c.width = 256;
c.height = 144;
const ctx = c.getContext("2d");
ctx.clearRect(0, 0, c.width, c.height);
ctx.fillStyle = "#f8f4eb";
ctx.beginPath();
ctx.roundRect(3, 3, 250, 138, 17);
ctx.fill();
ctx.strokeStyle = `#${new THREE.Color(color).getHexString()}`;
ctx.lineWidth = 7;
ctx.stroke();
ctx.fillStyle = "#183130";
ctx.font = "700 76px Georgia";
ctx.textAlign = "center";
ctx.textBaseline = "middle";
ctx.fillText(number, 128, 75);
const texture = new THREE.CanvasTexture(c);
texture.colorSpace = THREE.SRGBColorSpace;
texture.anisotropy = renderer.capabilities.getMaxAnisotropy();
return texture;
}
function makeBase(data, index) {
const group = new THREE.Group();
group.position.copy(data.position);
group.userData.nodeIndex = index;
const accent = new THREE.Color(data.color);
const platform = new THREE.Mesh(
new THREE.CylinderGeometry(1.28, 1.38, 0.3, 48),
new THREE.MeshStandardMaterial({
color: 0xd9d2c5,
roughness: 0.78,
metalness: 0.02
})
);
platform.position.y = -0.46;
platform.castShadow = true;
platform.receiveShadow = true;
group.add(platform);
const topDisc = new THREE.Mesh(
new THREE.CylinderGeometry(1.14, 1.18, 0.055, 48),
new THREE.MeshStandardMaterial({
color: accent.clone().lerp(new THREE.Color(0xffffff), 0.72),
roughness: 0.62
})
);
topDisc.position.y = -0.282;
topDisc.receiveShadow = true;
group.add(topDisc);
const selectionRingMaterial = new THREE.MeshBasicMaterial({
color: data.color,
transparent: true,
opacity: 0.2,
depthWrite: false
});
const selectionRing = new THREE.Mesh(
new THREE.TorusGeometry(1.39, 0.034, 8, 64),
selectionRingMaterial
);
selectionRing.rotation.x = Math.PI / 2;
selectionRing.position.y = -0.275;
group.add(selectionRing);
const pedestal = new THREE.Mesh(
new THREE.BoxGeometry(1.92, 0.2, 1.7),
new THREE.MeshStandardMaterial({
color: 0xeee8de,
roughness: 0.72
})
);
pedestal.position.y = -0.16;
pedestal.castShadow = true;
pedestal.receiveShadow = true;
group.add(pedestal);
const bodyMaterial = new THREE.MeshStandardMaterial({
color: data.color,
roughness: 0.46,
metalness: 0.06,
emissive: accent.clone().multiplyScalar(0.08)
});
const body = new THREE.Mesh(
new THREE.BoxGeometry(1.46, 1.25, 1.26),
bodyMaterial
);
body.position.y = 0.61;
body.castShadow = true;
body.receiveShadow = true;
group.add(body);
const bodyEdges = new THREE.LineSegments(
new THREE.EdgesGeometry(body.geometry, 24),
new THREE.LineBasicMaterial({
color: COLORS.ink,
transparent: true,
opacity: 0.34
})
);
bodyEdges.position.copy(body.position);
group.add(bodyEdges);
const topCap = new THREE.Mesh(
new THREE.BoxGeometry(1.6, 0.14, 1.38),
new THREE.MeshStandardMaterial({
color: accent.clone().lerp(new THREE.Color(0xffffff), 0.16),
roughness: 0.48,
metalness: 0.08
})
);
topCap.position.y = 1.29;
topCap.castShadow = true;
group.add(topCap);
const topEdges = new THREE.LineSegments(
new THREE.EdgesGeometry(topCap.geometry),
new THREE.LineBasicMaterial({
color: COLORS.ink,
transparent: true,
opacity: 0.27
})
);
topEdges.position.copy(topCap.position);
group.add(topEdges);
const plaque = new THREE.Mesh(
new THREE.PlaneGeometry(0.46, 0.26),
new THREE.MeshBasicMaterial({
map: roundedBoxTexture(data.id, data.color),
transparent: true,
toneMapped: false
})
);
plaque.position.set(0, 0.43, 0.636);
group.add(plaque);
const inset = new THREE.Mesh(
new THREE.BoxGeometry(0.74, 0.12, 0.035),
new THREE.MeshStandardMaterial({
color: accent.clone().lerp(new THREE.Color(0xffffff), 0.43),
roughness: 0.5
})
);
inset.position.set(0, 0.92, 0.643);
group.add(inset);
const orbitAnimations = [];
const clockAnimations = [];
if (index === 0) {
const metal = new THREE.MeshStandardMaterial({
color: 0xffc29a,
roughness: 0.33,
metalness: 0.3
});
const jawLeft = new THREE.Mesh(new THREE.BoxGeometry(0.2, 1.05, 0.25), metal);
jawLeft.position.set(-0.38, 1.84, 0);
jawLeft.castShadow = true;
group.add(jawLeft);
const jawRight = jawLeft.clone();
jawRight.position.x = 0.38;
group.add(jawRight);
const bridge = new THREE.Mesh(new THREE.BoxGeometry(0.97, 0.19, 0.27), metal);
bridge.position.set(0, 2.3, 0);
bridge.castShadow = true;
group.add(bridge);
const slider = new THREE.Mesh(new THREE.BoxGeometry(0.2, 0.68, 0.2), metal);
slider.position.set(0, 1.91, 0.18);
slider.castShadow = true;
group.add(slider);
}
if (index === 1) {
const dark = new THREE.MeshStandardMaterial({
color: 0x163c3c,
roughness: 0.4,
metalness: 0.18
});
const face = new THREE.MeshStandardMaterial({
color: 0xf7f0dc,
roughness: 0.7
});
const dial = new THREE.Mesh(new THREE.CylinderGeometry(0.48, 0.48, 0.18, 48), dark);
dial.rotation.x = Math.PI / 2;
dial.position.set(0, 0.68, 0.72);
dial.castShadow = true;
group.add(dial);
const clockFace = new THREE.Mesh(new THREE.CylinderGeometry(0.39, 0.39, 0.195, 48), face);
clockFace.rotation.x = Math.PI / 2;
clockFace.position.set(0, 0.68, 0.825);
group.add(clockFace);
const rim = new THREE.Mesh(
new THREE.TorusGeometry(0.405, 0.045, 10, 48),
new THREE.MeshStandardMaterial({ color: 0xc5a66b, roughness: 0.3, metalness: 0.65 })
);
rim.position.set(0, 0.68, 0.93);
group.add(rim);
const hands = new THREE.Group();
hands.position.set(0, 0.68, 0.945);
const minute = new THREE.Mesh(
new THREE.BoxGeometry(0.025, 0.29, 0.025),
new THREE.MeshBasicMaterial({ color: COLORS.ink })
);
minute.position.y = 0.12;
hands.add(minute);
const hour = new THREE.Mesh(
new THREE.BoxGeometry(0.035, 0.21, 0.035),
new THREE.MeshBasicMaterial({ color: COLORS.ink })
);
hour.position.set(0.065, 0.055, 0.012);
hour.rotation.z = -0.7;
hands.add(hour);
group.add(hands);
clockAnimations.push(hands);
const crown = new THREE.Mesh(
new THREE.CylinderGeometry(0.14, 0.14, 0.24, 24),
new THREE.MeshStandardMaterial({ color: 0xc5a66b, roughness: 0.3, metalness: 0.6 })
);
crown.position.set(0, 1.47, 0);
crown.castShadow = true;
group.add(crown);
}
if (index === 2) {
const brass = new THREE.MeshStandardMaterial({
color: 0xc7a55c,
roughness: 0.26,
metalness: 0.7
});
const spindle = new THREE.Mesh(new THREE.CylinderGeometry(0.055, 0.055, 1.15, 16), brass);
spindle.position.y = 1.92;
spindle.castShadow = true;
group.add(spindle);
const sun = new THREE.Mesh(
new THREE.SphereGeometry(0.2, 24, 16),
new THREE.MeshStandardMaterial({
color: 0xffc45f,
emissive: 0x7d3e0c,
emissiveIntensity: 0.22,
roughness: 0.25,
metalness: 0.35
})
);
sun.position.y = 2.12;
sun.castShadow = true;
group.add(sun);
const orbitGroup = new THREE.Group();
orbitGroup.position.y = 1.88;
group.add(orbitGroup);
const ringA = new THREE.Mesh(new THREE.TorusGeometry(0.63, 0.035, 8, 64), brass);
ringA.rotation.x = 1.02;
ringA.rotation.y = 0.15;
orbitGroup.add(ringA);
const ringB = new THREE.Mesh(new THREE.TorusGeometry(0.48, 0.028, 8, 64), brass);
ringB.rotation.x = 0.62;
ringB.rotation.y = -0.72;
orbitGroup.add(ringB);
const ringC = new THREE.Mesh(new THREE.TorusGeometry(0.76, 0.025, 8, 64), brass);
ringC.rotation.x = 1.25;
ringC.rotation.y = 0.55;
orbitGroup.add(ringC);
const planet = new THREE.Mesh(
new THREE.SphereGeometry(0.09, 16, 12),
new THREE.MeshStandardMaterial({ color: 0x79c7c1, roughness: 0.5 })
);
planet.position.x = 0.63;
ringA.add(planet);
orbitAnimations.push(orbitGroup);
}
group.traverse((object) => {
if (object.isMesh) {
object.userData.nodeIndex = index;
}
});
world.add(group);
return {
group,
bodyMaterial,
selectionRingMaterial,
orbitAnimations,
clockAnimations,
targetScale: 1
};
}
const nodeObjects = nodeData.map((data, index) => makeBase(data, index));
const interactiveMeshes = [];
nodeObjects.forEach((node) => {
node.group.traverse((object) => {
if (object.isMesh) interactiveMeshes.push(object);
});
});
function makeRequiredLink(points) {
const curve = new THREE.CatmullRomCurve3(points, false, "catmullrom", 0.42);
const halo = new THREE.Mesh(
new THREE.TubeGeometry(curve, 64, 0.105, 8, false),
new THREE.MeshBasicMaterial({
color: COLORS.requiredSoft,
transparent: true,
opacity: 0.35,
depthWrite: false
})
);
world.add(halo);
const tube = new THREE.Mesh(
new THREE.TubeGeometry(curve, 64, 0.047, 8, false),
new THREE.MeshStandardMaterial({
color: COLORS.required,
roughness: 0.42,
metalness: 0.03
})
);
tube.castShadow = true;
world.add(tube);
const arrow = new THREE.Mesh(
new THREE.ConeGeometry(0.17, 0.38, 20),
new THREE.MeshStandardMaterial({
color: COLORS.required,
roughness: 0.42
})
);
const arrowPoint = curve.getPointAt(0.965);
const tangent = curve.getTangentAt(0.965).normalize();
arrow.position.copy(arrowPoint);
arrow.quaternion.setFromUnitVectors(new THREE.Vector3(0, 1, 0), tangent);
world.add(arrow);
const pulses = [];
for (let i = 0; i < 2; i++) {
const pulse = new THREE.Mesh(
new THREE.SphereGeometry(0.075, 16, 12),
new THREE.MeshBasicMaterial({ color: 0xfff0b8 })
);
world.add(pulse);
pulses.push(pulse);
}
return {
curve,
pulses,
labelAnchor: curve.getPointAt(0.54).add(new THREE.Vector3(0, 0.16, 0.03))
};
}
const links = [
makeRequiredLink([
new THREE.Vector3(-2.19, 0.86, 0.68),
new THREE.Vector3(-1.23, 1.66, 1.12),
new THREE.Vector3(0.18, 1.72, 0.73),
new THREE.Vector3(0.79, 1.02, -0.26)
]),
makeRequiredLink([
new THREE.Vector3(-2.19, 0.55, 0.72),
new THREE.Vector3(-1.3, 0.08, 1.2),
new THREE.Vector3(0.17, -0.36, 1.02),
new THREE.Vector3(1.42, 0.57, 0.02)
])
];
const contextCenter = new THREE.Vector3(3.92, 0.92, -1.12);
const contextOrb = new THREE.Mesh(
new THREE.IcosahedronGeometry(0.48, 1),
new THREE.MeshBasicMaterial({
color: COLORS.associated,
wireframe: true,
transparent: true,
opacity: 0.38,
depthWrite: false
})
);
contextOrb.position.copy(contextCenter);
world.add(contextOrb);
const haloPoints = [];
for (let i = 0; i <= 80; i++) {
const angle = (i / 80) * Math.PI * 2;
haloPoints.push(
new THREE.Vector3(
contextCenter.x + Math.cos(angle) * 0.78,
contextCenter.y - 0.38,
contextCenter.z + Math.sin(angle) * 0.5
)
);
}
const contextHalo = new THREE.Line(
new THREE.BufferGeometry().setFromPoints(haloPoints),
new THREE.LineDashedMaterial({
color: COLORS.associated,
dashSize: 0.09,
gapSize: 0.075,
transparent: true,
opacity: 0.75
})
);
contextHalo.computeLineDistances();
world.add(contextHalo);
const contextAnchor = contextCenter.clone().add(new THREE.Vector3(0, 0.78, 0));
const labelsHost = document.createElement("div");
labelsHost.style.position = "fixed";
labelsHost.style.inset = "0";
labelsHost.style.pointerEvents = "none";
labelsHost.style.zIndex = "4";
document.body.appendChild(labelsHost);
const nodeLabels = nodeData.map((data, index) => {
const element = document.createElement("div");
element.className = "node-label";
element.style.setProperty("--accent", `#${new THREE.Color(data.color).getHexString()}`);
element.setAttribute("role", "button");
element.setAttribute("tabindex", "0");
element.setAttribute("aria-label", `Inspect ${data.title}`);
element.innerHTML = `
<span class="node-kicker">Block ${data.id}</span>
<strong>${data.title}</strong>
<span class="node-sub">${data.role}</span>
`;
element.addEventListener("click", () => selectNode(index));
element.addEventListener("keydown", (event) => {
if (event.key === "Enter" || event.key === " ") {
event.preventDefault();
selectNode(index);
}
});
labelsHost.appendChild(element);
return element;
});
const linkLabels = links.map(() => {
const element = document.createElement("div");
element.className = "link-label";
element.textContent = "Required";
labelsHost.appendChild(element);
return element;
});
const associationLabel = document.createElement("div");
associationLabel.className = "association-label";
associationLabel.innerHTML = `
<strong>THE ARMILLARY</strong>
<span>Nearby in period · not required</span>
`;
labelsHost.appendChild(associationLabel);
const detailCard = document.getElementById("detailCard");
const detailKicker = document.getElementById("detailKicker");
const detailStatus = document.getElementById("detailStatus");
const detailTitle = document.getElementById("detailTitle");
const detailRole = document.getElementById("detailRole");
const detailText = document.getElementById("detailText");
const detailDependency = document.getElementById("detailDependency");
let selectedIndex = 2;
function selectNode(index) {
selectedIndex = index;
const data = nodeData[index];
const color = `#${new THREE.Color(data.color).getHexString()}`;
detailCard.style.setProperty("--selected-color", color);
detailKicker.textContent = data.kicker;
detailStatus.textContent = data.status;
detailTitle.textContent = data.title;
detailRole.textContent = data.role;
detailText.textContent = data.description;
detailDependency.textContent = data.dependency;
nodeLabels.forEach((label, i) => label.classList.toggle("active", i === index));
}
selectNode(selectedIndex);
const controls = {
azimuth: 0.64,
elevation: 0.48,
zoom: 1,
target: new THREE.Vector3(0.1, 0.52, 0)
};
const defaultControls = {
azimuth: controls.azimuth,
elevation: controls.elevation,
zoom: controls.zoom
};
function responsiveRadius() {
const aspect = innerWidth / innerHeight;
return 11.8 * Math.max(1, 1.15 / aspect);
}
function resetView() {
controls.azimuth = defaultControls.azimuth;
controls.elevation = defaultControls.elevation;
controls.zoom = defaultControls.zoom;
}
document.getElementById("resetButton").addEventListener("click", resetView);
canvas.addEventListener("dblclick", resetView);
let pointerDown = false;
let pointerMoved = false;
let lastX = 0;
let lastY = 0;
let hoveredIndex = -1;
const raycaster = new THREE.Raycaster();
const pointer = new THREE.Vector2();
function pickNode(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;
raycaster.setFromCamera(pointer, camera);
const hits = raycaster.intersectObjects(interactiveMeshes, false);
return hits.length ? hits[0].object.userData.nodeIndex : -1;
}
canvas.addEventListener("pointerdown", (event) => {
if (event.button !== 0) return;
pointerDown = true;
pointerMoved = false;
lastX = event.clientX;
lastY = event.clientY;
canvas.setPointerCapture(event.pointerId);
canvas.style.cursor = "grabbing";
});
canvas.addEventListener("pointermove", (event) => {
if (pointerDown) {
const dx = event.clientX - lastX;
const dy = event.clientY - lastY;
if (Math.abs(dx) + Math.abs(dy) > 3) pointerMoved = true;
controls.azimuth -= dx * 0.006;
controls.elevation = THREE.MathUtils.clamp(
controls.elevation + dy * 0.005,
0.22,
1.02
);
lastX = event.clientX;
lastY = event.clientY;
} else {
hoveredIndex = pickNode(event);
canvas.style.cursor = hoveredIndex >= 0 ? "pointer" : "grab";
}
});
canvas.addEventListener("pointerup", (event) => {
if (pointerDown && !pointerMoved) {
const picked = pickNode(event);
if (picked >= 0) selectNode(picked);
}
pointerDown = false;
canvas.style.cursor = hoveredIndex >= 0 ? "pointer" : "grab";
});
canvas.addEventListener("pointercancel", () => {
pointerDown = false;
canvas.style.cursor = "grab";
});
canvas.addEventListener(
"wheel",
(event) => {
event.preventDefault();
controls.zoom = THREE.MathUtils.clamp(
controls.zoom * Math.exp(event.deltaY * 0.001),
0.72,
1.48
);
},
{ passive: false }
);
window.addEventListener("keydown", (event) => {
if (event.key === "1") selectNode(0);
if (event.key === "2") selectNode(1);
if (event.key === "3") selectNode(2);
if (event.key.toLowerCase() === "r") resetView();
});
function resize() {
renderer.setPixelRatio(Math.min(devicePixelRatio, 2));
renderer.setSize(innerWidth, innerHeight);
camera.aspect = innerWidth / innerHeight;
camera.updateProjectionMatrix();
}
window.addEventListener("resize", resize);
const projected = new THREE.Vector3();
function positionLabel(element, worldPosition, visible = true) {
projected.copy(worldPosition).project(camera);
const x = (projected.x * 0.5 + 0.5) * innerWidth;
const y = (-projected.y * 0.5 + 0.5) * innerHeight;
element.style.left = `${x}px`;
element.style.top = `${y}px`;
element.style.opacity = visible && projected.z < 1 ? "1" : "0";
}
const clock = new THREE.Clock();
const reduceMotion = matchMedia("(prefers-reduced-motion: reduce)").matches;
function animate() {
requestAnimationFrame(animate);
const delta = Math.min(clock.getDelta(), 0.05);
const elapsed = clock.elapsedTime;
const radius = responsiveRadius() * controls.zoom;
const horizontal = Math.cos(controls.elevation) * radius;
camera.position.set(
controls.target.x + Math.sin(controls.azimuth) * horizontal,
controls.target.y + Math.sin(controls.elevation) * radius,
controls.target.z + Math.cos(controls.azimuth) * horizontal
);
camera.lookAt(controls.target);
nodeObjects.forEach((node, index) => {
const isHovered = hoveredIndex === index;
const isSelected = selectedIndex === index;
const targetScale = isHovered ? 1.035 : 1;
node.targetScale = targetScale;
const nextScale = THREE.MathUtils.lerp(node.group.scale.x, targetScale, 0.12);
node.group.scale.setScalar(nextScale);
node.selectionRingMaterial.opacity = isSelected
? 0.92
: isHovered
? 0.48
: 0.18;
node.bodyMaterial.emissiveIntensity = isSelected ? 0.18 : isHovered ? 0.12 : 0.07;
if (!reduceMotion) {
node.orbitAnimations.forEach((group) => {
group.rotation.y += delta * 0.22;
});
node.clockAnimations.forEach((group) => {
group.rotation.z = -elapsed * 0.16;
});
}
});
links.forEach((link, linkIndex) => {
link.pulses.forEach((pulse, pulseIndex) => {
const t = reduceMotion
? 0.25 + pulseIndex * 0.45
: (elapsed * 0.19 + pulseIndex * 0.5 + linkIndex * 0.07) % 1;
pulse.position.copy(link.curve.getPointAt(t));
});
});
if (!reduceMotion) {
contextOrb.rotation.y += delta * 0.16;
contextOrb.rotation.x += delta * 0.07;
}
renderer.render(scene, camera);
nodeData.forEach((data, index) => {
positionLabel(nodeLabels[index], data.anchor);
});
links.forEach((link, index) => {
positionLabel(linkLabels[index], link.labelAnchor);
});
positionLabel(associationLabel, contextAnchor);
}
resize();
animate();
requestAnimationFrame(() => {
loading.classList.add("hidden");
setTimeout(() => loading.remove(), 350);
});
</script>
</body>
</html>
```