Prompt specification
Build or customize the Three.js 3D scene "Two Figures Support One Long Board" 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: Two Figures Support One Long Board
Category: Games & Play · Style: Procedural Solid / Shader 3D
License: MIT · Reference: https://three3d.app/scene/two-figures-support-one-long-board-x3709
Scene Description Prompt:
Build a self-contained HTML scene with Three.js from cdnjs featuring cooperative support of a long board. Model two original figures holding opposite ends of a board. Keep hand positions aligned with the board and show its central balance marker. Stylized solid forms.
Working Three.js Starter (two-figures-support-one-long-board-x3709):
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1"
/>
<title>Shared Plank — Cooperative Balance</title>
<style>
:root {
color-scheme: light;
--ink: #243044;
--paper: #f4efe7;
--accent: #f4c94f;
}
* {
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: var(--paper);
font-family:
Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
"Segoe UI", sans-serif;
}
#scene {
position: fixed;
inset: 0;
}
#scene canvas {
display: block;
width: 100%;
height: 100%;
outline: none;
touch-action: none;
cursor: grab;
}
#scene canvas:active {
cursor: grabbing;
}
.title-card {
position: fixed;
top: clamp(18px, 4vw, 42px);
left: clamp(18px, 4vw, 48px);
z-index: 2;
max-width: 340px;
color: var(--ink);
pointer-events: none;
user-select: none;
}
.eyebrow {
display: flex;
align-items: center;
gap: 9px;
margin-bottom: 8px;
font-size: 11px;
font-weight: 800;
letter-spacing: 0.18em;
text-transform: uppercase;
}
.eyebrow::before {
width: 25px;
height: 3px;
content: "";
border-radius: 99px;
background: var(--accent);
}
h1 {
margin: 0;
font-size: clamp(27px, 4.2vw, 48px);
line-height: 0.96;
letter-spacing: -0.055em;
}
.subtitle {
margin: 11px 0 0;
color: #647083;
font-size: 13px;
line-height: 1.5;
}
.instructions {
position: fixed;
bottom: clamp(18px, 3vw, 30px);
left: 50%;
z-index: 2;
padding: 9px 14px;
border: 1px solid rgba(36, 48, 68, 0.12);
border-radius: 999px;
color: #697386;
background: rgba(255, 255, 255, 0.66);
box-shadow: 0 8px 28px rgba(50, 45, 38, 0.08);
backdrop-filter: blur(10px);
font-size: 11px;
font-weight: 650;
letter-spacing: 0.04em;
white-space: nowrap;
pointer-events: none;
transform: translateX(-50%);
}
#reset {
position: fixed;
top: clamp(18px, 4vw, 42px);
right: clamp(18px, 4vw, 42px);
z-index: 3;
width: 44px;
height: 44px;
padding: 0;
border: 1px solid rgba(36, 48, 68, 0.14);
border-radius: 50%;
color: var(--ink);
background: rgba(255, 255, 255, 0.72);
box-shadow: 0 8px 25px rgba(50, 45, 38, 0.08);
backdrop-filter: blur(10px);
font-size: 22px;
line-height: 1;
cursor: pointer;
transition:
transform 160ms ease,
background 160ms ease;
}
#reset:hover {
background: #fff;
transform: rotate(-18deg) scale(1.05);
}
#reset:focus-visible {
outline: 3px solid rgba(244, 201, 79, 0.65);
outline-offset: 3px;
}
@media (max-width: 640px) {
.subtitle {
max-width: 230px;
}
.instructions {
bottom: 14px;
font-size: 10px;
}
}
</style>
</head>
<body>
<main
id="scene"
aria-label="Two stylized figures cooperatively holding opposite ends of a long balance board"
></main>
<header class="title-card">
<div class="eyebrow">Cooperative study 02</div>
<h1>Shared<br />Plank</h1>
<p class="subtitle">
Two original figures support one long board around its central balance marker.
</p>
</header>
<button id="reset" type="button" title="Reset camera" aria-label="Reset camera">
↺
</button>
<div class="instructions">
Drag to orbit · Scroll or pinch to zoom · Double-click to reset
</div>
<script type="module">
import * as THREE from
"https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
const container = document.querySelector("#scene");
const resetButton = document.querySelector("#reset");
// ------------------------------------------------------------
// Renderer, scene, lighting
// ------------------------------------------------------------
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.08;
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
container.appendChild(renderer.domElement);
renderer.domElement.tabIndex = 0;
renderer.domElement.setAttribute(
"aria-label",
"Interactive 3D scene. Drag to orbit and use the mouse wheel to zoom."
);
const scene = new THREE.Scene();
scene.background = new THREE.Color(0xf4efe7);
scene.fog = new THREE.Fog(0xf4efe7, 18, 38);
const camera = new THREE.PerspectiveCamera(
37,
window.innerWidth / window.innerHeight,
0.1,
100
);
const target = new THREE.Vector3(0, 1.45, 0);
let azimuth = -0.12;
let polar = 1.36;
let radius = 13;
let baseRadius = 13;
let dragging = false;
let lastPointerX = 0;
let lastPointerY = 0;
const hemisphere = new THREE.HemisphereLight(
0xfff8eb,
0x8c9aab,
2.1
);
scene.add(hemisphere);
const keyLight = new THREE.DirectionalLight(0xfff2d6, 3.4);
keyLight.position.set(4.5, 9, 6.5);
keyLight.castShadow = true;
keyLight.shadow.mapSize.set(2048, 2048);
keyLight.shadow.camera.left = -7;
keyLight.shadow.camera.right = 7;
keyLight.shadow.camera.top = 7;
keyLight.shadow.camera.bottom = -4;
keyLight.shadow.camera.near = 1;
keyLight.shadow.camera.far = 24;
keyLight.shadow.bias = -0.0005;
scene.add(keyLight);
const rimLight = new THREE.DirectionalLight(0xb8d9ff, 1.4);
rimLight.position.set(-6, 4, -5);
scene.add(rimLight);
// ------------------------------------------------------------
// Materials and geometry helpers
// ------------------------------------------------------------
const material = (color, options = {}) =>
new THREE.MeshStandardMaterial({
color,
roughness: 0.78,
metalness: 0,
flatShading: true,
...options
});
const M = {
board: material(0xd79a55, { roughness: 0.68 }),
boardEdge: material(0xb87538, { roughness: 0.8 }),
marker: material(0xf5cb4c, { roughness: 0.52 }),
markerDark: material(0x263349, { roughness: 0.62 }),
cream: material(0xf7e9ce),
floor: material(0xe8e1d6, { roughness: 1 }),
ground: material(0xf4efe7, { roughness: 1 }),
shadow: material(0xded5c7, { roughness: 1 })
};
function addMesh(
geometry,
mat,
position = [0, 0, 0],
scale = [1, 1, 1],
parent = scene
) {
const mesh = new THREE.Mesh(geometry, mat);
mesh.position.set(...position);
mesh.scale.set(...scale);
mesh.castShadow = true;
mesh.receiveShadow = true;
parent.add(mesh);
return mesh;
}
function addLimb(start, end, radius, mat, parent = scene) {
const a = new THREE.Vector3(...start);
const b = new THREE.Vector3(...end);
const direction = new THREE.Vector3().subVectors(b, a);
const length = direction.length();
const geometry = new THREE.CylinderGeometry(
radius,
radius,
length,
12,
1,
false
);
const mesh = new THREE.Mesh(geometry, mat);
mesh.position.copy(a).add(b).multiplyScalar(0.5);
mesh.quaternion.setFromUnitVectors(
new THREE.Vector3(0, 1, 0),
direction.normalize()
);
mesh.castShadow = true;
mesh.receiveShadow = true;
parent.add(mesh);
return mesh;
}
function addJoint(position, radius, mat, scale = [1, 1, 1]) {
return addMesh(
new THREE.SphereGeometry(radius, 14, 10),
mat,
position,
scale
);
}
// ------------------------------------------------------------
// Ground and stage
// ------------------------------------------------------------
const ground = addMesh(
new THREE.PlaneGeometry(80, 80),
M.ground,
[0, -0.035, 0],
[1, 1, 1]
);
ground.rotation.x = -Math.PI / 2;
ground.castShadow = false;
const stage = addMesh(
new THREE.CircleGeometry(7.6, 96),
M.floor,
[0, -0.015, 0],
[1, 1, 1]
);
stage.rotation.x = -Math.PI / 2;
stage.castShadow = false;
// ------------------------------------------------------------
// Long board with gently lifted ends
// ------------------------------------------------------------
const boardShape = new THREE.Shape();
boardShape.moveTo(-3.85, 0);
boardShape.bezierCurveTo(
-3.78, 0.26,
-3.54, 0.45,
-3.18, 0.38
);
boardShape.bezierCurveTo(
-2.35, 0.13,
-1.25, 0.04,
0, 0.04
);
boardShape.bezierCurveTo(
1.25, 0.04,
2.35, 0.13,
3.18, 0.38
);
boardShape.bezierCurveTo(
3.54, 0.45,
3.78, 0.26,
3.85, 0
);
boardShape.lineTo(3.66, -0.12);
boardShape.bezierCurveTo(
3.55, 0.05,
3.34, 0.22,
3.1, 0.2
);
boardShape.bezierCurveTo(
2.3, 0,
1.2, -0.03,
0, -0.03
);
boardShape.bezierCurveTo(
-1.2, -0.03,
-2.3, 0,
-3.1, 0.2
);
boardShape.bezierCurveTo(
-3.34, 0.22,
-3.55, 0.05,
-3.66, -0.12
);
boardShape.closePath();
const boardGeometry = new THREE.ExtrudeGeometry(boardShape, {
depth: 0.72,
steps: 1,
bevelEnabled: true,
bevelSegments: 3,
bevelSize: 0.045,
bevelThickness: 0.045,
curveSegments: 32
});
const board = addMesh(
boardGeometry,
M.board,
[0, 2.03, -0.36]
);
board.receiveShadow = true;
// Subtle lower edge makes the board read more clearly from the front.
const boardUnderline = addMesh(
new THREE.BoxGeometry(6.35, 0.065, 0.79),
M.boardEdge,
[0, 2.035, -0.005]
);
boardUnderline.scale.x = 0.99;
// ------------------------------------------------------------
// Central balance marker
// ------------------------------------------------------------
const markerBand = addMesh(
new THREE.BoxGeometry(0.25, 0.17, 0.84),
M.marker,
[0, 2.075, 0]
);
const diamondShape = new THREE.Shape();
diamondShape.moveTo(0, 0.23);
diamondShape.lineTo(0.17, 0);
diamondShape.lineTo(0, -0.23);
diamondShape.lineTo(-0.17, 0);
diamondShape.closePath();
const markerGem = addMesh(
new THREE.ShapeGeometry(diamondShape),
M.markerDark,
[0, 2.105, 0]
);
markerGem.rotation.x = -Math.PI / 2;
markerGem.scale.setScalar(0.85);
const markerCenter = addJoint(
[0, 2.125, 0],
0.045,
M.cream,
[1, 0.35, 1]
);
const pointerShape = new THREE.Shape();
pointerShape.moveTo(-0.15, 0.14);
pointerShape.lineTo(0.15, 0.14);
pointerShape.lineTo(0, -0.18);
pointerShape.closePath();
addMesh(
new THREE.ShapeGeometry(pointerShape),
M.marker,
[0, 1.94, 0.445]
);
// ------------------------------------------------------------
// Original stylized figures
// ------------------------------------------------------------
function createCharacter(side, palette) {
const s = side;
const bodyX = s * 4.48;
const headX = s * 4.42;
const bodyMat = material(palette.body);
const patchMat = material(palette.patch);
const pantsMat = material(palette.pants);
const skinMat = material(palette.skin);
const hairMat = material(palette.hair);
const bootMat = material(palette.boot);
const faceMat = material(0x263044, { roughness: 0.9 });
// Torso and lower body.
addMesh(
new THREE.SphereGeometry(1, 20, 14),
bodyMat,
[bodyX, 1.28, 0],
[0.56, 0.74, 0.39]
);
addMesh(
new THREE.SphereGeometry(1, 18, 12),
patchMat,
[bodyX, 1.27, 0.325],
[0.34, 0.43, 0.085]
);
addMesh(
new THREE.SphereGeometry(1, 18, 12),
pantsMat,
[bodyX, 0.72, 0],
[0.48, 0.28, 0.36]
);
// Neck and head.
addLimb(
[headX, 1.79, 0],
[headX, 2.05, 0],
0.17,
skinMat
);
addMesh(
new THREE.SphereGeometry(1, 22, 16),
skinMat,
[headX, 2.31, 0],
[0.47, 0.49, 0.44]
);
// Distinct hair silhouettes.
if (side < 0) {
addMesh(
new THREE.SphereGeometry(1, 20, 14),
hairMat,
[headX - 0.02, 2.57, -0.015],
[0.48, 0.27, 0.45]
);
} else {
addMesh(
new THREE.SphereGeometry(1, 20, 14),
hairMat,
[headX, 2.54, -0.03],
[0.48, 0.25, 0.44]
);
addMesh(
new THREE.SphereGeometry(1, 16, 12),
hairMat,
[headX - 0.05, 2.79, -0.08],
[0.23, 0.22, 0.22]
);
}
// Simple solid facial features.
addJoint(
[headX - 0.14, 2.35, 0.405],
0.043,
faceMat,
[1, 1.15, 0.55]
);
addJoint(
[headX + 0.14, 2.35, 0.405],
0.043,
faceMat,
[1, 1.15, 0.55]
);
addJoint(
[headX, 2.25, 0.465],
0.065,
skinMat,
[1, 0.8, 0.8]
);
const mouth = addMesh(
new THREE.BoxGeometry(0.12, 0.018, 0.025),
faceMat,
[headX, 2.13, 0.425]
);
mouth.rotation.z = side < 0 ? -0.08 : 0.08;
// Two arms reach the same end of the board.
// The front hand is clearly visible; the rear hand wraps behind it.
for (const depthSign of [1, -1]) {
const shoulder = [
s * 4.19,
1.83,
depthSign * 0.25
];
const elbow = [
s * 3.99,
2.04,
depthSign * 0.4
];
const hand = [
s * 3.64,
2.37,
depthSign * 0.445
];
addJoint(shoulder, 0.16, bodyMat, [1, 0.95, 1]);
addLimb(shoulder, elbow, 0.115, bodyMat);
addJoint(elbow, 0.125, skinMat, [1, 1, 1]);
addLimb(elbow, hand, 0.102, skinMat);
addMesh(
new THREE.SphereGeometry(1, 16, 12),
skinMat,
hand,
[0.125, 0.12, 0.095]
);
// A small cuff visually locks the wrist to the forearm.
addJoint(
[
s * 3.73,
2.29,
depthSign * 0.44
],
0.11,
patchMat,
[1, 0.8, 1]
);
}
// Visible fingers curl over the front edge of the board.
for (let finger = -1; finger <= 1; finger++) {
addLimb(
[
s * 3.64 + finger * 0.073,
2.37,
0.435
],
[
s * 3.64 + finger * 0.073,
2.18,
0.435
],
0.032,
skinMat
);
}
// Legs and rounded boots.
for (const legOffset of [-0.22, 0.22]) {
const hip = [
bodyX + legOffset,
0.74,
0
];
const knee = [
bodyX + legOffset * 1.15,
0.42,
legOffset * 0.08
];
const ankle = [
bodyX + legOffset * 1.05,
0.15,
legOffset * 0.1
];
addLimb(hip, knee, 0.135, pantsMat);
addJoint(knee, 0.14, pantsMat);
addLimb(knee, ankle, 0.115, pantsMat);
addMesh(
new THREE.SphereGeometry(1, 18, 12),
bootMat,
[
bodyX + legOffset * 1.05,
0.105,
0.09 + legOffset * 0.08
],
[0.29, 0.14, 0.4]
);
}
}
createCharacter(-1, {
body: 0x238f87,
patch: 0xf0c34c,
pants: 0x2c3950,
skin: 0xd58c67,
hair: 0x273147,
boot: 0xefc54d
});
createCharacter(1, {
body: 0xe76750,
patch: 0xf3d7a6,
pants: 0x536079,
skin: 0x985c43,
hair: 0x282c40,
boot: 0x34405a
});
// ------------------------------------------------------------
// Custom camera controls — no external controls addon
// ------------------------------------------------------------
function updateCamera() {
const sinPolar = Math.sin(polar);
camera.position.set(
target.x + radius * sinPolar * Math.sin(azimuth),
target.y + radius * Math.cos(polar),
target.z + radius * sinPolar * Math.cos(azimuth)
);
camera.lookAt(target);
}
function resetView() {
azimuth = -0.12;
polar = 1.36;
radius = baseRadius;
updateCamera();
}
const canvas = renderer.domElement;
canvas.addEventListener("pointerdown", (event) => {
dragging = true;
lastPointerX = event.clientX;
lastPointerY = event.clientY;
canvas.setPointerCapture(event.pointerId);
});
canvas.addEventListener("pointermove", (event) => {
if (!dragging) return;
const deltaX = event.clientX - lastPointerX;
const deltaY = event.clientY - lastPointerY;
lastPointerX = event.clientX;
lastPointerY = event.clientY;
azimuth -= deltaX * 0.006;
polar = THREE.MathUtils.clamp(
polar + deltaY * 0.005,
0.64,
1.48
);
updateCamera();
});
function stopDragging(event) {
dragging = false;
if (canvas.hasPointerCapture(event.pointerId)) {
canvas.releasePointerCapture(event.pointerId);
}
}
canvas.addEventListener("pointerup", stopDragging);
canvas.addEventListener("pointercancel", stopDragging);
canvas.addEventListener(
"wheel",
(event) => {
event.preventDefault();
radius = THREE.MathUtils.clamp(
radius + event.deltaY * 0.012,
7.5,
34
);
updateCamera();
},
{ passive: false }
);
canvas.addEventListener("dblclick", resetView);
resetButton.addEventListener("click", resetView);
window.addEventListener("keydown", (event) => {
const key = event.key.toLowerCase();
if (key === "arrowleft") azimuth += 0.08;
else if (key === "arrowright") azimuth -= 0.08;
else if (key === "arrowup") polar -= 0.06;
else if (key === "arrowdown") polar += 0.06;
else if (key === "+" || key === "=") radius -= 0.5;
else if (key === "-" || key === "_") radius += 0.5;
else if (key === "r") {
resetView();
return;
} else {
return;
}
polar = THREE.MathUtils.clamp(polar, 0.64, 1.48);
radius = THREE.MathUtils.clamp(radius, 7.5, 34);
updateCamera();
});
function resize() {
const width = window.innerWidth;
const height = window.innerHeight;
const aspect = width / height;
camera.aspect = aspect;
camera.updateProjectionMatrix();
renderer.setSize(width, height);
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
// Keep the full composition visible on portrait screens.
const responsiveFactor = Math.max(1, 1.2 / aspect);
baseRadius = Math.min(29, 13 * responsiveFactor);
radius = baseRadius;
updateCamera();
}
window.addEventListener("resize", resize);
resize();
resetView();
// A restrained pulse gives the central marker a focal glow.
const clock = new THREE.Clock();
function animate() {
const elapsed = clock.getElapsedTime();
const pulse = 1 + Math.sin(elapsed * 2.1) * 0.035;
markerCenter.scale.set(1, 0.35 * pulse, 1);
renderer.render(scene, camera);
requestAnimationFrame(animate);
}
animate();
</script>
</body>
</html>
```