Prompt specification
Build or customize the Three.js 3D scene "Materials-layering museum display" 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: Materials-layering museum display
Category: Everyday & Industrial · Style: Procedural Solid / Shader 3D
License: MIT · Reference: https://three3d.app/scene/materials-layering-museum-display-x0608
Scene Description Prompt:
Create a single self-contained HTML file using Three.js from cdnjs that shows protective helmet structure. Create several abstract protective-shell samples with different layers; symbolic contact pulses reveal load spreading qualitatively, and labels explicitly separate the illustration from impact-testing results. Low-poly.
Working Three.js Starter (materials-layering-museum-display-x0608):
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Protective Shell Anatomy — Qualitative Illustration</title>
<style>
:root {
color-scheme: dark;
--bg: #071019;
--panel: rgba(9, 19, 29, 0.78);
--line: rgba(183, 218, 232, 0.18);
--text: #eaf5f7;
--muted: #91a8b1;
--mint: #70e0c1;
--amber: #f1b84b;
--violet: #9b91f5;
}
* {
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;
}
button {
font: inherit;
}
#viewport {
position: fixed;
inset: 0;
}
#viewport canvas {
display: block;
width: 100%;
height: 100%;
touch-action: none;
cursor: grab;
}
#viewport canvas:active {
cursor: grabbing;
}
.masthead {
position: fixed;
z-index: 5;
top: 28px;
left: 32px;
max-width: 520px;
pointer-events: none;
}
.eyebrow,
.panel-title {
margin: 0 0 8px;
color: var(--mint);
font-size: 10px;
font-weight: 800;
letter-spacing: 0.22em;
text-transform: uppercase;
}
h1 {
margin: 0;
color: var(--text);
font-size: clamp(28px, 4vw, 54px);
font-weight: 650;
line-height: 0.98;
letter-spacing: -0.045em;
}
.subtitle {
margin: 12px 0 0;
color: var(--muted);
font-size: 13px;
line-height: 1.5;
}
.result-notice {
position: fixed;
z-index: 6;
top: 28px;
right: 30px;
display: flex;
align-items: center;
gap: 11px;
max-width: 310px;
padding: 11px 14px;
border: 1px solid rgba(255, 185, 90, 0.35);
border-radius: 12px;
background: rgba(30, 23, 14, 0.78);
box-shadow: 0 16px 50px rgba(0, 0, 0, 0.24);
pointer-events: none;
}
.notice-dot {
width: 9px;
height: 9px;
flex: 0 0 auto;
border-radius: 50%;
background: #ffbd59;
box-shadow: 0 0 0 5px rgba(255, 189, 89, 0.12);
}
.notice-copy {
color: #f7d9a5;
font-size: 10px;
font-weight: 800;
line-height: 1.45;
letter-spacing: 0.1em;
}
.notice-copy span {
display: block;
margin-top: 3px;
color: #bdaa87;
font-size: 9px;
font-weight: 600;
letter-spacing: 0.04em;
}
.panel {
position: fixed;
z-index: 5;
top: 118px;
right: 30px;
width: 286px;
padding: 18px;
border: 1px solid var(--line);
border-radius: 16px;
background: var(--panel);
box-shadow: 0 20px 70px rgba(0, 0, 0, 0.28);
backdrop-filter: blur(15px);
pointer-events: none;
}
.panel-title {
color: #b7cbd2;
}
.layer-row {
display: grid;
grid-template-columns: 30px 1fr 10px;
align-items: center;
gap: 10px;
padding: 12px 0;
border-top: 1px solid rgba(183, 218, 232, 0.1);
}
.sample-number {
color: #718994;
font-size: 10px;
font-weight: 800;
letter-spacing: 0.12em;
}
.layer-row strong {
display: block;
color: var(--text);
font-size: 12px;
font-weight: 700;
}
.layer-row small {
display: block;
margin-top: 3px;
color: var(--muted);
font-size: 10px;
line-height: 1.35;
}
.swatch {
width: 8px;
height: 28px;
border-radius: 8px;
background: var(--swatch);
box-shadow: 0 0 16px color-mix(in srgb, var(--swatch), transparent 55%);
}
.legend {
margin-top: 9px;
padding-top: 14px;
border-top: 1px solid rgba(183, 218, 232, 0.1);
}
.legend-item {
display: flex;
align-items: center;
gap: 10px;
margin: 9px 0;
color: #b5c7cd;
font-size: 10px;
}
.legend-ring {
width: 17px;
height: 17px;
border: 2px solid var(--mint);
border-radius: 50%;
box-shadow: 0 0 10px rgba(112, 224, 193, 0.28);
}
.legend-line {
position: relative;
width: 21px;
height: 2px;
background: var(--amber);
transform: rotate(-17deg);
}
.legend-line::after {
content: "";
position: absolute;
right: -1px;
top: -2px;
width: 5px;
height: 5px;
border-radius: 50%;
background: var(--amber);
}
.legend-dash {
width: 21px;
height: 0;
border-top: 1px dashed #8098a2;
}
.panel-note {
margin: 14px 0 0;
color: #8098a2;
font-size: 9px;
line-height: 1.55;
}
.world-label {
position: fixed;
z-index: 4;
min-width: 138px;
padding: 8px 10px;
border: 1px solid rgba(255, 255, 255, 0.11);
border-radius: 9px;
background: rgba(7, 16, 25, 0.76);
box-shadow: 0 12px 35px rgba(0, 0, 0, 0.25);
backdrop-filter: blur(8px);
text-align: center;
pointer-events: none;
transform: translate(-50%, -50%);
}
.world-label strong {
display: block;
color: var(--label-color, var(--text));
font-size: 10px;
font-weight: 850;
letter-spacing: 0.1em;
text-transform: uppercase;
}
.world-label small {
display: block;
margin-top: 4px;
color: #718994;
font-size: 7px;
font-weight: 700;
letter-spacing: 0.08em;
}
.footer {
position: fixed;
z-index: 7;
left: 30px;
right: 30px;
bottom: 22px;
display: flex;
align-items: flex-end;
justify-content: space-between;
gap: 24px;
pointer-events: none;
}
.disclaimer {
max-width: 760px;
padding: 13px 16px;
border: 1px solid rgba(255, 185, 90, 0.22);
border-radius: 12px;
background: rgba(12, 17, 22, 0.82);
backdrop-filter: blur(12px);
}
.disclaimer-title {
margin-bottom: 5px;
color: #ffc96d;
font-size: 9px;
font-weight: 850;
letter-spacing: 0.16em;
text-transform: uppercase;
}
.disclaimer p {
margin: 0;
color: #9caeb5;
font-size: 10px;
line-height: 1.55;
}
.disclaimer strong {
color: #dce7e9;
}
.controls {
display: flex;
gap: 8px;
pointer-events: auto;
}
.control-button {
display: inline-flex;
align-items: center;
gap: 8px;
min-height: 40px;
padding: 0 13px;
border: 1px solid rgba(183, 218, 232, 0.19);
border-radius: 10px;
background: rgba(9, 19, 29, 0.85);
color: #dbe9eb;
font-size: 9px;
font-weight: 800;
letter-spacing: 0.1em;
text-transform: uppercase;
cursor: pointer;
backdrop-filter: blur(12px);
transition:
border-color 160ms ease,
color 160ms ease,
transform 160ms ease;
}
.control-button:hover {
border-color: rgba(112, 224, 193, 0.65);
color: var(--mint);
transform: translateY(-1px);
}
.control-button span {
color: var(--mint);
font-size: 15px;
line-height: 1;
}
.camera-hint {
position: fixed;
z-index: 3;
left: 50%;
bottom: 28px;
color: rgba(178, 202, 210, 0.5);
font-size: 8px;
font-weight: 700;
letter-spacing: 0.14em;
text-transform: uppercase;
pointer-events: none;
transform: translateX(-50%);
}
#fallback {
position: fixed;
z-index: 20;
inset: 0;
display: grid;
place-items: center;
padding: 30px;
background: #071019;
color: #dce9ec;
text-align: center;
}
#fallback[hidden] {
display: none;
}
@media (max-width: 900px) {
.panel {
display: none;
}
.camera-hint {
display: none;
}
}
@media (max-width: 650px) {
.masthead {
top: 18px;
left: 17px;
max-width: 58%;
}
h1 {
font-size: 29px;
}
.subtitle {
font-size: 10px;
}
.eyebrow {
font-size: 8px;
}
.result-notice {
top: 16px;
right: 14px;
max-width: 145px;
padding: 9px 10px;
}
.notice-copy {
font-size: 8px;
}
.notice-copy span {
display: none;
}
.footer {
left: 14px;
right: 14px;
bottom: 14px;
flex-direction: column;
align-items: stretch;
gap: 9px;
}
.disclaimer {
padding: 10px 12px;
}
.disclaimer p {
font-size: 9px;
}
.controls {
justify-content: flex-end;
}
.control-button {
min-height: 36px;
padding: 0 10px;
font-size: 8px;
}
.world-label {
min-width: 104px;
padding: 6px 7px;
}
.world-label strong {
font-size: 8px;
}
.world-label small {
font-size: 6px;
}
}
</style>
</head>
<body>
<div id="viewport"></div>
<header class="masthead">
<div class="eyebrow">Structure study / three abstract assemblies</div>
<h1>Protective Shell<br>Anatomy</h1>
<p class="subtitle">
Low-poly exploded samples with symbolic contact pulses and conceptual
load-spread paths.
</p>
</header>
<div class="result-notice" role="note">
<span class="notice-dot"></span>
<div class="notice-copy">
ILLUSTRATION ONLY
<span>NOT IMPACT-TEST RESULTS</span>
</div>
</div>
<aside class="panel" aria-label="Diagram legend and layer descriptions">
<p class="panel-title">Schematic layer sets</p>
<div class="layer-row">
<span class="sample-number">01</span>
<div>
<strong>Single skin</strong>
<small>1 faceted shell · edge rim</small>
</div>
<i class="swatch" style="--swatch:#70e0c1"></i>
</div>
<div class="layer-row">
<span class="sample-number">02</span>
<div>
<strong>Bonded core</strong>
<small>Outer shell · bonded inner liner</small>
</div>
<i class="swatch" style="--swatch:#f1b84b"></i>
</div>
<div class="layer-row">
<span class="sample-number">03</span>
<div>
<strong>Suspended grid</strong>
<small>Shell · radial grid · liner</small>
</div>
<i class="swatch" style="--swatch:#9b91f5"></i>
</div>
<div class="legend">
<div class="legend-item">
<span class="legend-ring"></span>
<span>Symbolic contact pulse</span>
</div>
<div class="legend-item">
<span class="legend-line"></span>
<span>Conceptual load-spread path</span>
</div>
<div class="legend-item">
<span class="legend-dash"></span>
<span>Exploded assembly axis</span>
</div>
</div>
<p class="panel-note">
Layer counts, channel counts, colors, and timing are explanatory drawing
conventions. They are not a performance ranking.
</p>
</aside>
<div class="world-label" id="label-0" style="--label-color:#70e0c1">
<strong>01 · Single skin</strong>
<small>Schematic · no test data</small>
</div>
<div class="world-label" id="label-1" style="--label-color:#f1b84b">
<strong>02 · Bonded core</strong>
<small>Schematic · no test data</small>
</div>
<div class="world-label" id="label-2" style="--label-color:#9b91f5">
<strong>03 · Suspended grid</strong>
<small>Schematic · no test data</small>
</div>
<div class="camera-hint">Drag to orbit · scroll to zoom · double-click to reset</div>
<footer class="footer">
<div class="disclaimer">
<div class="disclaimer-title">
Schematic illustration — not impact-testing results
</div>
<p>
<strong>This animation is a qualitative visual metaphor only.</strong>
It does not represent or imply measured force, deflection, acceleration,
stress, strain, protection level, certification, test outcome, or PPE
suitability. Do not use it to select protective equipment.
</p>
</div>
<div class="controls">
<button class="control-button" id="replay" type="button">
<span aria-hidden="true">↻</span> Replay pulse
</button>
<button class="control-button" id="reset-view" type="button">
<span aria-hidden="true">⌖</span> Reset view
</button>
</div>
</footer>
<div id="fallback" hidden>
<div>
<h2>3D rendering is unavailable</h2>
<p>This illustration requires a browser with WebGL support.</p>
</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 viewport = document.getElementById("viewport");
let renderer;
try {
renderer = new THREE.WebGLRenderer({
antialias: true,
alpha: false,
powerPreference: "high-performance"
});
} catch (error) {
document.getElementById("fallback").hidden = false;
throw error;
}
renderer.setPixelRatio(Math.min(window.devicePixelRatio || 1, 2));
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.setClearColor(0x071019, 1);
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1.08;
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
renderer.domElement.setAttribute(
"aria-label",
"Interactive low-poly protective shell anatomy illustration"
);
viewport.appendChild(renderer.domElement);
const scene = new THREE.Scene();
scene.background = new THREE.Color(0x071019);
scene.fog = new THREE.Fog(0x071019, 13, 29);
const camera = new THREE.PerspectiveCamera(
39,
window.innerWidth / window.innerHeight,
0.1,
60
);
// Direct camera controls: no addons or external control modules.
const target = new THREE.Vector3(0, 1.45, 0);
const orbit = {
radius: 11.8,
phi: 1.15,
theta: 0.17
};
function updateCamera() {
camera.position.setFromSphericalCoords(
orbit.radius,
orbit.phi,
orbit.theta
);
camera.position.add(target);
camera.lookAt(target);
}
function resetCamera() {
orbit.radius = window.innerWidth < 650 ? 14.2 : 11.8;
orbit.phi = 1.15;
orbit.theta = 0.17;
target.set(0, 1.45, 0);
updateCamera();
}
updateCamera();
let dragging = false;
let pointerX = 0;
let pointerY = 0;
renderer.domElement.addEventListener("pointerdown", (event) => {
dragging = true;
pointerX = event.clientX;
pointerY = event.clientY;
renderer.domElement.setPointerCapture(event.pointerId);
});
renderer.domElement.addEventListener("pointermove", (event) => {
if (!dragging) return;
const dx = event.clientX - pointerX;
const dy = event.clientY - pointerY;
pointerX = event.clientX;
pointerY = event.clientY;
orbit.theta -= dx * 0.006;
orbit.phi = THREE.MathUtils.clamp(
orbit.phi + dy * 0.005,
0.68,
1.43
);
updateCamera();
});
function endDrag(event) {
dragging = false;
if (
renderer.domElement.hasPointerCapture &&
event.pointerId !== undefined
) {
renderer.domElement.releasePointerCapture(event.pointerId);
}
}
renderer.domElement.addEventListener("pointerup", endDrag);
renderer.domElement.addEventListener("pointercancel", endDrag);
renderer.domElement.addEventListener(
"wheel",
(event) => {
event.preventDefault();
orbit.radius = THREE.MathUtils.clamp(
orbit.radius + event.deltaY * 0.008,
7.3,
18
);
updateCamera();
},
{ passive: false }
);
renderer.domElement.addEventListener("dblclick", resetCamera);
// Lighting.
scene.add(new THREE.HemisphereLight(0xbcefff, 0x101722, 1.35));
const keyLight = new THREE.DirectionalLight(0xffffff, 3.0);
keyLight.position.set(4, 8, 6);
keyLight.castShadow = true;
keyLight.shadow.mapSize.set(1024, 1024);
keyLight.shadow.camera.left = -8;
keyLight.shadow.camera.right = 8;
keyLight.shadow.camera.top = 8;
keyLight.shadow.camera.bottom = -8;
keyLight.shadow.bias = -0.0008;
scene.add(keyLight);
const rimLight = new THREE.DirectionalLight(0x567dff, 1.4);
rimLight.position.set(-6, 4, -5);
scene.add(rimLight);
const warmLight = new THREE.PointLight(0xffb75f, 11, 14, 2);
warmLight.position.set(4, 3.2, -4);
scene.add(warmLight);
// Ground and technical grid.
const floor = new THREE.Mesh(
new THREE.PlaneGeometry(40, 40),
new THREE.MeshStandardMaterial({
color: 0x08121b,
roughness: 0.96,
metalness: 0.02
})
);
floor.rotation.x = -Math.PI / 2;
floor.position.y = -0.025;
floor.receiveShadow = true;
scene.add(floor);
const floorGrid = new THREE.GridHelper(
24,
24,
0x35566a,
0x193040
);
floorGrid.position.y = -0.012;
floorGrid.material.transparent = true;
floorGrid.material.opacity = 0.3;
scene.add(floorGrid);
const edgeMaterial = new THREE.LineBasicMaterial({
color: 0xd9ffff,
transparent: true,
opacity: 0.13,
depthWrite: false
});
function shellMaterial(color, options = {}) {
return new THREE.MeshStandardMaterial({
color,
roughness: 0.58,
metalness: 0.12,
flatShading: true,
side: THREE.DoubleSide,
...options
});
}
function createShell(group, radius, centerY, color, options = {}) {
const geometry = new THREE.SphereGeometry(
radius,
12,
5,
0,
Math.PI * 2,
0,
Math.PI / 2
);
const shell = new THREE.Mesh(
geometry,
shellMaterial(color, options)
);
shell.position.y = centerY;
shell.castShadow = true;
shell.receiveShadow = true;
group.add(shell);
const edges = new THREE.LineSegments(
new THREE.EdgesGeometry(geometry, 12),
edgeMaterial
);
edges.position.y = centerY;
edges.renderOrder = 1;
group.add(edges);
const rim = new THREE.Mesh(
new THREE.TorusGeometry(radius, 0.045, 4, 12),
shellMaterial(color, {
roughness: 0.48,
metalness: 0.18
})
);
rim.rotation.x = Math.PI / 2;
rim.position.y = centerY;
rim.castShadow = true;
group.add(rim);
return shell;
}
function createGridLayer(group, radius, centerY, color) {
const ribMaterial = shellMaterial(color, {
roughness: 0.48,
metalness: 0.2,
emissive: color,
emissiveIntensity: 0.08
});
const ribCount = 8;
for (let i = 0; i < ribCount; i++) {
const phi = (i / ribCount) * Math.PI * 2;
const points = [];
for (let j = 0; j <= 12; j++) {
const theta = 0.12 + (j / 12) * 1.4;
const radial = radius + 0.012;
points.push(
new THREE.Vector3(
radial * Math.sin(theta) * Math.cos(phi),
centerY + radial * Math.cos(theta),
radial * Math.sin(theta) * Math.sin(phi)
)
);
}
const curve = new THREE.CatmullRomCurve3(points);
const rib = new THREE.Mesh(
new THREE.TubeGeometry(curve, 12, 0.026, 4, false),
ribMaterial
);
rib.castShadow = true;
group.add(rib);
}
[0.58, 1.05].forEach((theta) => {
const ringRadius = radius * Math.sin(theta);
const ringY = centerY + radius * Math.cos(theta);
const ring = new THREE.Mesh(
new THREE.TorusGeometry(ringRadius, 0.022, 4, 16),
ribMaterial
);
ring.rotation.x = Math.PI / 2;
ring.position.y = ringY;
ring.castShadow = true;
group.add(ring);
});
}
function createPedestal(group, accentColor) {
const base = new THREE.Mesh(
new THREE.CylinderGeometry(1.16, 1.27, 0.09, 12),
new THREE.MeshStandardMaterial({
color: 0x0d1a25,
roughness: 0.82,
metalness: 0.12,
flatShading: true
})
);
base.position.y = 0.045;
base.receiveShadow = true;
group.add(base);
const outline = new THREE.Mesh(
new THREE.TorusGeometry(1.22, 0.012, 4, 32),
new THREE.MeshBasicMaterial({
color: accentColor,
transparent: true,
opacity: 0.48
})
);
outline.rotation.x = Math.PI / 2;
outline.position.y = 0.095;
group.add(outline);
const axisGeometry = new THREE.BufferGeometry().setFromPoints([
new THREE.Vector3(0, 0.12, 0),
new THREE.Vector3(0, 3.62, 0)
]);
const axis = new THREE.Line(
axisGeometry,
new THREE.LineDashedMaterial({
color: 0x8da6b1,
transparent: true,
opacity: 0.22,
dashSize: 0.065,
gapSize: 0.09
})
);
axis.computeLineDistances();
group.add(axis);
}
function createPulseRing(color) {
const ring = new THREE.Mesh(
new THREE.TorusGeometry(0.12, 0.012, 4, 28),
new THREE.MeshBasicMaterial({
color,
transparent: true,
opacity: 0,
depthTest: false,
depthWrite: false
})
);
ring.rotation.x = Math.PI / 2;
ring.renderOrder = 20;
return ring;
}
function createLayerPulse(group, y, color, start) {
const ring = createPulseRing(color);
ring.position.y = y;
group.add(ring);
return {
ring,
start
};
}
function createPaths(group, radius, centerY, color, count) {
const paths = [];
for (let i = 0; i < count; i++) {
const phi = (i / count) * Math.PI * 2 + 0.18;
const points = [];
for (let j = 0; j <= 20; j++) {
const theta = 0.035 + (j / 20) * 1.5;
const radial = radius + 0.027;
points.push(
new THREE.Vector3(
radial * Math.sin(theta) * Math.cos(phi),
centerY + radial * Math.cos(theta),
radial * Math.sin(theta) * Math.sin(phi)
)
);
}
const geometry = new THREE.BufferGeometry().setFromPoints(points);
geometry.setDrawRange(0, 0);
const line = new THREE.Line(
geometry,
new THREE.LineBasicMaterial({
color,
transparent: true,
opacity: 0,
depthTest: false,
depthWrite: false
})
);
line.renderOrder = 15;
group.add(line);
const node = new THREE.Mesh(
new THREE.OctahedronGeometry(0.043, 0),
new THREE.MeshBasicMaterial({
color,
transparent: true,
opacity: 0.95,
depthTest: false
})
);
node.visible = false;
node.renderOrder = 16;
group.add(node);
paths.push({ points, line, node });
}
return paths;
}
const sampleConfigs = [
{
x: -2.85,
accent: 0x70e0c1,
pathColor: 0x8ef4db,
outer: { radius: 1.04, centerY: 1.38, color: 0x5ad9c4 },
channels: 4,
offset: 0
},
{
x: 0,
accent: 0xf1b84b,
pathColor: 0xffca62,
outer: { radius: 1.04, centerY: 1.95, color: 0xe9ad3f },
inner: { radius: 0.79, centerY: 1.02, color: 0x3f83d8 },
channels: 6,
offset: 1.6
},
{
x: 2.85,
accent: 0x9b91f5,
pathColor: 0xc3baff,
outer: { radius: 1.04, centerY: 2.36, color: 0x8b7ee9 },
grid: { radius: 0.87, centerY: 1.35, color: 0xff8057 },
liner: { radius: 0.68, centerY: 0.52, color: 0x4aaee2 },
channels: 8,
offset: 3.2
}
];
const samples = [];
sampleConfigs.forEach((config, index) => {
const group = new THREE.Group();
group.position.x = config.x;
scene.add(group);
createPedestal(group, config.accent);
createShell(
group,
config.outer.radius,
config.outer.centerY,
config.outer.color
);
const layerPulses = [];
if (config.inner) {
createShell(
group,
config.inner.radius,
config.inner.centerY,
config.inner.color,
{
transparent: true,
opacity: 0.84
}
);
layerPulses.push(
createLayerPulse(
group,
config.inner.centerY + config.inner.radius + 0.025,
0x69a9ff,
0.95
)
);
}
if (config.grid) {
createGridLayer(
group,
config.grid.radius,
config.grid.centerY,
config.grid.color
);
layerPulses.push(
createLayerPulse(
group,
config.grid.centerY + config.grid.radius + 0.025,
0xffa06f,
1.15
)
);
}
if (config.liner) {
createShell(
group,
config.liner.radius,
config.liner.centerY,
config.liner.color,
{
transparent: true,
opacity: 0.62
}
);
layerPulses.push(
createLayerPulse(
group,
config.liner.centerY + config.liner.radius + 0.025,
0x79d5ff,
1.78
)
);
}
const firstRing = createPulseRing(config.pathColor);
const secondRing = createPulseRing(config.pathColor);
firstRing.position.y =
config.outer.centerY + config.outer.radius + 0.035;
secondRing.position.y =
config.outer.centerY + config.outer.radius + 0.045;
group.add(firstRing, secondRing);
const contactMarker = new THREE.Mesh(
new THREE.OctahedronGeometry(0.088, 0),
new THREE.MeshBasicMaterial({
color: 0xffffff,
transparent: true,
depthTest: false,
depthWrite: false
})
);
contactMarker.position.y =
config.outer.centerY + config.outer.radius + 0.065;
contactMarker.renderOrder = 25;
group.add(contactMarker);
const paths = createPaths(
group,
config.outer.radius,
config.outer.centerY,
config.pathColor,
config.channels
);
samples.push({
group,
config,
firstRing,
secondRing,
contactMarker,
paths,
layerPulses,
label: document.getElementById(`label-${index}`),
labelAnchor: new THREE.Vector3(0, 0.13, 0)
});
});
// Decorative background points, kept subtle and non-interactive.
const pointPositions = [];
const pointGeometry = new THREE.BufferGeometry();
for (let i = 0; i < 90; i++) {
const angle = i * 2.399963;
const radius = 8 + (i % 9) * 0.55;
const height = 0.4 + ((i * 17) % 31) * 0.16;
pointPositions.push(
Math.cos(angle) * radius,
height,
Math.sin(angle) * radius
);
}
pointGeometry.setAttribute(
"position",
new THREE.Float32BufferAttribute(pointPositions, 3)
);
const backgroundPoints = new THREE.Points(
pointGeometry,
new THREE.PointsMaterial({
color: 0x6e9dab,
size: 0.025,
transparent: true,
opacity: 0.4,
depthWrite: false
})
);
scene.add(backgroundPoints);
const clock = {
timeline: 0,
previous: performance.now()
};
const CYCLE = 4.8;
function updatePulses(time) {
samples.forEach((sample) => {
const phase = (time + sample.config.offset) % CYCLE;
// Contact marker.
if (phase < 0.48) {
sample.contactMarker.visible = true;
const markerScale =
0.85 + Math.sin((phase / 0.48) * Math.PI) * 0.6;
sample.contactMarker.scale.setScalar(markerScale);
sample.contactMarker.material.opacity = 1 - phase / 0.62;
} else {
sample.contactMarker.visible = false;
}
// Primary expanding ring.
if (phase >= 0.02 && phase < 0.98) {
const q = (phase - 0.02) / 0.96;
sample.firstRing.visible = true;
sample.firstRing.scale.setScalar(0.28 + q * 4.8);
sample.firstRing.material.opacity =
0.82 * Math.pow(1 - q, 1.35);
} else {
sample.firstRing.visible = false;
}
// Secondary ring.
if (phase >= 0.34 && phase < 1.38) {
const q = (phase - 0.34) / 1.04;
sample.secondRing.visible = true;
sample.secondRing.scale.setScalar(0.25 + q * 5.2);
sample.secondRing.material.opacity =
0.62 * Math.pow(1 - q, 1.5);
} else {
sample.secondRing.visible = false;
}
// Progressive conceptual paths.
const fade =
phase > 2.75
? Math.max(0, 1 - (phase - 2.75) / 1.35)
: 1;
sample.paths.forEach((path, pathIndex) => {
const q = THREE.MathUtils.clamp(
(phase - 0.18 - pathIndex * 0.032) / 1.4,
0,
1
);
const visiblePoints = Math.max(
0,
Math.ceil(q * (path.points.length - 1))
);
path.line.geometry.setDrawRange(0, visiblePoints);
path.line.material.opacity = 0.76 * fade;
if (q > 0 && q < 1 && phase < 2.1) {
const pointIndex = Math.round(q * (path.points.length - 1));
path.node.position.copy(path.points[pointIndex]);
path.node.visible = true;
path.node.scale.setScalar(0.8 + Math.sin(q * Math.PI) * 0.7);
path.node.material.opacity = 0.95 * fade;
} else {
path.node.visible = false;
}
});
// Symbolic transfer pulses at lower layers.
sample.layerPulses.forEach((pulse) => {
const localPhase = phase - pulse.start;
if (localPhase >= 0 && localPhase < 1.15) {
const q = localPhase / 1.15;
pulse.ring.visible = true;
pulse.ring.scale.setScalar(0.28 + q * 4.1);
pulse.ring.material.opacity =
0.64 * Math.pow(1 - q, 1.35);
} else {
pulse.ring.visible = false;
}
});
});
}
function updateLabels() {
const width = window.innerWidth;
const height = window.innerHeight;
samples.forEach((sample) => {
sample.group.updateMatrixWorld(true);
const position = sample.group
.localToWorld(sample.labelAnchor.clone())
.project(camera);
const visible = position.z > -1 && position.z < 1;
sample.label.style.display = visible ? "block" : "none";
sample.label.style.left =
`${(position.x * 0.5 + 0.5) * width}px`;
sample.label.style.top =
`${(-position.y * 0.5 + 0.5) * height}px`;
});
}
document.getElementById("replay").addEventListener("click", () => {
clock.timeline = 0;
});
document.getElementById("reset-view").addEventListener("click", () => {
resetCamera();
});
window.addEventListener("resize", () => {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setPixelRatio(
Math.min(window.devicePixelRatio || 1, 2)
);
renderer.setSize(window.innerWidth, window.innerHeight);
});
renderer.setAnimationLoop((now) => {
const delta = Math.min((now - clock.previous) / 1000, 0.05);
clock.previous = now;
clock.timeline += delta;
updatePulses(clock.timeline);
updateLabels();
renderer.render(scene, camera);
});
</script>
</body>
</html>
```