Prompt specification
Build or customize the Three.js 3D scene "Precision and power grip comparison" 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: Precision and power grip comparison
Category: Biology & Nature · Style: Procedural Solid / Shader 3D
License: MIT · Reference: https://three3d.app/scene/precision-and-power-grip-comparison-x0986
Scene Description Prompt:
Make a cutaway Three.js scene in a self-contained HTML file using cdnjs: precision and power grip comparison. Place two simplified hands holding a small bead and a broad tool handle; show distinct contact regions and label the anatomy and proportions schematic.
Working Three.js Starter (precision-and-power-grip-comparison-x0986):
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Precision vs. Power Grip — Cutaway Comparison</title>
<style>
:root {
color-scheme: dark;
--bg: #07111a;
--panel: rgba(9, 24, 35, 0.78);
--line: rgba(180, 215, 230, 0.2);
--text: #e7f2f5;
--muted: #91aab6;
--cyan: #5ce7f2;
--amber: #ffb45b;
}
* {
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: var(--bg);
font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
"Segoe UI", sans-serif;
color: var(--text);
}
canvas {
position: fixed;
inset: 0;
display: block;
width: 100%;
height: 100%;
touch-action: none;
}
.hud {
position: fixed;
inset: 0;
z-index: 2;
pointer-events: none;
}
.header {
position: absolute;
top: 26px;
left: 32px;
right: 32px;
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 24px;
}
.eyebrow {
margin-bottom: 8px;
color: var(--cyan);
font-size: 11px;
font-weight: 750;
letter-spacing: 0.2em;
text-transform: uppercase;
}
h1 {
margin: 0;
font-size: clamp(22px, 3vw, 40px);
font-weight: 680;
letter-spacing: -0.035em;
line-height: 1.04;
}
.subtitle {
max-width: 680px;
margin: 10px 0 0;
color: var(--muted);
font-size: 13px;
line-height: 1.55;
}
.controls {
display: flex;
flex-wrap: wrap;
justify-content: flex-end;
gap: 8px;
pointer-events: auto;
}
button {
appearance: none;
border: 1px solid var(--line);
border-radius: 999px;
padding: 9px 14px;
color: var(--text);
background: rgba(13, 30, 42, 0.82);
font: inherit;
font-size: 12px;
cursor: pointer;
backdrop-filter: blur(12px);
transition: border-color 160ms ease, background 160ms ease, color 160ms ease;
}
button:hover {
border-color: rgba(92, 231, 242, 0.7);
color: white;
background: rgba(20, 47, 62, 0.9);
}
button[aria-pressed="true"] {
border-color: rgba(92, 231, 242, 0.8);
color: var(--cyan);
background: rgba(27, 73, 88, 0.86);
}
.section-title {
position: absolute;
top: 134px;
width: 280px;
text-align: center;
pointer-events: none;
}
.section-title.left {
left: calc(50% - 425px);
}
.section-title.right {
left: calc(50% + 145px);
}
.section-title .number {
display: block;
margin-bottom: 5px;
font-size: 11px;
letter-spacing: 0.16em;
font-weight: 800;
text-transform: uppercase;
}
.section-title.left .number {
color: var(--cyan);
}
.section-title.right .number {
color: var(--amber);
}
.section-title strong {
display: block;
font-size: 19px;
font-weight: 660;
letter-spacing: -0.02em;
}
.section-title small {
display: block;
margin-top: 5px;
color: var(--muted);
font-size: 11px;
}
.callout {
position: absolute;
top: 0;
left: 0;
min-width: 116px;
max-width: 190px;
padding: 9px 11px;
border: 1px solid rgba(158, 195, 211, 0.22);
border-radius: 9px;
background: rgba(7, 20, 29, 0.88);
box-shadow: 0 10px 32px rgba(0, 0, 0, 0.2);
backdrop-filter: blur(10px);
will-change: transform;
transition: opacity 120ms linear;
}
.callout::before {
content: "";
position: absolute;
top: 50%;
width: 24px;
height: 1px;
background: rgba(173, 207, 221, 0.48);
}
.callout.left::before {
right: calc(100% + 6px);
}
.callout.right::before {
left: calc(100% + 6px);
}
.callout strong {
display: block;
font-size: 11px;
font-weight: 720;
letter-spacing: 0.02em;
}
.callout span {
display: block;
margin-top: 3px;
color: var(--muted);
font-size: 10px;
line-height: 1.35;
}
.callout.cyan {
border-color: rgba(92, 231, 242, 0.38);
}
.callout.cyan strong {
color: var(--cyan);
}
.callout.amber {
border-color: rgba(255, 180, 91, 0.42);
}
.callout.amber strong {
color: var(--amber);
}
.bottom {
position: absolute;
left: 32px;
right: 32px;
bottom: 22px;
display: grid;
grid-template-columns: minmax(220px, 1fr) minmax(440px, 1.55fr) minmax(220px, 1fr);
align-items: end;
gap: 18px;
}
.spec,
.instruction {
color: var(--muted);
font-size: 10px;
line-height: 1.55;
}
.instruction {
text-align: right;
}
.instruction b {
color: var(--text);
font-weight: 650;
}
.comparison {
display: grid;
grid-template-columns: 1fr 1fr;
overflow: hidden;
border: 1px solid var(--line);
border-radius: 14px;
background: rgba(7, 19, 28, 0.78);
backdrop-filter: blur(14px);
}
.comparison article {
padding: 14px 17px;
}
.comparison article + article {
border-left: 1px solid var(--line);
}
.comparison h2 {
margin: 0 0 7px;
font-size: 12px;
font-weight: 780;
letter-spacing: 0.08em;
text-transform: uppercase;
}
.comparison article:first-child h2 {
color: var(--cyan);
}
.comparison article:last-child h2 {
color: var(--amber);
}
.comparison p {
margin: 0;
color: var(--muted);
font-size: 11px;
line-height: 1.5;
}
.metric {
display: flex;
gap: 8px;
margin-top: 9px;
color: #c7d8df;
font-size: 10px;
}
.metric::before {
content: "";
width: 5px;
height: 5px;
flex: 0 0 auto;
margin-top: 4px;
border-radius: 50%;
background: currentColor;
}
.comparison article:first-child .metric {
color: var(--cyan);
}
.comparison article:last-child .metric {
color: var(--amber);
}
@media (max-width: 900px) {
.header {
top: 18px;
left: 18px;
right: 18px;
}
.subtitle {
max-width: 460px;
}
.section-title {
top: 126px;
width: 210px;
}
.section-title.left {
left: 8px;
}
.section-title.right {
left: auto;
right: 8px;
}
.bottom {
left: 14px;
right: 14px;
bottom: 14px;
grid-template-columns: 1fr;
}
.spec,
.instruction {
display: none;
}
.callout {
min-width: 100px;
max-width: 150px;
padding: 7px 9px;
}
.callout span {
display: none;
}
}
@media (max-width: 600px) {
h1 {
font-size: 24px;
}
.subtitle,
.controls button span {
display: none;
}
.controls button {
padding: 8px 11px;
}
.section-title strong {
font-size: 15px;
}
.section-title small {
display: none;
}
.comparison {
grid-template-columns: 1fr;
}
.comparison article + article {
border-left: 0;
border-top: 1px solid var(--line);
}
}
</style>
</head>
<body>
<div class="hud">
<header class="header">
<div>
<div class="eyebrow">Biomechanics / Grip Anatomy</div>
<h1>Precision vs. Power Grip</h1>
<p class="subtitle">
A cutaway comparison of localized fingertip control versus broad,
load-bearing palmar contact.
</p>
</div>
<div class="controls">
<button id="cutawayButton" type="button" aria-pressed="true">
Cutaway <span>on</span>
</button>
<button id="resetButton" type="button">
Reset <span>view</span>
</button>
</div>
</header>
<div class="section-title left">
<span class="number">01 / Focal contact</span>
<strong>Precision Grip</strong>
<small>Opposed fingertip pads</small>
</div>
<div class="section-title right">
<span class="number">02 / Enclosed contact</span>
<strong>Power Grip</strong>
<small>Wrapped digits + palm</small>
</div>
<div id="precisionIndex" class="callout cyan right">
<strong>Index distal pad</strong>
<span>Small, concentrated contact zone</span>
</div>
<div id="precisionThumb" class="callout cyan right">
<strong>Thumb pad</strong>
<span>Opposed to the index finger</span>
</div>
<div id="beadLabel" class="callout cyan right">
<strong>Small bead</strong>
<span>Precision object · exaggerated for clarity</span>
</div>
<div id="precisionAnatomy" class="callout cyan left">
<strong>Cutaway anatomy</strong>
<span>Skin shell, muscle mass, and phalanges</span>
</div>
<div id="powerPalm" class="callout amber left">
<strong>Broad palmar contact</strong>
<span>Load transferred through the palm</span>
</div>
<div id="powerFingers" class="callout amber right">
<strong>Wrapped finger pads</strong>
<span>Multiple contacts surround the handle</span>
</div>
<div id="handleLabel" class="callout amber right">
<strong>Broad tool handle</strong>
<span>Larger, stable grasp surface</span>
</div>
<div id="forearmLabel" class="callout amber left">
<strong>Cutaway forearm</strong>
<span>Schematic skin, muscle, and central bone</span>
</div>
<footer class="bottom">
<div class="spec">
<b>Schematic, not to anatomical scale.</b><br />
Object dimensions and tissue layers are exaggerated for comparison.
</div>
<div class="comparison">
<article>
<h2>Precision</h2>
<p>
A small object is stabilized between two localized pads, enabling
delicate placement and fine rotational control.
</p>
<div class="metric">High tactile resolution</div>
<div class="metric">Minimal contact area</div>
</article>
<article>
<h2>Power</h2>
<p>
The handle is enclosed by the fingers and palm, distributing force
across a larger surface for stability and resistance.
</p>
<div class="metric">High force transfer</div>
<div class="metric">Large contact envelope</div>
</article>
</div>
<div class="instruction">
<b>Drag</b> to orbit · <b>Scroll / pinch</b> to zoom<br />
Anatomy and proportions are illustrative.
</div>
</footer>
</div>
<script type="module">
import * as THREE from "https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
// ---------------------------------------------------------------------
// Renderer and scene
// ---------------------------------------------------------------------
const scene = new THREE.Scene();
scene.background = new THREE.Color(0x07111a);
scene.fog = new THREE.Fog(0x07111a, 13, 25);
const camera = new THREE.PerspectiveCamera(
40,
window.innerWidth / window.innerHeight,
0.1,
60
);
const renderer = new THREE.WebGLRenderer({
antialias: true,
powerPreference: "high-performance"
});
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1.12;
document.body.prepend(renderer.domElement);
const hemi = new THREE.HemisphereLight(0xbfe7ff, 0x182029, 2.0);
scene.add(hemi);
const key = new THREE.DirectionalLight(0xf5fbff, 3.2);
key.position.set(-4, 9, 8);
key.castShadow = true;
key.shadow.mapSize.set(2048, 2048);
key.shadow.camera.left = -9;
key.shadow.camera.right = 9;
key.shadow.camera.top = 9;
key.shadow.camera.bottom = -7;
key.shadow.camera.near = 0.5;
key.shadow.camera.far = 25;
scene.add(key);
const cyanLight = new THREE.PointLight(0x42dce9, 18, 8, 2);
cyanLight.position.set(-2.6, 3.1, 4.0);
scene.add(cyanLight);
const amberLight = new THREE.PointLight(0xffa84d, 20, 8, 2);
amberLight.position.set(2.5, 2.8, 4.0);
scene.add(amberLight);
const fill = new THREE.DirectionalLight(0x7595b5, 1.0);
fill.position.set(6, 2, -5);
scene.add(fill);
// ---------------------------------------------------------------------
// Materials
// ---------------------------------------------------------------------
const skinMaterial = new THREE.MeshPhysicalMaterial({
color: 0xd49b7c,
roughness: 0.66,
metalness: 0.0,
transparent: true,
opacity: 0.54,
depthWrite: false,
side: THREE.DoubleSide
});
const skinRimMaterial = new THREE.MeshStandardMaterial({
color: 0xe6b092,
roughness: 0.68,
transparent: true,
opacity: 0.76
});
const muscleMaterial = new THREE.MeshStandardMaterial({
color: 0x9d3f52,
roughness: 0.78,
metalness: 0.0
});
const tendonMaterial = new THREE.MeshStandardMaterial({
color: 0xd4b2a0,
roughness: 0.7
});
const boneMaterial = new THREE.MeshStandardMaterial({
color: 0xe9dfc8,
roughness: 0.66,
metalness: 0.02
});
const cyanContactMaterial = new THREE.MeshStandardMaterial({
color: 0x5ce7f2,
emissive: 0x24c8d7,
emissiveIntensity: 2.3,
roughness: 0.38,
metalness: 0.08
});
const amberContactMaterial = new THREE.MeshStandardMaterial({
color: 0xffb45b,
emissive: 0xe87920,
emissiveIntensity: 2.0,
roughness: 0.42,
metalness: 0.05
});
const handleMaterial = new THREE.MeshStandardMaterial({
color: 0xba6735,
roughness: 0.72,
metalness: 0.08
});
const handleBandMaterial = new THREE.MeshStandardMaterial({
color: 0x3c2520,
roughness: 0.88
});
const beadMaterial = new THREE.MeshStandardMaterial({
color: 0xbde9ed,
roughness: 0.2,
metalness: 0.62,
emissive: 0x0b4b56,
emissiveIntensity: 0.35
});
const cyanLineMaterial = new THREE.LineBasicMaterial({
color: 0x5ce7f2,
transparent: true,
opacity: 0.72
});
const amberLineMaterial = new THREE.LineBasicMaterial({
color: 0xffb45b,
transparent: true,
opacity: 0.72
});
// ---------------------------------------------------------------------
// Reusable geometry helpers
// ---------------------------------------------------------------------
const V = (x = 0, y = 0, z = 0) => new THREE.Vector3(x, y, z);
const UP = V(0, 1, 0);
function ellipsoid(parent, position, scale, material) {
const mesh = new THREE.Mesh(
new THREE.SphereGeometry(1, 28, 18),
material
);
mesh.position.copy(position);
mesh.scale.copy(scale);
mesh.castShadow = !material.transparent;
mesh.receiveShadow = true;
parent.add(mesh);
return mesh;
}
function capsuleBetween(parent, a, b, radius, material) {
const direction = new THREE.Vector3().subVectors(b, a);
const length = direction.length();
const safeRadius = Math.min(radius, length * 0.42);
const cylinderLength = Math.max(length - 2 * safeRadius, 0.015);
const mesh = new THREE.Mesh(
new THREE.CapsuleGeometry(safeRadius, cylinderLength, 5, 14),
material
);
mesh.position.copy(a).add(b).multiplyScalar(0.5);
mesh.quaternion.setFromUnitVectors(UP, direction.normalize());
mesh.castShadow = !material.transparent;
parent.add(mesh);
return mesh;
}
function lineBetween(parent, a, b, material) {
const geometry = new THREE.BufferGeometry().setFromPoints([a, b]);
const line = new THREE.Line(geometry, material);
parent.add(line);
return line;
}
function makeDigit(parent, points, radii, showTendons = true) {
for (let i = 0; i < points.length - 1; i++) {
capsuleBetween(parent, points[i], points[i + 1], radii[i], skinMaterial);
// Exposed internal phalanx.
capsuleBetween(
parent,
points[i],
points[i + 1],
radii[i] * 0.28,
boneMaterial
);
if (showTendons) {
const tendonA = points[i].clone();
const tendonB = points[i + 1].clone();
tendonA.z -= radii[i] * 0.38;
tendonB.z -= radii[i + 1] * 0.38;
capsuleBetween(
parent,
tendonA,
tendonB,
radii[i] * 0.11,
tendonMaterial
);
}
}
points.forEach((point, index) => {
const radius = radii[Math.min(index, radii.length - 1)];
ellipsoid(parent, point, V(radius, radius, radius), skinMaterial);
});
}
function makeForearm(parent, colorRim = 0xe6b092) {
const rimMaterial = skinRimMaterial.clone();
rimMaterial.color.setHex(colorRim);
// Outer skin is a partial cylinder, leaving a front-facing cutaway.
const skinShell = new THREE.Mesh(
new THREE.CylinderGeometry(
0.38,
0.44,
1.05,
32,
1,
true,
0.62,
Math.PI * 1.55
),
skinMaterial
);
skinShell.position.y = 0.45;
parent.add(skinShell);
// Deeper muscle layer with a narrower opening.
const muscleCore = new THREE.Mesh(
new THREE.CylinderGeometry(
0.275,
0.31,
1.0,
28,
1,
true,
0.82,
Math.PI * 1.65
),
muscleMaterial
);
muscleCore.position.y = 0.45;
parent.add(muscleCore);
// Central skeletal element.
const coreBone = new THREE.Mesh(
new THREE.CylinderGeometry(0.085, 0.095, 1.04, 16),
boneMaterial
);
coreBone.position.y = 0.45;
parent.add(coreBone);
// Wrist edge rings suggest the sectioned tissue boundary.
[0.0, 0.91].forEach((y) => {
const ring = new THREE.Mesh(
new THREE.TorusGeometry(y < 0.1 ? 0.38 : 0.37, 0.018, 8, 40),
rimMaterial
);
ring.rotation.x = Math.PI / 2;
ring.position.y = y;
parent.add(ring);
});
}
function makePalm(parent, side = 0) {
const center = V(0, 1.72, 0);
// Translucent outer palm shell.
ellipsoid(
parent,
center,
V(0.78, 0.83, 0.31),
skinMaterial
);
// Cutaway muscle mass.
ellipsoid(
parent,
V(0, 1.72, -0.035),
V(0.61, 0.66, 0.19),
muscleMaterial
);
// Cut edge around the exposed palm window.
const curve = new THREE.EllipseCurve(
0,
1.72,
0.66,
0.69,
0,
Math.PI * 2,
false,
0
);
const points = curve.getPoints(72).map((p) => V(p.x, p.y, 0.285));
const edgeGeometry = new THREE.BufferGeometry().setFromPoints(points);
const edge = new THREE.LineLoop(
edgeGeometry,
side < 0 ? cyanLineMaterial : amberLineMaterial
);
edge.material = edge.material.clone();
edge.material.opacity = 0.48;
parent.add(edge);
// Metacarpal bones.
for (let i = 0; i < 4; i++) {
const x = -0.48 + i * 0.31;
capsuleBetween(
parent,
V(x, 2.25, 0.18),
V(x * 0.35, 1.12, 0.17),
0.047,
boneMaterial
);
}
capsuleBetween(
parent,
V(-0.22, 1.12, 0.17),
V(0.18, 1.12, 0.17),
0.075,
boneMaterial
);
}
// ---------------------------------------------------------------------
// Environment
// ---------------------------------------------------------------------
const floor = new THREE.Mesh(
new THREE.PlaneGeometry(30, 22),
new THREE.MeshStandardMaterial({
color: 0x08141e,
roughness: 0.92,
metalness: 0.04
})
);
floor.rotation.x = -Math.PI / 2;
floor.position.y = -0.37;
floor.receiveShadow = true;
scene.add(floor);
const grid = new THREE.GridHelper(24, 24, 0x294553, 0x152a36);
grid.position.y = -0.355;
grid.material.transparent = true;
grid.material.opacity = 0.28;
scene.add(grid);
function addBackdrop(x, tint) {
const panel = new THREE.Mesh(
new THREE.PlaneGeometry(4.8, 4.8),
new THREE.MeshBasicMaterial({
color: tint,
transparent: true,
opacity: 0.13,
depthWrite: false
})
);
panel.position.set(x, 2.05, -1.05);
scene.add(panel);
const ring = new THREE.Mesh(
new THREE.RingGeometry(1.55, 1.565, 80),
new THREE.MeshBasicMaterial({
color: tint,
transparent: true,
opacity: 0.11,
side: THREE.DoubleSide,
depthWrite: false
})
);
ring.position.set(x, 2.05, -1.0);
ring.scale.y = 1.12;
scene.add(ring);
}
addBackdrop(-3.05, 0x5ce7f2);
addBackdrop(2.45, 0xffb45b);
const divider = new THREE.Line(
new THREE.BufferGeometry().setFromPoints([
V(0.38, -0.25, -0.8),
V(0.38, 4.8, -0.8)
]),
new THREE.LineDashedMaterial({
color: 0x638494,
dashSize: 0.12,
gapSize: 0.15,
transparent: true,
opacity: 0.22
})
);
divider.computeLineDistances();
scene.add(divider);
// ---------------------------------------------------------------------
// Precision grip hand
// ---------------------------------------------------------------------
const precisionGroup = new THREE.Group();
precisionGroup.position.set(-3.1, 0, 0);
precisionGroup.rotation.set(-0.02, -0.08, -0.035);
scene.add(precisionGroup);
makeForearm(precisionGroup, 0xe6b092);
makePalm(precisionGroup, -1);
// Extended index finger approaching the bead.
const indexPoints = [
V(0.55, 2.26, 0.02),
V(0.68, 2.66, 0.16),
V(0.92, 2.86, 0.43),
V(1.28, 2.72, 0.70)
];
makeDigit(precisionGroup, indexPoints, [0.15, 0.135, 0.115, 0.09]);
// Opposing thumb.
const thumbPoints = [
V(-0.66, 1.49, 0.05),
V(-0.78, 2.0, 0.23),
V(-0.15, 2.40, 0.54),
V(1.15, 2.56, 0.72)
];
makeDigit(precisionGroup, thumbPoints, [0.18, 0.165, 0.14, 0.105]);
// Three flexed fingers behind the pinch.
makeDigit(
precisionGroup,
[
V(-0.1, 2.35, 0),
V(-0.08, 2.74, 0.1),
V(-0.22, 2.91, 0.36),
V(-0.14, 2.59, 0.58)
],
[0.155, 0.145, 0.125, 0.095]
);
makeDigit(
precisionGroup,
[
V(-0.38, 2.29, -0.02),
V(-0.45, 2.65, 0.05),
V(-0.57, 2.8, 0.27),
V(-0.48, 2.49, 0.5)
],
[0.145, 0.135, 0.115, 0.09]
);
makeDigit(
precisionGroup,
[
V(-0.62, 2.18, -0.04),
V(-0.72, 2.45, 0.01),
V(-0.79, 2.56, 0.18),
V(-0.69, 2.33, 0.4)
],
[0.125, 0.115, 0.1, 0.08]
);
// The precision object.
const bead = new THREE.Mesh(
new THREE.SphereGeometry(0.24, 40, 28),
beadMaterial
);
bead.position.set(1.39, 2.64, 0.80);
bead.castShadow = true;
precisionGroup.add(bead);
// Small cyan fingertip contact zones.
ellipsoid(
precisionGroup,
V(1.265, 2.72, 0.91),
V(0.10, 0.08, 0.035),
cyanContactMaterial
);
ellipsoid(
precisionGroup,
V(1.19, 2.56, 0.93),
V(0.095, 0.075, 0.035),
cyanContactMaterial
);
const precisionHalo = new THREE.Mesh(
new THREE.TorusGeometry(0.31, 0.012, 8, 64),
new THREE.MeshBasicMaterial({
color: 0x5ce7f2,
transparent: true,
opacity: 0.45,
depthWrite: false
})
);
precisionHalo.position.copy(bead.position);
precisionHalo.position.z += 0.05;
precisionGroup.add(precisionHalo);
// Schematic bead diameter marker.
lineBetween(
precisionGroup,
V(1.70, 2.64, 0.82),
V(1.70, 2.88, 0.82),
cyanLineMaterial
);
lineBetween(
precisionGroup,
V(1.64, 2.64, 0.82),
V(1.76, 2.64, 0.82),
cyanLineMaterial
);
lineBetween(
precisionGroup,
V(1.64, 2.88, 0.82),
V(1.76, 2.88, 0.82),
cyanLineMaterial
);
// ---------------------------------------------------------------------
// Power grip hand and broad handle
// ---------------------------------------------------------------------
const powerGroup = new THREE.Group();
powerGroup.position.set(2.45, 0, 0);
powerGroup.rotation.set(0.015, 0.07, 0.035);
scene.add(powerGroup);
makeForearm(powerGroup, 0xd9a17f);
makePalm(powerGroup, 1);
// Broad vertical handle.
const handle = new THREE.Mesh(
new THREE.CylinderGeometry(0.39, 0.43, 3.65, 36),
handleMaterial
);
handle.position.set(0, 2.24, 0.42);
handle.castShadow = true;
handle.receiveShadow = true;
powerGroup.add(handle);
// Grip bands emphasize the broad contact envelope.
[0.63, 1.18, 1.73, 2.28, 2.83, 3.38].forEach((y) => {
const band = new THREE.Mesh(
new THREE.TorusGeometry(0.405, 0.025, 8, 40),
handleBandMaterial
);
band.rotation.x = Math.PI / 2;
band.position.set(0, y, 0.42);
powerGroup.add(band);
});
const handleTop = new THREE.Mesh(
new THREE.CylinderGeometry(0.405, 0.405, 0.08, 36),
handleBandMaterial
);
handleTop.position.set(0, 4.095, 0.42);
powerGroup.add(handleTop);
// Four fingers curl from the palm around the front of the handle.
const powerFingerTips = [];
for (let i = 0; i < 4; i++) {
const rootX = -0.49 + i * 0.325;
const tipX = -0.32 + i * 0.215;
const points = [
V(rootX, 2.31, -0.02),
V(rootX * 0.93, 2.72, 0.15),
V(tipX, 2.74, 0.66),
V(tipX, 2.37, 0.86)
];
makeDigit(powerGroup, points, [0.16, 0.15, 0.13, 0.095]);
powerFingerTips.push(points[points.length - 1]);
const frontZ = 0.42 + Math.sqrt(Math.max(0.39 * 0.39 - tipX * tipX, 0.02));
const pad = ellipsoid(
powerGroup,
V(tipX, 2.37, frontZ + 0.035),
V(0.105, 0.22, 0.047),
amberContactMaterial
);
pad.rotation.y = -Math.asin(tipX / 0.39) * 0.65;
}
// Opposing thumb wraps around the opposite side of the handle.
const powerThumbPoints = [
V(-0.72, 1.63, -0.01),
V(-0.87, 2.08, 0.18),
V(-0.73, 2.45, 0.62),
V(-0.38, 2.49, 0.82)
];
makeDigit(
powerGroup,
powerThumbPoints,
[0.19, 0.18, 0.15, 0.11]
);
// Broad thumb pad.
const thumbPad = ellipsoid(
powerGroup,
V(-0.34, 2.45, 0.84),
V(0.17, 0.20, 0.055),
amberContactMaterial
);
thumbPad.rotation.z = -0.48;
// Broad palmar load zone behind the handle.
const palmContact = ellipsoid(
powerGroup,
V(0, 1.59, 0.25),
V(0.56, 0.55, 0.06),
amberContactMaterial
);
palmContact.material = amberContactMaterial.clone();
palmContact.material.transparent = true;
palmContact.material.opacity = 0.82;
// Handle width marker.
lineBetween(
powerGroup,
V(-0.43, 3.83, 0.42),
V(0.43, 3.83, 0.42),
amberLineMaterial
);
lineBetween(
powerGroup,
V(-0.43, 3.76, 0.42),
V(-0.43, 3.90, 0.42),
amberLineMaterial
);
lineBetween(
powerGroup,
V(0.43, 3.76, 0.42),
V(0.43, 3.90, 0.42),
amberLineMaterial
);
// ---------------------------------------------------------------------
// HTML callout projection
// ---------------------------------------------------------------------
const callouts = [];
function registerCallout(id, group, anchor, dx, dy, direction = "right") {
callouts.push({
element: document.getElementById(id),
group,
anchor: anchor.clone(),
dx,
dy,
direction
});
}
registerCallout(
"precisionIndex",
precisionGroup,
V(1.27, 2.73, 0.9),
34,
-44,
"right"
);
registerCallout(
"precisionThumb",
precisionGroup,
V(1.18, 2.55, 0.93),
34,
38,
"right"
);
registerCallout(
"beadLabel",
precisionGroup,
V(1.39, 2.64, 0.9),
42,
-82,
"right"
);
registerCallout(
"precisionAnatomy",
precisionGroup,
V(-0.15, 1.77, 0.29),
-28,
-74,
"left"
);
registerCallout(
"powerPalm",
powerGroup,
V(-0.15, 1.48, 0.25),
-26,
36,
"left"
);
registerCallout(
"powerFingers",
powerGroup,
V(0.16, 2.39, 0.91),
35,
42,
"right"
);
registerCallout(
"handleLabel",
powerGroup,
V(0.0, 3.83, 0.42),
38,
-53,
"right"
);
registerCallout(
"forearmLabel",
powerGroup,
V(0, 0.52, 0.2),
-25,
28,
"left"
);
const projected = new THREE.Vector3();
function updateCallouts() {
const width = window.innerWidth;
const height = window.innerHeight;
callouts.forEach((callout) => {
projected.copy(callout.anchor);
callout.group.localToWorld(projected);
projected.project(camera);
const x = (projected.x * 0.5 + 0.5) * width;
const y = (-projected.y * 0.5 + 0.5) * height;
callout.element.style.transform =
`translate3d(${x + callout.dx}px, ${y + callout.dy}px, 0)`;
const inView =
projected.z > -1 &&
projected.z < 1 &&
x > -80 &&
x < width + 80 &&
y > -80 &&
y < height + 80;
callout.element.style.opacity = inView ? "1" : "0";
});
}
// ---------------------------------------------------------------------
// Direct camera controls: no addons
// ---------------------------------------------------------------------
const initialView = {
theta: 0.07,
phi: 1.04,
radius: 11.8,
target: V(0, 1.9, 0)
};
const desired = { ...initialView };
const current = { ...initialView };
current.target = initialView.target.clone();
desired.target = initialView.target.clone();
let dragging = false;
let previousX = 0;
let previousY = 0;
let activePointer = null;
renderer.domElement.addEventListener("pointerdown", (event) => {
dragging = true;
activePointer = event.pointerId;
previousX = event.clientX;
previousY = event.clientY;
renderer.domElement.setPointerCapture(event.pointerId);
renderer.domElement.style.cursor = "grabbing";
});
renderer.domElement.addEventListener("pointermove", (event) => {
if (!dragging || event.pointerId !== activePointer) return;
const dx = event.clientX - previousX;
const dy = event.clientY - previousY;
previousX = event.clientX;
previousY = event.clientY;
desired.theta -= dx * 0.005;
desired.phi = THREE.MathUtils.clamp(
desired.phi - dy * 0.0045,
0.48,
1.48
);
});
function endDrag(event) {
if (event.pointerId !== activePointer) return;
dragging = false;
activePointer = null;
renderer.domElement.style.cursor = "grab";
}
renderer.domElement.addEventListener("pointerup", endDrag);
renderer.domElement.addEventListener("pointercancel", endDrag);
renderer.domElement.style.cursor = "grab";
renderer.domElement.addEventListener(
"wheel",
(event) => {
event.preventDefault();
desired.radius = THREE.MathUtils.clamp(
desired.radius * Math.exp(event.deltaY * 0.001),
7.3,
16.5
);
},
{ passive: false }
);
// Basic two-pointer pinch zoom.
const activePointers = new Map();
let pinchDistance = null;
renderer.domElement.addEventListener("pointerdown", (event) => {
activePointers.set(event.pointerId, {
x: event.clientX,
y: event.clientY
});
if (activePointers.size === 2) {
const [a, b] = [...activePointers.values()];
pinchDistance = Math.hypot(a.x - b.x, a.y - b.y);
}
});
renderer.domElement.addEventListener("pointermove", (event) => {
if (!activePointers.has(event.pointerId)) return;
activePointers.set(event.pointerId, {
x: event.clientX,
y: event.clientY
});
if (activePointers.size === 2 && pinchDistance) {
const [a, b] = [...activePointers.values()];
const distance = Math.hypot(a.x - b.x, a.y - b.y);
desired.radius = THREE.MathUtils.clamp(
desired.radius * (pinchDistance / distance),
7.3,
16.5
);
pinchDistance = distance;
}
});
function removePointer(event) {
activePointers.delete(event.pointerId);
if (activePointers.size < 2) pinchDistance = null;
}
renderer.domElement.addEventListener("pointerup", removePointer);
renderer.domElement.addEventListener("pointercancel", removePointer);
document.getElementById("resetButton").addEventListener("click", () => {
desired.theta = initialView.theta;
desired.phi = initialView.phi;
desired.radius = initialView.radius;
desired.target.copy(initialView.target);
});
let cutawayEnabled = true;
document.getElementById("cutawayButton").addEventListener("click", () => {
cutawayEnabled = !cutawayEnabled;
skinMaterial.opacity = cutawayEnabled ? 0.54 : 0.82;
skinRimMaterial.opacity = cutawayEnabled ? 0.76 : 0.9;
const button = document.getElementById("cutawayButton");
button.setAttribute("aria-pressed", String(cutawayEnabled));
button.querySelector("span").textContent = cutawayEnabled ? "on" : "off";
});
// ---------------------------------------------------------------------
// Resize and render loop
// ---------------------------------------------------------------------
function resize() {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.setSize(window.innerWidth, window.innerHeight);
}
window.addEventListener("resize", resize);
const clock = new THREE.Clock();
function animate() {
requestAnimationFrame(animate);
const delta = Math.min(clock.getDelta(), 0.05);
const time = clock.elapsedTime;
// Damped camera movement.
current.theta = THREE.MathUtils.damp(
current.theta,
desired.theta,
7.5,
delta
);
current.phi = THREE.MathUtils.damp(
current.phi,
desired.phi,
7.5,
delta
);
current.radius = THREE.MathUtils.damp(
current.radius,
desired.radius,
7.5,
delta
);
current.target.lerp(desired.target, 1 - Math.exp(-7.5 * delta));
const sinPhi = Math.sin(current.phi);
camera.position.set(
current.target.x +
current.radius * sinPhi * Math.sin(current.theta),
current.target.y + current.radius * Math.cos(current.phi),
current.target.z +
current.radius * sinPhi * Math.cos(current.theta)
);
camera.lookAt(current.target);
// Subtle pulse emphasizes the two contact strategies.
cyanContactMaterial.emissiveIntensity =
2.05 + Math.sin(time * 2.4) * 0.35;
amberContactMaterial.emissiveIntensity =
1.75 + Math.sin(time * 2.4 + 1.2) * 0.32;
precisionHalo.material.opacity =
0.34 + Math.sin(time * 2.4) * 0.12;
scene.updateMatrixWorld();
updateCallouts();
renderer.render(scene, camera);
}
animate();
</script>
</body>
</html>
```