Prompt specification
Build or customize the Three.js 3D scene "Joint curing timeline model" 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: Joint curing timeline model
Category: Everyday & Industrial · Style: Procedural Solid / Shader 3D
License: MIT · Reference: https://three3d.app/scene/joint-curing-timeline-model-x0266
Scene Description Prompt:
Please create one self-contained HTML file with Three.js from cdnjs showing glued joints. Place aligned strips in a clamp and advance a labeled illustrative curing timer; the bond indicator changes over time while the physical joint remains stationary. Low-poly.
Working Three.js Starter (joint-curing-timeline-model-x0266):
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Glued Joint — Illustrative Curing Timer</title>
<style>
:root {
--bg: #071018;
--panel: rgba(10, 20, 29, 0.82);
--panel-border: rgba(155, 205, 220, 0.17);
--text: #edf7fa;
--muted: #91a8b1;
--accent: #ffad42;
--accent-rgb: 255, 173, 66;
}
* {
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: var(--bg);
color: var(--text);
font-family:
Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
"Segoe UI", sans-serif;
}
button,
select {
font: inherit;
}
#viewport {
position: fixed;
inset: 0;
}
#viewport canvas {
display: block;
width: 100%;
height: 100%;
outline: none;
touch-action: none;
}
.hud {
position: fixed;
inset: 0;
pointer-events: none;
}
#title-block {
position: absolute;
top: 28px;
left: 30px;
width: min(430px, calc(100vw - 390px));
}
.eyebrow {
display: flex;
align-items: center;
gap: 9px;
color: #8ec4d0;
font-size: 11px;
font-weight: 800;
letter-spacing: 0.16em;
text-transform: uppercase;
}
.eyebrow::before {
width: 25px;
height: 2px;
content: "";
background: #62cddd;
box-shadow: 0 0 12px rgba(98, 205, 221, 0.65);
}
h1 {
max-width: 410px;
margin: 13px 0 9px;
font-size: clamp(29px, 3.3vw, 47px);
font-weight: 750;
line-height: 1.02;
letter-spacing: -0.045em;
}
#title-block p {
max-width: 390px;
margin: 0;
color: var(--muted);
font-size: 13px;
line-height: 1.55;
}
.fixed-badge {
display: inline-flex;
align-items: center;
gap: 7px;
margin-top: 15px;
padding: 7px 10px;
border: 1px solid rgba(110, 216, 187, 0.2);
border-radius: 999px;
background: rgba(29, 83, 70, 0.2);
color: #9be4c9;
font-size: 10px;
font-weight: 800;
letter-spacing: 0.1em;
text-transform: uppercase;
}
.fixed-badge::before {
width: 6px;
height: 6px;
border-radius: 50%;
content: "";
background: #68d9ac;
box-shadow: 0 0 10px rgba(104, 217, 172, 0.65);
}
#right-rail {
position: absolute;
top: 26px;
right: 26px;
display: grid;
width: 306px;
gap: 12px;
}
.panel {
padding: 17px;
overflow: hidden;
border: 1px solid var(--panel-border);
border-radius: 16px;
background:
linear-gradient(145deg, rgba(19, 34, 45, 0.72), transparent 58%),
var(--panel);
box-shadow: 0 18px 45px rgba(0, 0, 0, 0.22);
backdrop-filter: blur(14px);
}
.panel-kicker {
display: flex;
align-items: center;
gap: 8px;
margin-bottom: 14px;
color: #c1d7dd;
font-size: 10px;
font-weight: 800;
letter-spacing: 0.13em;
text-transform: uppercase;
}
.panel-kicker::before {
width: 6px;
height: 6px;
border-radius: 2px;
content: "";
background: var(--accent);
box-shadow: 0 0 10px rgba(var(--accent-rgb), 0.65);
}
.timer-body {
display: grid;
grid-template-columns: 88px 1fr;
align-items: center;
gap: 15px;
}
.timer-dial {
--progress: 0;
position: relative;
display: grid;
width: 88px;
height: 88px;
place-items: center;
border-radius: 50%;
background: conic-gradient(
var(--accent) calc(var(--progress) * 1%),
rgba(255, 255, 255, 0.09) 0
);
box-shadow: 0 0 28px rgba(var(--accent-rgb), 0.08);
}
.timer-dial::before {
position: absolute;
inset: 7px;
border: 1px solid rgba(255, 255, 255, 0.07);
border-radius: 50%;
content: "";
background: #0b151e;
}
.dial-center {
position: relative;
z-index: 1;
text-align: center;
}
#timer-time {
display: block;
font-size: 20px;
font-variant-numeric: tabular-nums;
font-weight: 750;
letter-spacing: -0.03em;
}
.dial-center small {
color: var(--muted);
font-size: 8px;
font-weight: 700;
letter-spacing: 0.12em;
text-transform: uppercase;
}
#stage-name {
display: block;
margin-bottom: 3px;
font-size: 16px;
}
#timer-meta {
color: var(--muted);
font-size: 10px;
font-variant-numeric: tabular-nums;
}
.stage-list {
display: flex;
justify-content: space-between;
margin-top: 12px;
}
.stage-list span {
position: relative;
padding-top: 10px;
color: #607681;
font-size: 8px;
font-weight: 750;
letter-spacing: 0.04em;
text-align: center;
text-transform: uppercase;
}
.stage-list span::before {
position: absolute;
top: 0;
left: 50%;
width: 5px;
height: 5px;
border: 1px solid #506670;
border-radius: 50%;
content: "";
background: #101c25;
transform: translateX(-50%);
}
.stage-list span.passed {
color: #a6bbc2;
}
.stage-list span.passed::before,
.stage-list span.current::before {
border-color: var(--accent);
background: var(--accent);
box-shadow: 0 0 8px rgba(var(--accent-rgb), 0.6);
}
.stage-list span.current {
color: var(--accent);
}
.disclaimer {
margin: 13px 0 0;
color: #728993;
font-size: 9px;
line-height: 1.45;
}
.bond-heading {
display: flex;
align-items: end;
justify-content: space-between;
gap: 15px;
}
#bond-state {
font-size: 15px;
line-height: 1.2;
}
.bond-number {
color: var(--accent);
font-size: 27px;
font-variant-numeric: tabular-nums;
font-weight: 750;
letter-spacing: -0.05em;
white-space: nowrap;
}
.bond-number small {
margin-left: 2px;
color: var(--muted);
font-size: 12px;
letter-spacing: 0;
}
.bond-meter {
height: 7px;
margin-top: 15px;
overflow: hidden;
border-radius: 99px;
background: rgba(255, 255, 255, 0.08);
}
#bond-fill {
width: 0;
height: 100%;
border-radius: inherit;
background: var(--accent);
box-shadow: 0 0 14px rgba(var(--accent-rgb), 0.55);
transition: width 80ms linear;
}
.bond-foot {
display: flex;
justify-content: space-between;
margin-top: 8px;
color: #718892;
font-size: 9px;
font-weight: 700;
letter-spacing: 0.05em;
text-transform: uppercase;
}
#controls {
position: absolute;
bottom: 24px;
left: 50%;
display: flex;
align-items: center;
gap: 8px;
padding: 9px;
border: 1px solid var(--panel-border);
border-radius: 14px;
background: rgba(8, 17, 24, 0.87);
box-shadow: 0 16px 42px rgba(0, 0, 0, 0.28);
pointer-events: auto;
transform: translateX(-50%);
backdrop-filter: blur(12px);
}
button,
.speed-control {
min-height: 35px;
border: 1px solid rgba(159, 201, 211, 0.16);
border-radius: 9px;
background: rgba(255, 255, 255, 0.055);
color: #d7e8ed;
}
button {
min-width: 78px;
padding: 0 13px;
cursor: pointer;
font-size: 11px;
font-weight: 750;
transition: background 150ms ease, border-color 150ms ease;
}
button:hover {
border-color: rgba(var(--accent-rgb), 0.5);
background: rgba(var(--accent-rgb), 0.11);
}
button:focus-visible,
select:focus-visible,
canvas:focus-visible {
outline: 2px solid var(--accent);
outline-offset: 2px;
}
.speed-control {
display: flex;
align-items: center;
gap: 8px;
padding: 0 8px 0 11px;
color: var(--muted);
font-size: 10px;
font-weight: 700;
text-transform: uppercase;
}
select {
min-height: 27px;
border: 0;
border-radius: 6px;
outline: none;
background: #13232d;
color: #e2eff2;
cursor: pointer;
font-size: 11px;
}
.view-hint {
padding: 0 8px 0 5px;
color: #6f858f;
font-size: 9px;
white-space: nowrap;
}
@media (max-width: 800px) {
#title-block {
top: 17px;
left: 17px;
width: calc(100vw - 34px);
}
#title-block p {
display: none;
}
h1 {
max-width: 320px;
margin-top: 9px;
font-size: 29px;
}
.fixed-badge {
margin-top: 10px;
}
#right-rail {
top: auto;
right: 12px;
bottom: 82px;
width: 270px;
}
.panel {
padding: 13px;
}
.timer-body {
grid-template-columns: 72px 1fr;
gap: 11px;
}
.timer-dial {
width: 72px;
height: 72px;
}
#timer-time {
font-size: 17px;
}
#controls {
bottom: 12px;
width: calc(100vw - 24px);
justify-content: center;
}
.view-hint {
display: none;
}
}
@media (max-width: 480px) {
#right-rail {
right: 10px;
bottom: 76px;
width: calc(100vw - 20px);
grid-template-columns: 1fr 1fr;
gap: 8px;
}
.panel {
padding: 11px;
}
.panel-kicker {
margin-bottom: 10px;
font-size: 8px;
}
.timer-body {
display: block;
}
.timer-dial {
width: 62px;
height: 62px;
margin-bottom: 9px;
}
.stage-list {
display: none;
}
#stage-name {
font-size: 12px;
}
.bond-heading {
display: block;
}
.bond-number {
display: block;
margin-top: 6px;
font-size: 22px;
}
.bond-foot {
display: none;
}
.disclaimer {
display: none;
}
}
</style>
</head>
<body>
<main
id="viewport"
aria-label="Interactive low-poly illustration of two aligned strips held in a clamp"
></main>
<div class="hud">
<header id="title-block">
<div class="eyebrow">Joinery study / 01</div>
<h1>Glue joint,<br />under pressure.</h1>
<p>
Two aligned composite strips remain fixed in a C-clamp while an
illustrative curing sequence advances.
</p>
<div class="fixed-badge">Fixed geometry · indicator only</div>
</header>
<aside id="right-rail">
<section class="panel" aria-labelledby="timer-heading">
<div class="panel-kicker" id="timer-heading">
Illustrative curing timer
</div>
<div class="timer-body">
<div
class="timer-dial"
id="timer-dial"
role="progressbar"
aria-label="Illustrative curing progress"
aria-valuemin="0"
aria-valuemax="100"
aria-valuenow="0"
>
<div class="dial-center">
<span id="timer-time">01:00</span>
<small>remaining</small>
</div>
</div>
<div>
<strong id="stage-name">Applied</strong>
<div id="timer-meta">00:00 elapsed / 01:00</div>
<div class="stage-list" aria-hidden="true">
<span class="current" data-stage="0">Apply</span>
<span data-stage="1">Wet</span>
<span data-stage="2">Set</span>
<span data-stage="3">Green</span>
<span data-stage="4">Cured</span>
</div>
</div>
</div>
<p class="disclaimer">
Accelerated visual sequence only. This is not a material cure-time
specification or a prediction of real bond strength.
</p>
</section>
<section class="panel" aria-labelledby="bond-heading">
<div class="panel-kicker" id="bond-heading">
Bond indicator
</div>
<div class="bond-heading">
<strong id="bond-state">Fresh application</strong>
<div class="bond-number">
<span id="bond-value">0</span><small>%</small>
</div>
</div>
<div class="bond-meter" aria-hidden="true">
<div id="bond-fill"></div>
</div>
<div class="bond-foot">
<span>Illustrative strength</span>
<span>Geometry fixed</span>
</div>
</section>
</aside>
<nav id="controls" aria-label="Timer controls">
<button id="toggle-button" type="button">Pause</button>
<button id="reset-button" type="button">Restart</button>
<label class="speed-control">
Rate
<select id="speed-select" aria-label="Timer rate">
<option value="1">1×</option>
<option value="2">2×</option>
<option value="4">4×</option>
<option value="8">8×</option>
</select>
</label>
<span class="view-hint">Drag to orbit · wheel or pinch to zoom</span>
</nav>
</div>
<script type="module">
import * as THREE from
"https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
// -------------------------------------------------------------------------
// Renderer, scene and camera
// -------------------------------------------------------------------------
const viewport = document.getElementById("viewport");
const scene = new THREE.Scene();
scene.background = new THREE.Color(0x071018);
scene.fog = new THREE.Fog(0x071018, 16, 34);
const camera = new THREE.PerspectiveCamera(
42,
window.innerWidth / window.innerHeight,
0.1,
100
);
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.12;
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
renderer.domElement.tabIndex = 0;
renderer.domElement.setAttribute(
"aria-label",
"3D glued joint. Drag to orbit, use the wheel or pinch gesture to zoom."
);
viewport.appendChild(renderer.domElement);
const orbit = {
theta: 0.72,
phi: 1.02,
radius: window.innerWidth < 800 ? 14 : 11.5,
target: new THREE.Vector3(0, 0.48, 0)
};
function applyCamera() {
const sinPhi = Math.sin(orbit.phi);
const cosPhi = Math.cos(orbit.phi);
camera.position.set(
orbit.target.x + orbit.radius * sinPhi * Math.sin(orbit.theta),
orbit.target.y + orbit.radius * cosPhi,
orbit.target.z + orbit.radius * sinPhi * Math.cos(orbit.theta)
);
camera.lookAt(orbit.target);
}
function resetView() {
orbit.theta = 0.72;
orbit.phi = 1.02;
orbit.radius = window.innerWidth < 800 ? 14 : 11.5;
applyCamera();
}
applyCamera();
// Direct camera controls: no examples/addons are used.
const activePointers = new Map();
let pinchDistance = 0;
function pointerDistance() {
if (activePointers.size < 2) return 0;
const points = [...activePointers.values()];
return Math.hypot(
points[0].x - points[1].x,
points[0].y - points[1].y
);
}
renderer.domElement.addEventListener("pointerdown", (event) => {
activePointers.set(event.pointerId, {
x: event.clientX,
y: event.clientY
});
renderer.domElement.setPointerCapture(event.pointerId);
pinchDistance = pointerDistance();
});
renderer.domElement.addEventListener("pointermove", (event) => {
if (!activePointers.has(event.pointerId)) return;
const previous = activePointers.get(event.pointerId);
activePointers.set(event.pointerId, {
x: event.clientX,
y: event.clientY
});
if (activePointers.size === 1) {
orbit.theta -= (event.clientX - previous.x) * 0.006;
orbit.phi = THREE.MathUtils.clamp(
orbit.phi - (event.clientY - previous.y) * 0.005,
0.38,
1.42
);
} else {
const nextDistance = pointerDistance();
if (pinchDistance > 0 && nextDistance > 0) {
orbit.radius = THREE.MathUtils.clamp(
orbit.radius * (pinchDistance / nextDistance),
7.5,
20
);
}
pinchDistance = nextDistance;
}
applyCamera();
});
function releasePointer(event) {
activePointers.delete(event.pointerId);
pinchDistance = pointerDistance();
}
renderer.domElement.addEventListener("pointerup", releasePointer);
renderer.domElement.addEventListener("pointercancel", releasePointer);
renderer.domElement.addEventListener(
"wheel",
(event) => {
event.preventDefault();
orbit.radius = THREE.MathUtils.clamp(
orbit.radius + event.deltaY * 0.009,
7.5,
20
);
applyCamera();
},
{ passive: false }
);
renderer.domElement.addEventListener("dblclick", resetView);
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 = THREE.MathUtils.clamp(orbit.phi - 0.06, 0.38, 1.42);
break;
case "ArrowDown":
orbit.phi = THREE.MathUtils.clamp(orbit.phi + 0.06, 0.38, 1.42);
break;
case "+":
case "=":
orbit.radius = Math.max(7.5, orbit.radius - 0.6);
break;
case "-":
orbit.radius = Math.min(20, orbit.radius + 0.6);
break;
case "0":
resetView();
break;
default:
handled = false;
}
if (handled) {
event.preventDefault();
applyCamera();
}
});
// -------------------------------------------------------------------------
// Lighting and ground
// -------------------------------------------------------------------------
const hemisphere = new THREE.HemisphereLight(0xa8dff1, 0x261b16, 1.65);
scene.add(hemisphere);
const keyLight = new THREE.DirectionalLight(0xffefcf, 3.1);
keyLight.position.set(4.5, 8, 5.5);
keyLight.castShadow = true;
keyLight.shadow.mapSize.set(2048, 2048);
keyLight.shadow.camera.left = -8;
keyLight.shadow.camera.right = 8;
keyLight.shadow.camera.top = 7;
keyLight.shadow.camera.bottom = -7;
keyLight.shadow.camera.near = 1;
keyLight.shadow.camera.far = 26;
keyLight.shadow.bias = -0.0003;
scene.add(keyLight);
const rimLight = new THREE.DirectionalLight(0x52bddd, 1.25);
rimLight.position.set(-5, 3.5, -5);
scene.add(rimLight);
const ground = new THREE.Mesh(
new THREE.PlaneGeometry(50, 50),
new THREE.MeshStandardMaterial({
color: 0x09131b,
roughness: 1,
metalness: 0
})
);
ground.rotation.x = -Math.PI / 2;
ground.position.y = -0.325;
ground.receiveShadow = true;
scene.add(ground);
const grid = new THREE.GridHelper(
32,
32,
0x365361,
0x1a2d38
);
grid.position.y = -0.318;
grid.material.transparent = true;
grid.material.opacity = 0.28;
scene.add(grid);
// -------------------------------------------------------------------------
// Low-poly geometry helpers
// -------------------------------------------------------------------------
const world = new THREE.Group();
scene.add(world);
function makeBox(
parent,
size,
position,
material,
outlined = false,
outlineColor = 0x061018
) {
const mesh = new THREE.Mesh(
new THREE.BoxGeometry(size[0], size[1], size[2]),
material
);
mesh.position.set(position[0], position[1], position[2]);
mesh.castShadow = true;
mesh.receiveShadow = true;
parent.add(mesh);
if (outlined) {
const edges = new THREE.LineSegments(
new THREE.EdgesGeometry(mesh.geometry),
new THREE.LineBasicMaterial({
color: outlineColor,
transparent: true,
opacity: 0.55
})
);
mesh.add(edges);
}
return mesh;
}
function makeLabelSprite(text, accent) {
const canvas = document.createElement("canvas");
canvas.width = 512;
canvas.height = 128;
const context = canvas.getContext("2d");
context.beginPath();
context.moveTo(22, 12);
context.lineTo(490, 12);
context.quadraticCurveTo(506, 12, 506, 28);
context.lineTo(506, 100);
context.quadraticCurveTo(506, 116, 490, 116);
context.lineTo(22, 116);
context.quadraticCurveTo(6, 116, 6, 100);
context.lineTo(6, 28);
context.quadraticCurveTo(6, 12, 22, 12);
context.closePath();
context.fillStyle = "rgba(7, 16, 24, 0.88)";
context.fill();
context.lineWidth = 3;
context.strokeStyle = accent;
context.stroke();
context.fillStyle = "#e9f6f8";
context.font = "700 35px system-ui, sans-serif";
context.textAlign = "center";
context.textBaseline = "middle";
context.fillText(text, 256, 65);
const texture = new THREE.CanvasTexture(canvas);
texture.colorSpace = THREE.SRGBColorSpace;
texture.minFilter = THREE.LinearFilter;
const sprite = new THREE.Sprite(
new THREE.SpriteMaterial({
map: texture,
transparent: true,
depthTest: false,
depthWrite: false
})
);
sprite.scale.set(2.3, 0.575, 1);
sprite.renderOrder = 10;
return sprite;
}
// -------------------------------------------------------------------------
// Aligned strips
// -------------------------------------------------------------------------
const stripSideA = new THREE.MeshStandardMaterial({
color: 0x227f94,
roughness: 0.76,
metalness: 0.04,
flatShading: true
});
const stripTopA = new THREE.MeshStandardMaterial({
color: 0x37a1b5,
roughness: 0.72,
metalness: 0.04,
flatShading: true
});
const stripSideB = new THREE.MeshStandardMaterial({
color: 0x376ca0,
roughness: 0.76,
metalness: 0.04,
flatShading: true
});
const stripTopB = new THREE.MeshStandardMaterial({
color: 0x468bc0,
roughness: 0.72,
metalness: 0.04,
flatShading: true
});
const stripEnd = new THREE.MeshStandardMaterial({
color: 0x86c6d0,
roughness: 0.88,
metalness: 0,
flatShading: true
});
const stripBottom = new THREE.MeshStandardMaterial({
color: 0x163d49,
roughness: 0.9,
metalness: 0,
flatShading: true
});
const stripMaterialsA = [
stripEnd,
stripEnd,
stripTopA,
stripBottom,
stripSideA,
stripSideA
];
const stripMaterialsB = [
stripEnd,
stripEnd,
stripTopB,
stripBottom,
stripSideB,
stripSideB
];
const stripA = makeBox(
world,
[4.8, 0.56, 1.45],
[-2.4, 0.28, 0],
stripMaterialsA,
true
);
const stripB = makeBox(
world,
[4.8, 0.56, 1.45],
[2.4, 0.28, 0],
stripMaterialsB,
true
);
stripA.name = "Aligned Strip A — stationary";
stripB.name = "Aligned Strip B — stationary";
const seamMaterial = new THREE.MeshStandardMaterial({
color: 0xff9f43,
emissive: 0x5e2d05,
emissiveIntensity: 0.55,
roughness: 0.48,
metalness: 0,
flatShading: true
});
const seam = makeBox(
world,
[0.11, 0.575, 1.47],
[0, 0.28, 0],
seamMaterial
);
seam.name = "Illustrative bond indicator";
// Small alignment marks emphasize that the strips meet at the same line.
const markMaterial = new THREE.MeshStandardMaterial({
color: 0xd8f3f6,
roughness: 0.8,
metalness: 0
});
for (const x of [-0.42, 0.42]) {
makeBox(
world,
[0.035, 0.014, 0.24],
[x, 0.568, -0.47],
markMaterial
);
}
const labelA = makeLabelSprite("ALIGNED STRIP A", "#54c5d4");
labelA.position.set(-2.65, 1.02, 0.9);
world.add(labelA);
const labelB = makeLabelSprite("ALIGNED STRIP B", "#68aee3");
labelB.position.set(2.65, 1.02, 0.9);
world.add(labelB);
// -------------------------------------------------------------------------
// Stationary low-poly C-clamp
// -------------------------------------------------------------------------
const clamp = new THREE.Group();
clamp.name = "Stationary C-clamp";
world.add(clamp);
const clampMaterial = new THREE.MeshStandardMaterial({
color: 0xd99a27,
roughness: 0.52,
metalness: 0.22,
flatShading: true
});
const clampDarkMaterial = new THREE.MeshStandardMaterial({
color: 0x76501d,
roughness: 0.62,
metalness: 0.28,
flatShading: true
});
const rubberMaterial = new THREE.MeshStandardMaterial({
color: 0x172128,
roughness: 0.95,
metalness: 0
});
makeBox(
clamp,
[0.82, 0.24, 2.86],
[0, -0.16, -0.16],
clampMaterial,
true,
0x53370d
);
makeBox(
clamp,
[0.82, 1.98, 0.34],
[0, 0.78, -1.43],
clampMaterial,
true,
0x53370d
);
makeBox(
clamp,
[0.82, 0.30, 2.74],
[0, 1.62, -0.05],
clampMaterial,
true,
0x53370d
);
makeBox(
clamp,
[0.86, 0.07, 1.52],
[0, -0.035, 0],
rubberMaterial
);
const screw = new THREE.Mesh(
new THREE.CylinderGeometry(0.105, 0.105, 0.72, 8),
clampDarkMaterial
);
screw.position.set(0, 1.11, 0.28);
screw.castShadow = true;
clamp.add(screw);
const pressurePad = new THREE.Mesh(
new THREE.CylinderGeometry(0.30, 0.30, 0.16, 8),
clampDarkMaterial
);
pressurePad.position.set(0, 0.64, 0.28);
pressurePad.castShadow = true;
clamp.add(pressurePad);
const pressureFace = new THREE.Mesh(
new THREE.CylinderGeometry(0.255, 0.255, 0.035, 8),
rubberMaterial
);
pressureFace.position.set(0, 0.55, 0.28);
clamp.add(pressureFace);
const hexNut = new THREE.Mesh(
new THREE.CylinderGeometry(0.19, 0.19, 0.13, 6),
clampDarkMaterial
);
hexNut.position.set(0, 0.79, 0.28);
hexNut.castShadow = true;
clamp.add(hexNut);
makeBox(
clamp,
[0.66, 0.075, 0.085],
[0, 0.79, 0.28],
clampDarkMaterial
);
// -------------------------------------------------------------------------
// Illustrative curing state
// -------------------------------------------------------------------------
const duration = 60;
let elapsed = 0;
let playing = true;
let playbackRate = 1;
const timerDial = document.getElementById("timer-dial");
const timerTime = document.getElementById("timer-time");
const timerMeta = document.getElementById("timer-meta");
const stageName = document.getElementById("stage-name");
const bondState = document.getElementById("bond-state");
const bondValue = document.getElementById("bond-value");
const bondFill = document.getElementById("bond-fill");
const toggleButton = document.getElementById("toggle-button");
const resetButton = document.getElementById("reset-button");
const speedSelect = document.getElementById("speed-select");
const stageElements = [
...document.querySelectorAll("[data-stage]")
];
const colorStops = [
{ at: 0.0, color: new THREE.Color(0xff9f43) },
{ at: 0.3, color: new THREE.Color(0xe5d35b) },
{ at: 0.65, color: new THREE.Color(0x51d2d1) },
{ at: 1.0, color: new THREE.Color(0x62e58b) }
];
const bondPoints = [
{ at: 0.0, value: 0, label: "Fresh application" },
{ at: 0.08, value: 8, label: "Fresh application" },
{ at: 0.28, value: 30, label: "Wetting / leveling" },
{ at: 0.62, value: 66, label: "Setting" },
{ at: 0.88, value: 91, label: "Green strength" },
{ at: 1.0, value: 100, label: "Cured — illustrative" }
];
const stageDefinitions = [
{ at: 0.0, name: "Applied" },
{ at: 0.1, name: "Wetting" },
{ at: 0.3, name: "Setting" },
{ at: 0.62, name: "Green strength" },
{ at: 0.92, name: "Cured — illustrative" }
];
function formatClock(totalSeconds) {
const seconds = Math.max(0, Math.floor(totalSeconds));
const minutes = Math.floor(seconds / 60);
const remainder = seconds % 60;
return (
String(minutes).padStart(2, "0") +
":" +
String(remainder).padStart(2, "0")
);
}
function interpolateBond(progress) {
for (let i = 0; i < bondPoints.length - 1; i++) {
const current = bondPoints[i];
const next = bondPoints[i + 1];
if (progress <= next.at) {
const local =
(progress - current.at) / (next.at - current.at);
return {
value: THREE.MathUtils.lerp(
current.value,
next.value,
Math.max(0, Math.min(1, local))
),
label:
local < 0.5 ? current.label : next.label
};
}
}
return {
value: bondPoints[bondPoints.length - 1].value,
label: bondPoints[bondPoints.length - 1].label
};
}
function indicatorColor(progress) {
for (let i = 0; i < colorStops.length - 1; i++) {
const current = colorStops[i];
const next = colorStops[i + 1];
if (progress <= next.at) {
const local =
(progress - current.at) / (next.at - current.at);
return current.color.clone().lerp(
next.color,
Math.max(0, Math.min(1, local))
);
}
}
return colorStops[colorStops.length - 1].color.clone();
}
function syncToggleButton() {
if (elapsed >= duration) {
toggleButton.textContent = "Replay";
} else {
toggleButton.textContent = playing ? "Pause" : "Resume";
}
}
function updateReadouts() {
const progress = THREE.MathUtils.clamp(elapsed / duration, 0, 1);
const remaining = Math.max(0, Math.ceil(duration - elapsed));
const bond = interpolateBond(progress);
const displayColor = indicatorColor(progress);
// Only the indicator material changes. No strip, clamp or joint transforms
// are modified, so the physical assembly remains stationary.
seamMaterial.color.copy(displayColor);
seamMaterial.emissive.copy(displayColor).multiplyScalar(0.28);
const hexColor = `#${displayColor.getHexString()}`;
const rgb = displayColor
.clone()
.convertLinearToSRGB()
.getHexString();
document.documentElement.style.setProperty("--accent", hexColor);
document.documentElement.style.setProperty(
"--accent-rgb",
String(
parseInt(rgb.slice(0, 2), 16) +
"," +
parseInt(rgb.slice(2, 4), 16) +
"," +
parseInt(rgb.slice(4, 6), 16)
)
);
timerDial.style.setProperty("--progress", progress.toFixed(5));
timerDial.setAttribute(
"aria-valuenow",
String(Math.round(progress * 100))
);
timerTime.textContent = formatClock(remaining);
timerMeta.textContent =
`${formatClock(elapsed)} elapsed / ${formatClock(duration)}`;
bondState.textContent = bond.label;
bondValue.textContent = String(Math.round(bond.value));
bondFill.style.width = `${bond.value.toFixed(2)}%`;
let currentStage = 0;
for (let i = 0; i < stageDefinitions.length; i++) {
if (progress >= stageDefinitions[i].at) {
currentStage = i;
}
}
stageName.textContent = stageDefinitions[currentStage].name;
stageElements.forEach((element, index) => {
element.classList.toggle("passed", index < currentStage);
element.classList.toggle("current", index === currentStage);
});
}
toggleButton.addEventListener("click", () => {
if (elapsed >= duration) {
elapsed = 0;
playing = true;
} else {
playing = !playing;
}
syncToggleButton();
updateReadouts();
});
resetButton.addEventListener("click", () => {
elapsed = 0;
playing = true;
syncToggleButton();
updateReadouts();
});
speedSelect.addEventListener("change", () => {
playbackRate = Number(speedSelect.value);
});
// -------------------------------------------------------------------------
// Resize and animation loop
// -------------------------------------------------------------------------
window.addEventListener("resize", () => {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.setSize(window.innerWidth, window.innerHeight);
});
let previousTime = performance.now();
function animate(now) {
const delta = Math.min((now - previousTime) / 1000, 0.05);
previousTime = now;
if (playing) {
elapsed = Math.min(duration, elapsed + delta * playbackRate);
if (elapsed >= duration) {
playing = false;
syncToggleButton();
}
}
updateReadouts();
renderer.render(scene, camera);
requestAnimationFrame(animate);
}
syncToggleButton();
updateReadouts();
requestAnimationFrame(animate);
</script>
</body>
</html>
```