Prompt specification
Build or customize the Three.js 3D scene "Character and a Fallen Flowerpot" 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: Character and a Fallen Flowerpot
Category: Games & Play · Style: Procedural Solid / Shader 3D
License: MIT · Reference: https://three3d.app/scene/character-and-a-fallen-flowerpot-x3701
Scene Description Prompt:
Build a self-contained HTML scene with Three.js from cdnjs featuring a character beside a tipped flowerpot. Model an original character beside a tipped empty flowerpot and scattered soil blocks. Keep the setup non-graphic and leave cause unspecified until an action is shown. Stylized solid forms.
Working Three.js Starter (character-and-a-fallen-flowerpot-x3701):
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Pip and the Empty Pot</title>
<style>
:root {
color-scheme: light;
--ink: #29332d;
--muted: #59665d;
--paper: rgba(255, 250, 239, 0.9);
--accent: #2f7066;
--accent-hover: #245b53;
}
* {
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: #e8dfcf;
font-family: ui-rounded, "Trebuchet MS", system-ui, sans-serif;
}
#stage {
position: fixed;
inset: 0;
}
canvas {
display: block;
width: 100%;
height: 100%;
touch-action: none;
outline: none;
}
.hud {
position: fixed;
inset: 0;
pointer-events: none;
}
.panel {
position: absolute;
top: 22px;
left: 22px;
width: min(350px, calc(100vw - 44px));
padding: 18px 19px 16px;
border: 1px solid rgba(71, 78, 63, 0.16);
border-radius: 18px;
background: var(--paper);
box-shadow: 0 14px 38px rgba(67, 61, 45, 0.13);
backdrop-filter: blur(10px);
pointer-events: auto;
}
.eyebrow {
margin: 0 0 6px;
color: var(--accent);
font-size: 0.72rem;
font-weight: 800;
letter-spacing: 0.13em;
text-transform: uppercase;
}
h1 {
margin: 0;
color: var(--ink);
font-size: clamp(1.45rem, 4vw, 2rem);
line-height: 1.05;
}
.description {
margin: 10px 0 14px;
color: var(--muted);
font-size: 0.92rem;
line-height: 1.45;
}
.actions {
display: flex;
flex-wrap: wrap;
gap: 8px;
}
button {
min-height: 40px;
padding: 9px 14px;
border: 0;
border-radius: 11px;
background: var(--accent);
color: #fffdf6;
cursor: pointer;
font: inherit;
font-size: 0.84rem;
font-weight: 750;
transition:
background 160ms ease,
transform 160ms ease,
opacity 160ms ease;
}
button:hover:not(:disabled) {
background: var(--accent-hover);
transform: translateY(-1px);
}
button:focus-visible {
outline: 3px solid rgba(47, 112, 102, 0.3);
outline-offset: 3px;
}
button:disabled {
cursor: wait;
opacity: 0.65;
}
button.secondary {
border: 1px solid rgba(47, 112, 102, 0.22);
background: rgba(255, 255, 255, 0.54);
color: var(--accent);
}
button.secondary:hover:not(:disabled) {
background: rgba(255, 255, 255, 0.9);
}
#status {
min-height: 2.7em;
margin-top: 12px;
color: var(--muted);
font-size: 0.78rem;
line-height: 1.35;
}
.controls {
position: absolute;
right: 20px;
bottom: 18px;
padding: 9px 13px;
border: 1px solid rgba(71, 78, 63, 0.14);
border-radius: 999px;
background: rgba(255, 250, 239, 0.76);
color: var(--muted);
font-size: 0.72rem;
font-weight: 700;
letter-spacing: 0.025em;
backdrop-filter: blur(8px);
}
@media (max-width: 620px) {
.panel {
top: 12px;
left: 12px;
width: calc(100vw - 24px);
padding: 15px;
}
.description {
margin-bottom: 11px;
}
#status {
min-height: 2.2em;
}
.controls {
right: 12px;
bottom: 12px;
font-size: 0.66rem;
}
}
</style>
</head>
<body>
<main id="stage" aria-label="A stylized 3D garden scene"></main>
<div class="hud">
<section class="panel">
<p class="eyebrow">A quiet garden moment</p>
<h1>Pip & the Empty Pot</h1>
<p class="description">
Pip, a small garden tinkerer, stands beside an empty flowerpot tipped
on its side. Loose blocks of soil are scattered nearby.
</p>
<div class="actions">
<button id="actionButton" type="button">Show a small action</button>
<button id="resetButton" class="secondary" type="button">Reset</button>
</div>
<p id="status" aria-live="polite">
Nothing in the scene explains how the pot became tipped.
</p>
</section>
<div class="controls">Drag to orbit · Scroll or pinch to zoom · Double-click to reset view</div>
</div>
<script type="module">
import * as THREE from
"https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
const stage = document.getElementById("stage");
const actionButton = document.getElementById("actionButton");
const resetButton = document.getElementById("resetButton");
const status = document.getElementById("status");
const scene = new THREE.Scene();
scene.background = new THREE.Color(0xe8dfcf);
scene.fog = new THREE.Fog(0xe8dfcf, 13, 29);
const camera = new THREE.PerspectiveCamera(
42,
innerWidth / innerHeight,
0.1,
60
);
const renderer = new THREE.WebGLRenderer({
antialias: true,
powerPreference: "high-performance"
});
renderer.setSize(innerWidth, innerHeight);
renderer.setPixelRatio(Math.min(devicePixelRatio, 2));
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1.08;
stage.appendChild(renderer.domElement);
const hemisphere = new THREE.HemisphereLight(
0xfff3d8,
0x74816c,
2.25
);
scene.add(hemisphere);
const sunlight = new THREE.DirectionalLight(0xffedc8, 3.8);
sunlight.position.set(-4.5, 9, 6);
sunlight.castShadow = true;
sunlight.shadow.mapSize.set(2048, 2048);
sunlight.shadow.camera.left = -8;
sunlight.shadow.camera.right = 8;
sunlight.shadow.camera.top = 8;
sunlight.shadow.camera.bottom = -8;
sunlight.shadow.camera.near = 1;
sunlight.shadow.camera.far = 25;
sunlight.shadow.bias = -0.0004;
sunlight.shadow.normalBias = 0.035;
scene.add(sunlight);
const fillLight = new THREE.PointLight(0xc8e5df, 18, 14, 2);
fillLight.position.set(5, 4, -4);
scene.add(fillLight);
const material = (color, options = {}) =>
new THREE.MeshStandardMaterial({
color,
roughness: 0.82,
metalness: 0,
flatShading: true,
...options
});
const materials = {
teal: material(0x3d7d78),
tealDark: material(0x285a58),
yellow: material(0xe3ad43),
yellowLight: material(0xf1c96a),
coral: material(0xc96552),
skin: material(0xd99b72),
hair: material(0x4b3128),
boot: material(0x40382f),
pot: material(0xc76e49, {
side: THREE.DoubleSide
}),
potDark: material(0x713b2b),
interior: material(0x4b281f, {
side: THREE.DoubleSide
}),
soil: material(0x493025),
soilLight: material(0x60402e),
green: material(0x6e8c57),
greenDark: material(0x526d43),
eye: material(0x252724, { roughness: 0.5 })
};
function addMesh(
geometry,
meshMaterial,
parent = scene,
position = [0, 0, 0],
rotation = [0, 0, 0]
) {
const mesh = new THREE.Mesh(geometry, meshMaterial);
mesh.position.set(...position);
mesh.rotation.set(...rotation);
mesh.castShadow = true;
mesh.receiveShadow = true;
parent.add(mesh);
return mesh;
}
// Soft, garden-like ground.
const ground = addMesh(
new THREE.PlaneGeometry(50, 50),
material(0xe3d8c3),
scene,
[0, -0.025, 0],
[-Math.PI / 2, 0, 0]
);
ground.castShadow = false;
const gardenPatch = addMesh(
new THREE.CircleGeometry(4.8, 64),
material(0xcdd8b7),
scene,
[0, -0.012, 0],
[-Math.PI / 2, 0, 0]
);
gardenPatch.scale.set(1.28, 0.82, 1);
gardenPatch.castShadow = false;
// Small, solid grass tufts around the scene.
function addGrassTuft(x, z, scale = 1) {
const tuft = new THREE.Group();
tuft.position.set(x, 0, z);
tuft.scale.setScalar(scale);
scene.add(tuft);
for (let i = 0; i < 3; i++) {
addMesh(
new THREE.ConeGeometry(0.075, 0.44 + i * 0.05, 5),
i === 1 ? materials.greenDark : materials.green,
tuft,
[(i - 1) * 0.11, 0.22 + i * 0.025, (i % 2) * 0.07],
[0.08 * (i - 1), i * 0.7, (i - 1) * 0.24]
);
}
}
[
[-3.2, -1.9, 1.05],
[-2.7, 1.8, 0.85],
[3.8, -1.8, 1.1],
[4.2, 1.4, 0.75],
[-0.2, -2.5, 0.8],
[2.8, 2.5, 0.9]
].forEach((args) => addGrassTuft(...args));
// The tipped, empty terracotta flowerpot.
const pot = new THREE.Group();
pot.position.set(1.35, 0, 0);
scene.add(pot);
addMesh(
new THREE.CylinderGeometry(0.72, 0.52, 2, 24, 1, true),
materials.pot,
pot,
[0, 0.69, 0],
[0, 0, -Math.PI / 2]
);
// A darker recessed cavity makes the opening visibly empty.
addMesh(
new THREE.CylinderGeometry(0.65, 0.53, 1.12, 24, 1, true),
materials.interior,
pot,
[0.44, 0.69, 0],
[0, 0, -Math.PI / 2]
);
addMesh(
new THREE.CircleGeometry(0.53, 24),
materials.interior,
pot,
[-0.11, 0.69, 0],
[0, Math.PI / 2, 0]
);
addMesh(
new THREE.CircleGeometry(0.52, 24),
materials.potDark,
pot,
[-0.99, 0.69, 0],
[0, -Math.PI / 2, 0]
);
addMesh(
new THREE.TorusGeometry(0.69, 0.065, 8, 28),
materials.potDark,
pot,
[1, 0.69, 0],
[0, Math.PI / 2, 0]
);
addMesh(
new THREE.TorusGeometry(0.635, 0.035, 7, 26),
materials.pot,
pot,
[0.83, 0.69, 0],
[0, Math.PI / 2, 0]
);
// Original character: Pip, a compact gardener in teal overalls.
const pip = new THREE.Group();
pip.position.set(-1.35, 0, 0.05);
scene.add(pip);
const upperBody = new THREE.Group();
upperBody.position.y = 1.05;
pip.add(upperBody);
addMesh(
new THREE.CylinderGeometry(0.37, 0.5, 0.88, 16),
materials.teal,
upperBody,
[0, 0.46, 0]
);
addMesh(
new THREE.BoxGeometry(0.67, 0.22, 0.46),
materials.tealDark,
pip,
[0, 0.98, 0]
);
addMesh(
new THREE.CylinderGeometry(0.14, 0.16, 0.22, 12),
materials.skin,
upperBody,
[0, 0.98, 0]
);
// Scarf and hanging end.
addMesh(
new THREE.TorusGeometry(0.285, 0.085, 8, 20),
materials.coral,
upperBody,
[0, 1.02, 0],
[Math.PI / 2, 0, 0]
);
addMesh(
new THREE.BoxGeometry(0.16, 0.48, 0.08),
materials.coral,
upperBody,
[0.23, 0.78, 0.34],
[0, 0, -0.12]
);
// Overall straps, buttons, and a tiny leaf badge.
for (const x of [-0.22, 0.22]) {
addMesh(
new THREE.BoxGeometry(0.1, 0.62, 0.065),
materials.tealDark,
upperBody,
[x, 0.68, 0.37],
[0, 0, x < 0 ? -0.08 : 0.08]
);
addMesh(
new THREE.SphereGeometry(0.065, 10, 8),
materials.yellow,
upperBody,
[x, 0.52, 0.43]
);
}
addMesh(
new THREE.BoxGeometry(0.38, 0.27, 0.075),
materials.tealDark,
upperBody,
[0, 0.36, 0.43]
);
const leafBadge = addMesh(
new THREE.SphereGeometry(0.11, 12, 8),
materials.green,
upperBody,
[-0.07, 0.38, 0.475],
[0, 0, 0.7]
);
leafBadge.scale.set(0.52, 1.15, 0.28);
// Head.
const head = new THREE.Group();
head.position.set(0, 1.34, 0);
upperBody.add(head);
addMesh(
new THREE.SphereGeometry(0.46, 24, 16),
materials.skin,
head
);
for (const x of [-0.4, 0.4]) {
const ear = addMesh(
new THREE.SphereGeometry(0.115, 12, 8),
materials.skin,
head,
[x, -0.02, 0]
);
ear.scale.set(0.7, 1, 0.75);
}
for (const x of [-0.155, 0.155]) {
const eye = addMesh(
new THREE.SphereGeometry(0.047, 12, 8),
materials.eye,
head,
[x, 0.035, 0.425]
);
eye.castShadow = false;
const cheek = addMesh(
new THREE.SphereGeometry(0.065, 10, 8),
material(0xc87561),
head,
[x * 1.65, -0.105, 0.385]
);
cheek.scale.set(1, 0.55, 0.28);
cheek.castShadow = false;
}
const nose = addMesh(
new THREE.SphereGeometry(0.065, 12, 8),
materials.skin,
head,
[0, -0.045, 0.455]
);
nose.scale.set(0.85, 0.85, 1.1);
const smile = addMesh(
new THREE.BoxGeometry(0.13, 0.025, 0.03),
materials.hair,
head,
[0, -0.16, 0.425],
[0, 0, -0.04]
);
smile.castShadow = false;
// Hair peeking from beneath a yellow cap.
for (const x of [-0.38, 0.38]) {
const hair = addMesh(
new THREE.SphereGeometry(0.19, 12, 8),
materials.hair,
head,
[x, -0.06, -0.035]
);
hair.scale.set(0.55, 0.8, 0.75);
}
addMesh(
new THREE.SphereGeometry(0.49, 20, 8, 0, Math.PI * 2, 0, Math.PI / 2),
materials.yellow,
head,
[0, 0.13, 0]
);
addMesh(
new THREE.CylinderGeometry(0.52, 0.52, 0.085, 20),
materials.yellowLight,
head,
[0, 0.14, 0]
);
addMesh(
new THREE.TorusGeometry(0.485, 0.035, 7, 20),
materials.yellowLight,
head,
[0, 0.18, 0],
[Math.PI / 2, 0, 0]
);
addMesh(
new THREE.SphereGeometry(0.105, 12, 8),
materials.coral,
head,
[0, 0.62, 0]
);
// Arms with simple pivots.
function createArm(x) {
const arm = new THREE.Group();
arm.position.set(x, 0.77, 0);
upperBody.add(arm);
addMesh(
new THREE.CylinderGeometry(0.145, 0.125, 0.54, 12),
materials.teal,
arm,
[0, -0.27, 0]
);
const forearm = new THREE.Group();
forearm.position.y = -0.52;
arm.add(forearm);
addMesh(
new THREE.CylinderGeometry(0.115, 0.1, 0.42, 12),
materials.skin,
forearm,
[0, -0.21, 0]
);
addMesh(
new THREE.SphereGeometry(0.125, 12, 8),
materials.skin,
forearm,
[0, -0.47, 0]
);
return arm;
}
const leftArm = createArm(-0.47);
const rightArm = createArm(0.47);
// Legs and boots.
for (const x of [-0.22, 0.22]) {
addMesh(
new THREE.CylinderGeometry(0.16, 0.145, 0.7, 12),
materials.tealDark,
pip,
[x, 0.54, 0]
);
addMesh(
new THREE.BoxGeometry(0.36, 0.23, 0.57),
materials.boot,
pip,
[x, 0.12, 0.13]
);
addMesh(
new THREE.BoxGeometry(0.37, 0.07, 0.58),
materials.hair,
pip,
[x, 0.045, 0.13]
);
}
// Scattered soil blocks.
const soilBlocks = [];
function addSoilBlock(size, position, rotation, meshMaterial = materials.soil) {
const block = addMesh(
new THREE.BoxGeometry(size[0], size[1], size[2]),
meshMaterial,
scene,
position,
rotation
);
soilBlocks.push(block);
return block;
}
const actionClod = addSoilBlock(
[0.23, 0.2, 0.22],
[0.07, 0.105, 0.46],
[0.05, 0.35, -0.08],
materials.soilLight
);
const actionClodHome = actionClod.position.clone();
addSoilBlock(
[0.18, 0.17, 0.19],
[0.42, 0.09, 0.23],
[0.2, -0.2, 0.15],
materials.soil
);
addSoilBlock(
[0.25, 0.16, 0.2],
[0.78, 0.085, 0.73],
[0.05, 0.4, -0.12],
materials.soilLight
);
addSoilBlock(
[0.17, 0.14, 0.16],
[1.08, 0.075, 0.37],
[0.2, 0.1, 0.18],
materials.soil
);
addSoilBlock(
[0.22, 0.18, 0.19],
[1.58, 0.095, -0.34],
[-0.12, 0.55, 0.06],
materials.soilLight
);
addSoilBlock(
[0.19, 0.15, 0.17],
[2.03, 0.08, 0.13],
[0.16, -0.1, 0.13],
materials.soil
);
addSoilBlock(
[0.16, 0.13, 0.15],
[2.62, 0.07, -0.12],
[0.05, 0.45, -0.1],
materials.soilLight
);
addSoilBlock(
[0.18, 0.14, 0.16],
[0.68, 0.075, 1.12],
[0.1, 0.22, 0.08],
materials.soil
);
addSoilBlock(
[0.22, 0.16, 0.18],
[1.7, 0.085, 0.96],
[-0.08, -0.32, 0.14],
materials.soilLight
);
addSoilBlock(
[0.15, 0.12, 0.14],
[2.45, 0.065, 0.76],
[0.14, 0.16, 0.12],
materials.soil
);
// A few small nearby stones help anchor the scattered blocks.
for (const [x, z, scale] of [
[-0.1, -0.45, 0.12],
[0.95, -0.68, 0.1],
[2.72, 0.44, 0.13]
]) {
const pebble = addMesh(
new THREE.DodecahedronGeometry(scale, 0),
materials.greenDark,
scene,
[x, scale * 0.65, z]
);
pebble.scale.y = 0.55;
}
// Direct camera controls: orbit, zoom, keyboard, and double-click reset.
const cameraTarget = new THREE.Vector3(0.1, 1.02, 0);
const defaultView = {
theta: 0.66,
phi: 1.06,
radius: 10.7
};
const goal = { ...defaultView };
const current = { ...defaultView };
function resetCamera() {
goal.theta = defaultView.theta;
goal.phi = defaultView.phi;
goal.radius = defaultView.radius;
}
function updateCamera() {
current.theta += (goal.theta - current.theta) * 0.09;
current.phi += (goal.phi - current.phi) * 0.09;
current.radius += (goal.radius - current.radius) * 0.09;
const sinPhi = Math.sin(current.phi);
camera.position.set(
cameraTarget.x +
current.radius * sinPhi * Math.sin(current.theta),
cameraTarget.y + current.radius * Math.cos(current.phi),
cameraTarget.z +
current.radius * sinPhi * Math.cos(current.theta)
);
camera.lookAt(cameraTarget);
}
let dragging = false;
let lastPointerX = 0;
let lastPointerY = 0;
renderer.domElement.addEventListener("pointerdown", (event) => {
dragging = true;
lastPointerX = event.clientX;
lastPointerY = event.clientY;
renderer.domElement.setPointerCapture(event.pointerId);
});
renderer.domElement.addEventListener("pointermove", (event) => {
if (!dragging) return;
const dx = event.clientX - lastPointerX;
const dy = event.clientY - lastPointerY;
lastPointerX = event.clientX;
lastPointerY = event.clientY;
goal.theta -= dx * 0.006;
goal.phi = THREE.MathUtils.clamp(goal.phi - dy * 0.006, 0.55, 1.43);
});
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();
goal.radius = THREE.MathUtils.clamp(
goal.radius * Math.exp(event.deltaY * 0.001),
6.3,
16
);
},
{ passive: false }
);
renderer.domElement.addEventListener("dblclick", resetCamera);
addEventListener("keydown", (event) => {
const step = 0.09;
if (event.key === "ArrowLeft") goal.theta += step;
if (event.key === "ArrowRight") goal.theta -= step;
if (event.key === "ArrowUp") goal.phi = Math.max(0.55, goal.phi - step);
if (event.key === "ArrowDown") goal.phi = Math.min(1.43, goal.phi + step);
if (event.key === "+" || event.key === "=") {
goal.radius = Math.max(6.3, goal.radius - 0.5);
}
if (event.key === "-" || event.key === "_") {
goal.radius = Math.min(16, goal.radius + 0.5);
}
});
// Gentle, non-graphic action: Pip reaches over and nudges one soil block.
let actionStart = null;
let actionFinished = false;
const actionDuration = 3400;
const clamp01 = (value) => Math.min(1, Math.max(0, value));
function smoothstep(edge0, edge1, value) {
const t = clamp01((value - edge0) / (edge1 - edge0));
return t * t * (3 - 2 * t);
}
function startAction() {
actionClod.position.copy(actionClodHome);
actionStart = performance.now();
actionFinished = false;
actionButton.disabled = true;
actionButton.textContent = "Action playing…";
status.textContent =
"Pip reaches carefully toward one loose block of soil.";
}
function updateAction(now) {
if (actionStart === null) {
rightArm.rotation.set(0, 0, 0);
leftArm.rotation.set(0, 0, 0);
upperBody.rotation.z = 0;
head.rotation.y = 0;
return;
}
const progress = clamp01((now - actionStart) / actionDuration);
const reach =
smoothstep(0, 0.42, progress) *
(1 - smoothstep(0.72, 1, progress));
const nudge = smoothstep(0.46, 0.7, progress);
rightArm.rotation.set(
-0.45 * reach,
0,
1.3 * reach
);
leftArm.rotation.set(
0.12 * reach,
0,
-0.22 * reach
);
upperBody.rotation.z = -0.09 * reach;
head.rotation.y = 0.28 * reach;
head.rotation.z = -0.035 * reach;
actionClod.position.set(
actionClodHome.x + 0.4 * nudge,
actionClodHome.y + 0.025 * Math.sin(nudge * Math.PI),
actionClodHome.z + 0.1 * nudge
);
if (progress >= 1) {
actionStart = null;
actionFinished = true;
actionButton.disabled = false;
actionButton.textContent = "Replay action";
status.textContent =
"Pip nudges one loose soil block. The pot’s earlier cause remains unknown.";
}
}
actionButton.addEventListener("click", startAction);
resetButton.addEventListener("click", () => {
actionStart = null;
actionFinished = false;
actionClod.position.copy(actionClodHome);
rightArm.rotation.set(0, 0, 0);
leftArm.rotation.set(0, 0, 0);
upperBody.rotation.z = 0;
head.rotation.y = 0;
actionButton.disabled = false;
actionButton.textContent = "Show a small action";
status.textContent =
"Nothing in the scene explains how the pot became tipped.";
resetCamera();
});
addEventListener("resize", () => {
camera.aspect = innerWidth / innerHeight;
camera.updateProjectionMatrix();
renderer.setSize(innerWidth, innerHeight);
renderer.setPixelRatio(Math.min(devicePixelRatio, 2));
});
function animate(now) {
requestAnimationFrame(animate);
updateCamera();
updateAction(now);
// Subtle breathing and scarf movement while the scene is idle.
const idle = Math.sin(now * 0.0016) * 0.008;
upperBody.position.y = 1.05 + idle;
head.rotation.x = Math.sin(now * 0.0012) * 0.012;
renderer.render(scene, camera);
}
updateCamera();
requestAnimationFrame(animate);
</script>
</body>
</html>
```