Prompt specification
Build or customize the Three.js 3D scene "Surface team receiving a rescue capsule" 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: Surface team receiving a rescue capsule
Category: Art & Culture · Style: Procedural Solid / Shader 3D
License: MIT · Reference: https://three3d.app/scene/surface-team-receiving-a-rescue-capsule-x2430
Scene Description Prompt:
Build a self-contained HTML scene with Three.js from cdnjs featuring the 2010 Chilean mine rescue. Create a respectful non-graphic rescue vignette with capsule, platform, and support team. Source equipment appearance and avoid inventing private dialogue or emotional states of identifiable people. Low-poly.
Working Three.js Starter (surface-team-receiving-a-rescue-capsule-x2430):
```html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="theme-color" content="#182126">
<title>Rescue at San José — Chilean Mine Rescue, 2010</title>
<style>
:root {
color-scheme: dark;
--ink: #f5f1e8;
--muted: #bcc8c9;
--panel: rgba(19, 28, 32, 0.84);
--line: rgba(255, 255, 255, 0.16);
--accent: #f3b642;
--accent-soft: rgba(243, 182, 66, 0.18);
}
* {
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: #c8d4d5;
font-family:
Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
"Segoe UI", sans-serif;
}
button,
input {
font: inherit;
}
button:focus-visible,
input:focus-visible,
canvas:focus-visible {
outline: 3px solid #ffe08a;
outline-offset: 3px;
}
#app {
position: relative;
width: 100%;
height: 100%;
isolation: isolate;
}
#stage {
position: absolute;
inset: 0;
overflow: hidden;
}
#stage canvas {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
display: block;
touch-action: none;
cursor: grab;
}
#stage canvas:active {
cursor: grabbing;
}
.scrim {
position: absolute;
inset: 0;
pointer-events: none;
background:
linear-gradient(180deg, rgba(11, 19, 23, 0.35), transparent 26%),
linear-gradient(0deg, rgba(11, 19, 23, 0.28), transparent 36%);
z-index: 1;
}
header {
position: absolute;
z-index: 4;
top: clamp(20px, 4vw, 46px);
left: clamp(20px, 4vw, 54px);
width: min(560px, calc(100vw - 40px));
color: var(--ink);
pointer-events: none;
text-shadow: 0 2px 20px rgba(0, 0, 0, 0.28);
}
.eyebrow {
display: flex;
align-items: center;
gap: 10px;
margin-bottom: 10px;
color: #ffe4a1;
font-size: 0.72rem;
font-weight: 750;
letter-spacing: 0.15em;
text-transform: uppercase;
}
.eyebrow::before {
content: "";
width: 30px;
height: 2px;
background: currentColor;
}
h1 {
margin: 0;
font-family: Georgia, "Times New Roman", serif;
font-size: clamp(2.25rem, 5vw, 4.8rem);
font-weight: 500;
line-height: 0.98;
letter-spacing: -0.035em;
}
header p {
max-width: 510px;
margin: 15px 0 0;
color: rgba(255, 255, 255, 0.9);
font-size: clamp(0.88rem, 1.5vw, 1.02rem);
line-height: 1.6;
}
.info-card {
position: absolute;
z-index: 4;
top: clamp(20px, 4vw, 46px);
right: clamp(20px, 4vw, 54px);
width: min(310px, calc(100vw - 40px));
padding: 19px 20px;
border: 1px solid var(--line);
border-radius: 16px;
color: var(--ink);
background: var(--panel);
box-shadow: 0 18px 55px rgba(8, 15, 18, 0.2);
backdrop-filter: blur(15px);
-webkit-backdrop-filter: blur(15px);
}
.info-card h2 {
margin: 0 0 10px;
font-size: 0.77rem;
letter-spacing: 0.12em;
text-transform: uppercase;
color: #ffe4a1;
}
.info-card p {
margin: 0;
color: var(--muted);
font-size: 0.84rem;
line-height: 1.55;
}
.fact {
display: flex;
gap: 12px;
margin-top: 15px;
padding-top: 14px;
border-top: 1px solid var(--line);
}
.fact strong {
min-width: 64px;
color: var(--ink);
font-size: 1.05rem;
}
.fact span {
color: var(--muted);
font-size: 0.77rem;
line-height: 1.35;
}
.timeline {
position: absolute;
z-index: 5;
left: 50%;
bottom: clamp(18px, 3vw, 34px);
width: min(760px, calc(100vw - 32px));
transform: translateX(-50%);
padding: 14px 16px 12px;
border: 1px solid var(--line);
border-radius: 16px;
background: var(--panel);
box-shadow: 0 18px 55px rgba(8, 15, 18, 0.24);
backdrop-filter: blur(15px);
-webkit-backdrop-filter: blur(15px);
}
.timeline-head {
display: flex;
align-items: center;
justify-content: space-between;
gap: 14px;
margin-bottom: 10px;
}
.phase {
min-width: 0;
}
.phase strong {
display: block;
overflow: hidden;
color: var(--ink);
font-size: 0.9rem;
text-overflow: ellipsis;
white-space: nowrap;
}
.phase span {
display: block;
margin-top: 2px;
color: var(--muted);
font-size: 0.69rem;
}
.actions {
display: flex;
flex: none;
gap: 7px;
}
.icon-button {
display: grid;
width: 36px;
height: 36px;
padding: 0;
place-items: center;
border: 1px solid var(--line);
border-radius: 10px;
color: var(--ink);
background: rgba(255, 255, 255, 0.07);
cursor: pointer;
transition: background 150ms ease, transform 150ms ease;
}
.icon-button:hover {
background: var(--accent-soft);
transform: translateY(-1px);
}
.icon-button svg {
width: 17px;
height: 17px;
fill: currentColor;
}
.scrubber {
display: grid;
grid-template-columns: 1fr auto;
align-items: center;
gap: 12px;
}
input[type="range"] {
width: 100%;
height: 20px;
margin: 0;
accent-color: var(--accent);
cursor: pointer;
}
.time {
min-width: 76px;
color: var(--muted);
font-size: 0.7rem;
font-variant-numeric: tabular-nums;
text-align: right;
}
.view-tools {
position: absolute;
z-index: 5;
right: clamp(20px, 4vw, 54px);
bottom: clamp(124px, 14vw, 142px);
display: flex;
gap: 8px;
}
.text-button {
padding: 9px 12px;
border: 1px solid var(--line);
border-radius: 10px;
color: var(--ink);
background: var(--panel);
box-shadow: 0 8px 30px rgba(8, 15, 18, 0.16);
backdrop-filter: blur(12px);
-webkit-backdrop-filter: blur(12px);
cursor: pointer;
font-size: 0.74rem;
font-weight: 650;
}
.text-button:hover {
background: rgba(41, 54, 59, 0.94);
}
.hint {
position: absolute;
z-index: 4;
left: clamp(20px, 4vw, 54px);
bottom: clamp(125px, 14vw, 143px);
color: rgba(255, 255, 255, 0.78);
font-size: 0.7rem;
line-height: 1.45;
pointer-events: none;
text-shadow: 0 1px 8px rgba(0, 0, 0, 0.4);
}
.scene-label {
position: absolute;
z-index: 3;
max-width: 190px;
padding: 7px 9px;
border: 1px solid rgba(255, 255, 255, 0.22);
border-radius: 8px;
color: #f8f4e8;
background: rgba(20, 29, 33, 0.76);
box-shadow: 0 5px 18px rgba(0, 0, 0, 0.16);
backdrop-filter: blur(6px);
-webkit-backdrop-filter: blur(6px);
font-size: 0.66rem;
line-height: 1.35;
pointer-events: none;
transform: translate(-50%, -50%);
transition: opacity 120ms ease;
}
.scene-label::after {
content: "";
position: absolute;
top: 100%;
left: 50%;
width: 1px;
height: 18px;
background: rgba(255, 255, 255, 0.55);
}
.scene-label strong {
display: block;
color: #ffe4a1;
font-size: 0.68rem;
}
dialog {
width: min(660px, calc(100vw - 28px));
max-height: min(80vh, 720px);
padding: 0;
overflow: hidden;
border: 1px solid var(--line);
border-radius: 18px;
color: var(--ink);
background: #182126;
box-shadow: 0 30px 100px rgba(0, 0, 0, 0.42);
}
dialog::backdrop {
background: rgba(9, 15, 18, 0.62);
backdrop-filter: blur(5px);
}
.dialog-content {
padding: 26px;
overflow: auto;
}
.dialog-top {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 20px;
}
dialog h2 {
margin: 0;
font-family: Georgia, "Times New Roman", serif;
font-size: 1.8rem;
font-weight: 500;
}
dialog p,
dialog li {
color: var(--muted);
font-size: 0.87rem;
line-height: 1.65;
}
dialog a {
color: #ffe4a1;
text-underline-offset: 3px;
}
dialog ul {
padding-left: 19px;
}
.note {
margin-top: 20px;
padding: 14px 15px;
border-left: 3px solid var(--accent);
background: rgba(243, 182, 66, 0.08);
font-size: 0.83rem;
line-height: 1.55;
}
@media (max-width: 800px) {
header {
max-width: calc(100vw - 40px);
}
header p {
display: none;
}
.info-card {
top: auto;
right: 16px;
bottom: 127px;
width: 210px;
padding: 13px 14px;
}
.info-card h2,
.info-card p,
.fact {
display: none;
}
.view-tools {
right: 16px;
bottom: 130px;
}
.hint {
display: none;
}
.timeline {
bottom: 14px;
}
}
@media (max-width: 520px) {
header {
top: 20px;
left: 18px;
}
h1 {
font-size: 2.45rem;
}
.eyebrow {
font-size: 0.61rem;
}
.timeline {
padding: 12px;
}
.phase span {
display: none;
}
.view-tools {
bottom: 94px;
}
.info-card {
display: none;
}
}
@media (prefers-reduced-motion: reduce) {
*,
*::before,
*::after {
scroll-behavior: auto !important;
transition: none !important;
}
}
</style>
</head>
<body>
<main id="app">
<section
id="stage"
role="img"
aria-label="A respectful low-poly visualization of the 2010 Chilean mine rescue, showing a rescue capsule over a mine shaft, a surface platform, and an anonymous support team."
>
<div class="scrim"></div>
<div id="capsule-label" class="scene-label">
<strong>Rescue capsule</strong>
Simplified Fénix form
</div>
<div id="team-label" class="scene-label">
<strong>Surface support</strong>
Anonymous equipment crew
</div>
<div id="shaft-label" class="scene-label">
<strong>Shaft section</strong>
Vertical scale compressed
</div>
</section>
<header>
<div class="eyebrow">Atacama, Chile · 2010</div>
<h1>Rescue at San José</h1>
<p>
A quiet, non-graphic reconstruction of the surface operations used to
bring 33 miners to the surface from the collapsed San José copper mine.
</p>
</header>
<aside class="info-card" aria-label="Historical context">
<h2>Context</h2>
<p>
The rescue took place in August–October 2010. This vignette focuses on
the surface equipment. No trapped people, private dialogue, or
identifiable individuals are depicted.
</p>
<div class="fact">
<strong>33</strong>
<span>miners safely brought to the surface</span>
</div>
<div class="fact">
<strong>69</strong>
<span>days between the collapse and the rescue</span>
</div>
</aside>
<div class="view-tools">
<button id="reset-view" class="text-button" type="button">Reset view</button>
<button id="open-sources" class="text-button" type="button">Sources & notes</button>
</div>
<div class="hint" aria-hidden="true">
Drag to orbit · Scroll to zoom · Arrow keys to inspect
</div>
<section class="timeline" aria-label="Illustrative rescue sequence">
<div class="timeline-head">
<div class="phase">
<strong id="phase-title">Surface preparation</strong>
<span>Illustrative sequence, not to actual timing</span>
</div>
<div class="actions">
<button
id="play-toggle"
class="icon-button"
type="button"
aria-label="Pause sequence"
title="Pause sequence"
>
<svg id="pause-icon" viewBox="0 0 24 24" aria-hidden="true">
<path d="M7 5h4v14H7zm6 0h4v14h-4z"></path>
</svg>
<svg
id="play-icon"
viewBox="0 0 24 24"
aria-hidden="true"
style="display:none"
>
<path d="M8 5v14l11-7z"></path>
</svg>
</button>
<button
id="restart"
class="icon-button"
type="button"
aria-label="Restart sequence"
title="Restart sequence"
>
<svg viewBox="0 0 24 24" aria-hidden="true">
<path d="M12 5a7 7 0 1 1-6.7 9H3l3.5-4L10 14H7.4A5 5 0 1 0 12 7V5z"></path>
</svg>
</button>
</div>
</div>
<div class="scrubber">
<input
id="progress"
type="range"
min="0"
max="1000"
value="0"
aria-label="Illustrative rescue sequence progress"
>
<span id="time" class="time">00:00 / 00:32</span>
</div>
</section>
<dialog id="sources-dialog">
<div class="dialog-content">
<div class="dialog-top">
<h2>Sources & scene notes</h2>
<button id="close-sources" class="icon-button" type="button" aria-label="Close">
<svg viewBox="0 0 24 24" aria-hidden="true">
<path d="m6.4 5 5.6 5.6L17.6 5 19 6.4 13.4 12 19 17.6 17.6 19 12 13.4 6.4 19 5 17.6 10.6 12 5 6.4z"></path>
</svg>
</button>
</div>
<p>
The capsule’s red shell, pale band, protected hatch, and yellow frame
were interpreted from published photographs and period reporting.
Geometry is deliberately simplified and is not an engineering model.
</p>
<ul>
<li>
Historical context:
<a href="https://www.britannica.com/event/2010-Chilean-mines-collapse"
target="_blank"
rel="noreferrer">
Encyclopaedia Britannica — 2010 Chilean mines collapse
</a>.
</li>
<li>
Equipment appearance and period reporting:
<a href="https://news.bbc.co.uk/2/hi/latin_america/8498452.stm"
target="_blank"
rel="noreferrer">
BBC News — “Chile miners: Rescue capsule begins descent”
</a>.
</li>
<li>
Contemporary photographic reference:
<a href="https://commons.wikimedia.org/wiki/Category:2010_Copiap%C3%B3_mining_accident"
target="_blank"
rel="noreferrer">
Wikimedia Commons — 2010 Copiapó mining accident photographs
</a>.
</li>
</ul>
<div class="note">
The shaft depth and sequence are compressed for legibility. The support
team consists of anonymous, faceless figures with neutral working
poses. The scene does not reconstruct private conversations,
identifiable people, medical procedures, or emotional reactions.
</div>
</div>
</dialog>
</main>
<script type="module">
import * as THREE from
"https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
// ------------------------------------------------------------
// Scene setup
// ------------------------------------------------------------
const stage = document.querySelector("#stage");
const reducedMotion = window.matchMedia(
"(prefers-reduced-motion: reduce)"
).matches;
const scene = new THREE.Scene();
scene.background = new THREE.Color(0xc7d7d9);
scene.fog = new THREE.Fog(0xc7d7d9, 31, 72);
const camera = new THREE.PerspectiveCamera(
42,
window.innerWidth / window.innerHeight,
0.1,
120
);
const renderer = new THREE.WebGLRenderer({
antialias: true,
alpha: false,
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.03;
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
renderer.domElement.tabIndex = 0;
renderer.domElement.setAttribute(
"aria-label",
"Interactive low-poly rescue scene. Drag to orbit and scroll to zoom."
);
stage.prepend(renderer.domElement);
const hemisphere = new THREE.HemisphereLight(0xddeef0, 0x725138, 2.15);
scene.add(hemisphere);
const sun = new THREE.DirectionalLight(0xffe8bd, 3.5);
sun.position.set(-18, 28, 16);
sun.castShadow = true;
sun.shadow.mapSize.set(2048, 2048);
sun.shadow.camera.left = -25;
sun.shadow.camera.right = 25;
sun.shadow.camera.top = 25;
sun.shadow.camera.bottom = -25;
sun.shadow.camera.near = 1;
sun.shadow.camera.far = 70;
sun.shadow.bias = -0.0005;
scene.add(sun);
const fill = new THREE.DirectionalLight(0x8cc4d4, 0.8);
fill.position.set(20, 8, -18);
scene.add(fill);
// ------------------------------------------------------------
// Materials and geometry helpers
// ------------------------------------------------------------
function material(color, options = {}) {
return new THREE.MeshStandardMaterial({
color,
roughness: 0.86,
metalness: 0,
flatShading: true,
...options
});
}
const mat = {
ground: material(0xa87848),
groundDark: material(0x765039),
distant: material(0x9b7050),
distantFar: material(0x8a6b57),
rock: material(0x785d48),
rockLight: material(0x98755a),
shaft: material(0x49372e, { side: THREE.BackSide }),
shaftBand: material(0x5d4738),
shaftDark: material(0x171718),
platform: material(0x626d6e, { metalness: 0.35, roughness: 0.65 }),
platformDark: material(0x3a4548, { metalness: 0.45 }),
yellow: material(0xeeb33f, { metalness: 0.18, roughness: 0.55 }),
yellowDark: material(0xa66c20),
red: material(0xb7352d, { metalness: 0.18, roughness: 0.58 }),
cream: material(0xe6dfcf, { metalness: 0.1 }),
steel: material(0x8b9697, { metalness: 0.65, roughness: 0.42 }),
darkSteel: material(0x30393c, { metalness: 0.68, roughness: 0.42 }),
rubber: material(0x202526, { roughness: 0.96 }),
glass: material(0x263d46, { metalness: 0.3, roughness: 0.22 }),
navy: material(0x273b4b),
orange: material(0xe77b35),
reflective: material(0xf2e5ae),
helmet: material(0xf0bd42),
skin: material(0xb9896d),
cable: material(0x252b2c, { metalness: 0.72, roughness: 0.5 })
};
function mesh(geometry, material, parent = scene) {
const object = new THREE.Mesh(geometry, material);
object.castShadow = true;
object.receiveShadow = true;
parent.add(object);
return object;
}
function box(w, h, d, material, x, y, z, parent = scene) {
const object = mesh(
new THREE.BoxGeometry(w, h, d),
material,
parent
);
object.position.set(x, y, z);
return object;
}
function cylinder(
radiusTop,
radiusBottom,
height,
material,
x,
y,
z,
segments = 12,
parent = scene
) {
const object = mesh(
new THREE.CylinderGeometry(
radiusTop,
radiusBottom,
height,
segments,
1,
false
),
material,
parent
);
object.position.set(x, y, z);
return object;
}
function ring(radius, tube, material, x, y, z, parent = scene) {
const object = mesh(
new THREE.TorusGeometry(radius, tube, 6, 20),
material,
parent
);
object.rotation.x = Math.PI / 2;
object.position.set(x, y, z);
return object;
}
const up = new THREE.Vector3(0, 1, 0);
function rodBetween(
pointA,
pointB,
radius,
material,
parent = scene,
segments = 8
) {
const direction = new THREE.Vector3().subVectors(pointB, pointA);
const length = direction.length();
const object = cylinder(
radius,
radius,
length,
material,
0,
0,
0,
segments,
parent
);
object.position.copy(pointA).add(pointB).multiplyScalar(0.5);
object.quaternion.setFromUnitVectors(
up,
direction.normalize()
);
return object;
}
function seededRandom(seed) {
let state = seed >>> 0;
return () => {
state = (1664525 * state + 1013904223) >>> 0;
return state / 4294967296;
};
}
const random = seededRandom(20101013);
// ------------------------------------------------------------
// Desert environment
// ------------------------------------------------------------
const groundShape = new THREE.Shape();
groundShape.moveTo(-46, -46);
groundShape.lineTo(46, -46);
groundShape.lineTo(46, 46);
groundShape.lineTo(-46, 46);
groundShape.closePath();
const shaftHole = new THREE.Path();
shaftHole.absarc(0, 0, 4.58, 0, Math.PI * 2, true);
groundShape.holes.push(shaftHole);
const ground = mesh(
new THREE.ShapeGeometry(groundShape, 24),
mat.ground
);
ground.rotation.x = -Math.PI / 2;
ground.position.y = 0;
ground.castShadow = false;
// Large low-poly distant landforms.
const hillSpecs = [
[-26, -22, 7.2, 4.5],
[-17, -30, 9.0, 6.2],
[0, -35, 12.0, 7.2],
[18, -31, 8.5, 5.8],
[31, -20, 7.0, 4.0],
[-34, 8, 6.2, 3.8],
[35, 12, 8.0, 5.0]
];
hillSpecs.forEach(([x, z, radius, height], index) => {
const hill = mesh(
new THREE.ConeGeometry(radius, height, 7, 1),
index % 2 ? mat.distant : mat.distantFar
);
hill.position.set(x, height * 0.5 - 0.35, z);
hill.rotation.y = random() * Math.PI;
hill.scale.z = 0.75 + random() * 0.5;
hill.castShadow = false;
});
// Scattered angular stones.
for (let i = 0; i < 42; i++) {
const angle = random() * Math.PI * 2;
const radius = 9 + random() * 26;
const size = 0.18 + random() * 0.65;
const rock = mesh(
new THREE.DodecahedronGeometry(size, 0),
i % 3 === 0 ? mat.rockLight : mat.rock
);
rock.position.set(
Math.cos(angle) * radius,
size * 0.4,
Math.sin(angle) * radius
);
rock.rotation.set(random(), random(), random());
rock.scale.y = 0.6 + random() * 0.6;
}
// ------------------------------------------------------------
// Compressed mine shaft
// ------------------------------------------------------------
const shaft = mesh(
new THREE.CylinderGeometry(4.55, 4.55, 28, 20, 1, true),
mat.shaft
);
shaft.position.y = -14;
shaft.castShadow = false;
const shaftBottom = mesh(
new THREE.CircleGeometry(4.54, 20),
mat.shaftDark
);
shaftBottom.rotation.x = -Math.PI / 2;
shaftBottom.position.y = -28;
shaftBottom.castShadow = false;
for (let y = -3; y >= -25; y -= 4.5) {
ring(4.42, 0.08, mat.shaftBand, 0, y, 0);
}
// A few vertical shaft braces.
for (let i = 0; i < 8; i++) {
const angle = (i / 8) * Math.PI * 2;
const x = Math.cos(angle) * 4.32;
const z = Math.sin(angle) * 4.32;
box(0.12, 27, 0.12, mat.shaftBand, x, -14, z);
}
// ------------------------------------------------------------
// Surface platform and safety perimeter
// ------------------------------------------------------------
const platform = mesh(
new THREE.RingGeometry(4.58, 7.25, 12, 1),
mat.platform
);
platform.rotation.x = -Math.PI / 2;
platform.position.y = 0.08;
platform.castShadow = false;
const platformEdge = mesh(
new THREE.RingGeometry(7.05, 7.3, 12, 1),
mat.platformDark
);
platformEdge.rotation.x = -Math.PI / 2;
platformEdge.position.y = 0.12;
platformEdge.castShadow = false;
const hazardRing = mesh(
new THREE.RingGeometry(4.58, 4.83, 24, 1),
mat.yellow
);
hazardRing.rotation.x = -Math.PI / 2;
hazardRing.position.y = 0.14;
hazardRing.castShadow = false;
// Alternating dark deck panels add scale without texture maps.
for (let i = 0; i < 12; i++) {
const angle = (i / 12) * Math.PI * 2;
const panel = box(
0.68,
0.035,
1.5,
i % 2 ? mat.platformDark : mat.steel,
Math.cos(angle) * 5.95,
0.12,
Math.sin(angle) * 5.95
);
panel.rotation.y = -angle;
panel.castShadow = false;
}
// Safety rails.
for (let i = 0; i < 12; i++) {
const angle = (i / 12) * Math.PI * 2;
const x = Math.cos(angle) * 6.95;
const z = Math.sin(angle) * 6.95;
cylinder(0.055, 0.055, 1.55, mat.yellowDark, x, 0.9, z, 8);
}
ring(6.93, 0.055, mat.yellowDark, 0, 1.62, 0);
ring(6.93, 0.045, mat.yellowDark, 0, 0.95, 0);
// ------------------------------------------------------------
// Rescue gantry, pulley and winch
// ------------------------------------------------------------
const gantry = new THREE.Group();
scene.add(gantry);
const gantryPoints = [
[-5.75, -5.15],
[5.75, -5.15],
[5.75, 5.15],
[-5.75, 5.15]
];
gantryPoints.forEach(([x, z]) => {
box(0.34, 10.4, 0.34, mat.yellowDark, x, 5.2, z, gantry);
box(0.72, 0.18, 0.72, mat.platformDark, x, 0.2, z, gantry);
});
box(11.9, 0.4, 0.42, mat.yellow, 0, 10.35, -5.15, gantry);
box(11.9, 0.4, 0.42, mat.yellow, 0, 10.35, 5.15, gantry);
box(0.42, 0.4, 10.7, mat.yellow, -5.75, 10.35, 0, gantry);
box(0.42, 0.4, 10.7, mat.yellow, 5.75, 10.35, 0, gantry);
// Diagonal gantry braces.
rodBetween(
new THREE.Vector3(-5.75, 7.2, -5.15),
new THREE.Vector3(-2.2, 10.3, -5.15),
0.11,
mat.yellowDark,
gantry
);
rodBetween(
new THREE.Vector3(5.75, 7.2, 5.15),
new THREE.Vector3(2.2, 10.3, 5.15),
0.11,
mat.yellowDark,
gantry
);
const pulleyGroup = new THREE.Group();
pulleyGroup.position.set(0, 10.02, 0);
scene.add(pulleyGroup);
const pulley = cylinder(
0.48,
0.48,
0.32,
mat.darkSteel,
0,
0,
0,
16,
pulleyGroup
);
pulley.rotation.z = Math.PI / 2;
const pulleyHub = cylinder(
0.17,
0.17,
0.4,
mat.yellow,
0,
0,
0,
12,
pulleyGroup
);
pulleyHub.rotation.z = Math.PI / 2;
// Winch assembly.
const winch = new THREE.Group();
winch.position.set(3.75, 0.65, 4.25);
scene.add(winch);
box(1.65, 0.7, 1.35, mat.platformDark, 0, 0.35, 0, winch);
box(1.85, 0.18, 1.5, mat.steel, 0, 0.82, 0, winch);
const drum = cylinder(
0.56,
0.56,
1.18,
mat.cable,
0,
1.12,
0,
16,
winch
);
drum.rotation.z = Math.PI / 2;
for (const x of [-0.65, 0.65]) {
const flange = cylinder(
0.72,
0.72,
0.12,
mat.yellow,
x,
1.12,
0,
16,
winch
);
flange.rotation.z = Math.PI / 2;
}
// ------------------------------------------------------------
// Rescue capsule — simplified, low-poly interpretation
// ------------------------------------------------------------
const capsule = new THREE.Group();
scene.add(capsule);
const shell = mesh(
new THREE.IcosahedronGeometry(1, 2),
mat.red,
capsule
);
shell.scale.set(1.68, 1.92, 1.68);
cylinder(
1.69,
1.69,
0.43,
mat.cream,
0,
0,
0,
16,
capsule
);
cylinder(
0.88,
1.18,
0.42,
mat.cream,
0,
1.58,
0,
14,
capsule
);
cylinder(
1.1,
0.85,
0.36,
mat.cream,
0,
-1.62,
0,
14,
capsule
);
// Front hatch and inset viewing port.
const hatchRim = cylinder(
0.66,
0.66,
0.17,
mat.steel,
0,
0.08,
1.62,
16,
capsule
);
hatchRim.rotation.x = Math.PI / 2;
const hatchWindow = cylinder(
0.43,
0.43,
0.19,
mat.glass,
0,
0.08,
1.73,
16,
capsule
);
hatchWindow.rotation.x = Math.PI / 2;
const hatchHandle = box(
0.1,
0.32,
0.1,
mat.yellow,
0.48,
0.08,
1.79,
capsule
);
hatchHandle.rotation.z = -0.35;
// Protective yellow cage.
const cageAngles = [
Math.PI * 0.18,
Math.PI * 0.5,
Math.PI * 0.82,
Math.PI * 1.5
];
cageAngles.forEach((angle) => {
const radius = 1.84;
const x = Math.cos(angle) * radius;
const z = Math.sin(angle) * radius;
rodBetween(
new THREE.Vector3(x, -1.45, z),
new THREE.Vector3(x * 0.8, 1.55, z * 0.8),
0.075,
mat.yellow,
capsule
);
});
ring(1.82, 0.075, mat.yellow, 0, 1.18, 0, capsule);
ring(1.8, 0.075, mat.yellow, 0, -1.28, 0, capsule);
// Lower cradle and three small wheels.
box(0.16, 0.18, 2.7, mat.darkSteel, -1.12, -1.8, -0.15, capsule);
box(0.16, 0.18, 2.7, mat.darkSteel, 1.12, -1.8, -0.15, capsule);
box(2.45, 0.16, 0.16, mat.darkSteel, 0, -1.82, 0.85, capsule);
const wheelPositions = [
[-1.48, -1.77, -0.52],
[1.48, -1.77, -0.52],
[0, -1.77, 1.2]
];
wheelPositions.forEach(([x, y, z]) => {
const wheel = cylinder(
0.31,
0.31,
0.22,
mat.rubber,
x,
y,
z,
12,
capsule
);
const direction = new THREE.Vector3(x, 0, z).normalize();
wheel.quaternion.setFromUnitVectors(up, direction);
});
// Lifting eye and cable attachment.
const liftingEye = mesh(
new THREE.TorusGeometry(0.18, 0.055, 6, 12),
mat.yellow,
capsule
);
liftingEye.position.set(0, 2.18, 0);
cylinder(
0.11,
0.11,
0.35,
mat.darkSteel,
0,
2.37,
0,
10,
capsule
);
// Cable is scaled and reoriented as the capsule moves.
const cable = cylinder(
0.028,
0.028,
1,
mat.cable,
0,
0,
0,
7
);
const cableTop = new THREE.Vector3(0, 9.82, 0);
const cableBottom = new THREE.Vector3(0, 3.45, 0);
function updateCable() {
cableBottom.set(0, capsule.position.y + 2.52, 0);
const direction = new THREE.Vector3().subVectors(
cableBottom,
cableTop
);
const length = direction.length();
cable.position.copy(cableTop).add(cableBottom).multiplyScalar(0.5);
cable.quaternion.setFromUnitVectors(up, direction.normalize());
cable.scale.set(1, length, 1);
}
// ------------------------------------------------------------
// Anonymous support team
// ------------------------------------------------------------
function createSupportWorker(x, z, rotation, variant = 0) {
const worker = new THREE.Group();
worker.position.set(x, 0.17, z);
worker.rotation.y = rotation;
scene.add(worker);
// Boots and trousers.
box(
0.23,
0.16,
0.44,
mat.rubber,
-0.2,
0.08,
0.03,
worker
);
box(
0.23,
0.16,
0.44,
mat.rubber,
0.2,
0.08,
0.03,
worker
);
cylinder(
0.13,
0.15,
0.76,
mat.navy,
-0.2,
0.51,
0,
7,
worker
);
cylinder(
0.13,
0.15,
0.76,
mat.navy,
0.2,
0.51,
0,
7,
worker
);
// High-visibility vest.
box(
0.72,
0.72,
0.38,
mat.orange,
0,
1.22,
0,
worker
);
box(
0.74,
0.1,
0.395,
mat.reflective,
0,
1.31,
0,
worker
);
box(
0.1,
0.68,
0.395,
mat.reflective,
-0.2,
1.22,
0,
worker
);
box(
0.1,
0.68,
0.395,
mat.reflective,
0.2,
1.22,
0,
worker
);
// Arms in neutral working positions.
cylinder(
0.105,
0.12,
0.68,
mat.navy,
-0.46,
1.18,
0,
7,
worker
);
cylinder(
0.105,
0.12,
0.68,
mat.navy,
0.46,
1.18,
0,
7,
worker
);
// Featureless head and hard hat.
const head = mesh(
new THREE.IcosahedronGeometry(0.27, 1),
mat.skin,
worker
);
head.position.y = 1.88;
const helmet = mesh(
new THREE.SphereGeometry(
0.32,
10,
5,
0,
Math.PI * 2,
0,
Math.PI / 2
),
variant ? mat.cream : mat.helmet,
worker
);
helmet.position.y = 1.93;
const brim = cylinder(
0.34,
0.34,
0.055,
variant ? mat.cream : mat.helmet,
0,
1.92,
0,
10,
worker
);
// A small equipment case carried by one worker.
if (variant === 1) {
const caseObject = box(
0.48,
0.34,
0.2,
mat.darkSteel,
0,
1.05,
0.38,
worker
);
caseObject.rotation.x = 0.08;
}
return worker;
}
createSupportWorker(-5.15, 3.7, -0.72, 0);
createSupportWorker(-5.9, 2.85, -0.8, 1);
createSupportWorker(4.9, 3.15, 0.72, 0);
createSupportWorker(5.5, 2.15, 0.86, 1);
createSupportWorker(-3.55, 5.55, -2.1, 0);
createSupportWorker(2.25, 5.85, 2.25, 1);
createSupportWorker(3.9, -4.15, 0.25, 0);
// A small control console near the winch.
const consoleGroup = new THREE.Group();
consoleGroup.position.set(4.65, 0.2, 4.45);
consoleGroup.rotation.y = -0.5;
scene.add(consoleGroup);
box(0.9, 0.75, 0.55, mat.darkSteel, 0, 0.38, 0, consoleGroup);
const consoleTop = box(
0.92,
0.09,
0.58,
mat.steel,
0,
0.79,
0,
consoleGroup
);
consoleTop.rotation.x = -0.18;
for (let i = 0; i < 3; i++) {
const indicator = cylinder(
0.045,
0.045,
0.035,
i === 1 ? mat.yellow : mat.red,
-0.23 + i * 0.23,
0.85,
0.02,
8,
consoleGroup
);
indicator.rotation.x = -0.18;
}
// ------------------------------------------------------------
// Camera controls — implemented without Three.js addons
// ------------------------------------------------------------
const orbit = {
theta: 0.72,
phi: 0.98,
radius: 24,
target: new THREE.Vector3(0, 1.55, 0)
};
const defaultOrbit = { ...orbit, target: orbit.target.clone() };
function updateCamera() {
const sinPhi = Math.sin(orbit.phi);
camera.position.set(
orbit.target.x + orbit.radius * sinPhi * Math.sin(orbit.theta),
orbit.target.y + orbit.radius * Math.cos(orbit.phi),
orbit.target.z + orbit.radius * sinPhi * Math.cos(orbit.theta)
);
camera.lookAt(orbit.target);
}
function resetView() {
orbit.theta = defaultOrbit.theta;
orbit.phi = defaultOrbit.phi;
orbit.radius = defaultOrbit.radius;
orbit.target.copy(defaultOrbit.target);
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.38,
1.43
);
updateCamera();
});
function endDrag(event) {
dragging = false;
if (event.pointerId !== undefined &&
renderer.domElement.hasPointerCapture(event.pointerId)) {
renderer.domElement.releasePointerCapture(event.pointerId);
}
}
renderer.domElement.addEventListener("pointerup", endDrag);
renderer.domElement.addEventListener("pointercancel", endDrag);
renderer.domElement.addEventListener(
"wheel",
(event) => {
event.preventDefault();
orbit.radius = THREE.MathUtils.clamp(
orbit.radius + event.deltaY * 0.012,
11,
37
);
updateCamera();
},
{ passive: false }
);
renderer.domElement.addEventListener("keydown", (event) => {
let handled = true;
switch (event.key) {
case "ArrowLeft":
orbit.theta -= 0.08;
break;
case "ArrowRight":
orbit.theta += 0.08;
break;
case "ArrowUp":
orbit.phi = Math.max(0.38, orbit.phi - 0.06);
break;
case "ArrowDown":
orbit.phi = Math.min(1.43, orbit.phi + 0.06);
break;
case "+":
case "=":
orbit.radius = Math.max(11, orbit.radius - 1);
break;
case "-":
orbit.radius = Math.min(37, orbit.radius + 1);
break;
default:
handled = false;
}
if (handled) {
event.preventDefault();
updateCamera();
}
});
// ------------------------------------------------------------
// Timeline and scene animation
// ------------------------------------------------------------
const progressInput = document.querySelector("#progress");
const phaseTitle = document.querySelector("#phase-title");
const timeLabel = document.querySelector("#time");
const playToggle = document.querySelector("#play-toggle");
const playIcon = document.querySelector("#play-icon");
const pauseIcon = document.querySelector("#pause-icon");
const totalDuration = 32;
let progress = reducedMotion ? 0.96 : 0;
let playing = !reducedMotion;
let lastTime = performance.now();
function easeInOutCubic(value) {
return value < 0.5
? 4 * value * value * value
: 1 - Math.pow(-2 * value + 2, 3) / 2;
}
function setPlaying(value) {
playing = value;
playIcon.style.display = playing ? "none" : "block";
pauseIcon.style.display = playing ? "block" : "none";
playToggle.setAttribute(
"aria-label",
playing ? "Pause sequence" : "Play sequence"
);
playToggle.title = playing ? "Pause sequence" : "Play sequence";
}
function updateScene(value) {
let y;
let phase;
if (value < 0.14) {
y = 1.05;
phase = "Surface preparation";
} else if (value < 0.62) {
const t = (value - 0.14) / 0.48;
y = THREE.MathUtils.lerp(1.05, -18.2, easeInOutCubic(t));
phase = "Controlled descent";
} else if (value < 0.88) {
const t = (value - 0.62) / 0.26;
y = THREE.MathUtils.lerp(-18.2, 1.05, easeInOutCubic(t));
phase = "Return toward the surface";
} else {
y = 1.05;
phase = "Surface arrival";
}
capsule.position.y = y;
updateCable();
pulleyGroup.rotation.x = -value * Math.PI * 7;
drum.rotation.x = -value * Math.PI * 5;
phaseTitle.textContent = phase;
progressInput.value = Math.round(value * 1000);
const elapsed = Math.floor(value * totalDuration);
const minutes = Math.floor(elapsed / 60);
const seconds = String(elapsed % 60).padStart(2, "0");
timeLabel.textContent = `${String(minutes).padStart(2, "0")}:${seconds} / 00:32`;
}
playToggle.addEventListener("click", () => {
if (!playing && progress >= 0.999) {
progress = 0;
}
setPlaying(!playing);
});
document.querySelector("#restart").addEventListener("click", () => {
progress = 0;
updateScene(progress);
setPlaying(true);
});
progressInput.addEventListener("input", () => {
progress = Number(progressInput.value) / 1000;
updateScene(progress);
setPlaying(false);
});
document.querySelector("#reset-view").addEventListener("click", resetView);
const sourcesDialog = document.querySelector("#sources-dialog");
document.querySelector("#open-sources").addEventListener("click", () => {
sourcesDialog.showModal();
});
document.querySelector("#close-sources").addEventListener("click", () => {
sourcesDialog.close();
});
sourcesDialog.addEventListener("click", (event) => {
if (event.target === sourcesDialog) {
sourcesDialog.close();
}
});
// ------------------------------------------------------------
// Screen-space labels
// ------------------------------------------------------------
const labelElements = {
capsule: document.querySelector("#capsule-label"),
team: document.querySelector("#team-label"),
shaft: document.querySelector("#shaft-label")
};
const worldAnchors = {
capsule: new THREE.Vector3(),
team: new THREE.Vector3(-4.9, 2.3, 3.0),
shaft: new THREE.Vector3(4.1, -5.5, 0)
};
function positionLabel(element, worldPosition) {
const projected = worldPosition.clone().project(camera);
const visible =
projected.z > -1 &&
projected.z < 1 &&
Math.abs(projected.x) < 1.1 &&
Math.abs(projected.y) < 1.1;
element.style.opacity = visible ? "1" : "0";
const x = (projected.x * 0.5 + 0.5) * stage.clientWidth;
const y = (-projected.y * 0.5 + 0.5) * stage.clientHeight;
element.style.left = `${x}px`;
element.style.top = `${y}px`;
}
function updateLabels() {
worldAnchors.capsule.set(0, capsule.position.y + 3.05, 0);
positionLabel(labelElements.capsule, worldAnchors.capsule);
positionLabel(labelElements.team, worldAnchors.team);
positionLabel(labelElements.shaft, worldAnchors.shaft);
}
// ------------------------------------------------------------
// Resize and render loop
// ------------------------------------------------------------
function resize() {
const width = window.innerWidth;
const height = window.innerHeight;
camera.aspect = width / height;
camera.updateProjectionMatrix();
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.setSize(width, height);
}
window.addEventListener("resize", resize);
function animate(now) {
const delta = Math.min((now - lastTime) / 1000, 0.05);
lastTime = now;
if (playing) {
progress += delta / totalDuration;
if (progress >= 1) {
progress = 1;
setPlaying(false);
}
}
updateScene(progress);
updateLabels();
renderer.render(scene, camera);
requestAnimationFrame(animate);
}
updateCamera();
updateScene(progress);
setPlaying(playing);
requestAnimationFrame(animate);
</script>
</body>
</html>
```