Prompt specification
Build or customize the Three.js 3D scene "Clone garden watering 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: Clone garden watering comparison
Category: Biology & Nature · Style: Procedural Solid / Shader 3D
License: MIT · Reference: https://three3d.app/scene/clone-garden-watering-comparison-x0942
Scene Description Prompt:
Create a single self-contained HTML file using Three.js from cdnjs that shows phenotypic plasticity. Arrange matched plant clones in equal pots with differing water availability; illustrate distinct growth states with a qualitative label and no agricultural dosage guidance. Stylized solid forms.
Working Three.js Starter (clone-garden-watering-comparison-x0942):
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Phenotypic Plasticity — Matched Clones</title>
<style>
:root {
--ink: #18342d;
--muted: #5c7069;
--panel: rgba(255, 255, 255, 0.88);
--line: rgba(24, 52, 45, 0.13);
--blue: #2d83a8;
--low: #a46f46;
--moderate: #4e8a59;
--high: #247542;
}
* {
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: #eaf0eb;
color: var(--ink);
font-family:
Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
"Segoe UI", sans-serif;
}
#scene {
position: fixed;
inset: 0;
}
canvas {
display: block;
width: 100%;
height: 100%;
outline: none;
touch-action: none;
}
.hud {
position: fixed;
inset: 0;
pointer-events: none;
}
.intro {
position: absolute;
top: 24px;
left: 28px;
max-width: 520px;
padding: 18px 20px 17px;
border: 1px solid rgba(255, 255, 255, 0.72);
border-radius: 18px;
background: var(--panel);
box-shadow: 0 12px 36px rgba(40, 67, 58, 0.10);
backdrop-filter: blur(14px);
}
.eyebrow {
margin-bottom: 7px;
color: #35705f;
font-size: 10px;
font-weight: 800;
letter-spacing: 0.15em;
text-transform: uppercase;
}
h1 {
margin: 0;
font-size: clamp(24px, 3vw, 38px);
line-height: 1.04;
letter-spacing: -0.045em;
}
.intro p {
max-width: 440px;
margin: 10px 0 0;
color: var(--muted);
font-size: 13px;
line-height: 1.55;
}
.controls {
position: absolute;
top: 25px;
right: 28px;
display: flex;
align-items: center;
gap: 10px;
pointer-events: auto;
}
.controls span,
.controls button {
border: 1px solid var(--line);
border-radius: 999px;
background: var(--panel);
color: var(--muted);
box-shadow: 0 8px 24px rgba(40, 67, 58, 0.08);
backdrop-filter: blur(12px);
}
.controls span {
padding: 9px 13px;
font-size: 11px;
}
.controls button {
padding: 9px 13px;
font: inherit;
font-size: 11px;
font-weight: 750;
cursor: pointer;
transition: background 160ms ease, transform 160ms ease;
}
.controls button:hover {
background: #fff;
transform: translateY(-1px);
}
.controls button:focus-visible {
outline: 3px solid rgba(45, 131, 168, 0.28);
outline-offset: 2px;
}
.pin {
position: absolute;
min-width: 124px;
padding: 8px 11px;
border: 1px solid rgba(255, 255, 255, 0.86);
border-radius: 12px;
background: rgba(255, 255, 255, 0.91);
box-shadow: 0 8px 20px rgba(42, 69, 60, 0.12);
text-align: center;
transform: translate(-50%, -100%);
will-change: left, top;
}
.pin::after {
content: "";
position: absolute;
left: 50%;
bottom: -6px;
width: 10px;
height: 10px;
border-right: 1px solid rgba(255, 255, 255, 0.86);
border-bottom: 1px solid rgba(255, 255, 255, 0.86);
background: rgba(255, 255, 255, 0.91);
transform: translateX(-50%) rotate(45deg);
}
.pin span,
.pin strong {
display: block;
}
.pin span {
color: var(--muted);
font-size: 9px;
font-weight: 850;
letter-spacing: 0.12em;
}
.pin strong {
margin-top: 3px;
font-size: 12px;
letter-spacing: -0.01em;
}
.pin.low strong {
color: var(--low);
}
.pin.moderate strong {
color: var(--moderate);
}
.pin.high strong {
color: var(--high);
}
.interpretation {
position: absolute;
left: 50%;
bottom: 20px;
width: min(900px, calc(100% - 36px));
padding: 13px 16px 11px;
border: 1px solid rgba(255, 255, 255, 0.78);
border-radius: 17px;
background: var(--panel);
box-shadow: 0 12px 36px rgba(40, 67, 58, 0.10);
transform: translateX(-50%);
backdrop-filter: blur(14px);
}
.state-grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 8px;
}
.state {
display: grid;
grid-template-columns: 9px 1fr;
column-gap: 9px;
align-items: center;
padding: 5px 9px;
}
.state i {
width: 9px;
height: 28px;
border-radius: 99px;
background: currentColor;
}
.state span,
.state b {
display: block;
}
.state span {
color: var(--muted);
font-size: 9px;
font-weight: 800;
letter-spacing: 0.11em;
text-transform: uppercase;
}
.state b {
margin-top: 2px;
font-size: 12px;
}
.state.low {
color: var(--low);
}
.state.moderate {
color: var(--moderate);
}
.state.high {
color: var(--high);
}
.note {
margin: 9px 3px 0;
padding-top: 8px;
border-top: 1px solid var(--line);
color: var(--muted);
font-size: 10px;
line-height: 1.45;
text-align: center;
}
@media (max-width: 760px) {
.intro {
top: 12px;
left: 12px;
right: 12px;
max-width: none;
padding: 13px 15px;
}
.intro p {
margin-top: 7px;
font-size: 11px;
}
.controls {
display: none;
}
.pin {
min-width: 94px;
padding: 6px 7px;
}
.pin strong {
display: none;
}
.interpretation {
bottom: 10px;
width: calc(100% - 20px);
padding: 9px;
}
.state {
padding: 4px 3px;
column-gap: 5px;
}
.state b {
font-size: 10px;
}
.state span {
font-size: 7px;
}
.note {
font-size: 9px;
}
}
@media (prefers-reduced-motion: reduce) {
.controls button {
transition: none;
}
}
</style>
</head>
<body>
<div id="scene" aria-label="Interactive three-dimensional comparison of matched plant clones"></div>
<div class="hud">
<header class="intro">
<div class="eyebrow">Controlled environment comparison</div>
<h1>One genotype.<br />Three growth states.</h1>
<p>
Matched clones are grown in equal pots. Water availability changes,
revealing distinct phenotypic growth forms.
</p>
</header>
<div class="controls" aria-label="Camera controls">
<span>Drag to orbit · Scroll to zoom</span>
<button id="reset" type="button" title="Reset camera">Reset view</button>
</div>
<div class="pin low" id="pin-low">
<span>LOW WATER</span>
<strong>Stress-compact</strong>
</div>
<div class="pin moderate" id="pin-moderate">
<span>MODERATE WATER</span>
<strong>Intermediate</strong>
</div>
<div class="pin high" id="pin-high">
<span>HIGH WATER</span>
<strong>Expanded</strong>
</div>
<section class="interpretation" aria-label="Qualitative growth-state legend">
<div class="state-grid">
<div class="state low">
<i></i>
<div>
<span>Low water</span>
<b>Stress-compact</b>
</div>
</div>
<div class="state moderate">
<i></i>
<div>
<span>Moderate water</span>
<b>Intermediate</b>
</div>
</div>
<div class="state high">
<i></i>
<div>
<span>High water</span>
<b>Expanded</b>
</div>
</div>
</div>
<p class="note">
Phenotypic plasticity changes form in response to the environment while
genotype remains matched. Categories and labels are qualitative only.
</p>
</section>
</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.getElementById("scene");
const reducedMotion = window.matchMedia(
"(prefers-reduced-motion: reduce)"
).matches;
const scene = new THREE.Scene();
scene.background = new THREE.Color(0xeaf0eb);
scene.fog = new THREE.Fog(0xeaf0eb, 26, 48);
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.setAttribute(
"aria-label",
"Three pairs of matched plant clones under low, moderate, and high water availability"
);
renderer.domElement.tabIndex = 0;
const camera = new THREE.OrthographicCamera(-8, 8, 5, -5, 0.1, 100);
const target = new THREE.Vector3(0, 1.65, 0);
const controls = {
theta: 0.13,
phi: 1.08,
radius: 20,
zoom: 1
};
const defaultControls = { ...controls };
function updateCamera() {
const spherical = new THREE.Spherical(
controls.radius,
controls.phi,
controls.theta
);
camera.position.setFromSpherical(spherical).add(target);
camera.lookAt(target);
camera.zoom = controls.zoom;
camera.updateProjectionMatrix();
}
function resize() {
const width = window.innerWidth;
const height = window.innerHeight;
const aspect = width / height;
const worldWidth = 14.2;
const viewHeight = Math.max(8.2, worldWidth / aspect);
camera.left = (-viewHeight * aspect) / 2;
camera.right = (viewHeight * aspect) / 2;
camera.top = viewHeight / 2;
camera.bottom = -viewHeight / 2;
camera.updateProjectionMatrix();
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.setSize(width, height);
}
window.addEventListener("resize", resize);
resize();
updateCamera();
// Lighting
const hemisphere = new THREE.HemisphereLight(0xf7fff9, 0x788275, 2.2);
scene.add(hemisphere);
const keyLight = new THREE.DirectionalLight(0xfff8e9, 3.4);
keyLight.position.set(-6, 12, 8);
keyLight.castShadow = true;
keyLight.shadow.mapSize.set(2048, 2048);
keyLight.shadow.camera.left = -12;
keyLight.shadow.camera.right = 12;
keyLight.shadow.camera.top = 10;
keyLight.shadow.camera.bottom = -8;
keyLight.shadow.camera.near = 0.5;
keyLight.shadow.camera.far = 35;
keyLight.shadow.normalBias = 0.025;
keyLight.shadow.bias = -0.00012;
scene.add(keyLight);
const fillLight = new THREE.DirectionalLight(0xbddce2, 1.35);
fillLight.position.set(8, 6, -7);
scene.add(fillLight);
// Ground and shared geometry
const ground = new THREE.Mesh(
new THREE.PlaneGeometry(60, 60),
new THREE.MeshStandardMaterial({
color: 0xe5ece6,
roughness: 0.98,
metalness: 0
})
);
ground.rotation.x = -Math.PI / 2;
ground.position.y = -0.035;
ground.receiveShadow = true;
scene.add(ground);
const stemGeometry = new THREE.CylinderGeometry(1, 1, 1, 10);
const leafGeometry = new THREE.SphereGeometry(1, 14, 9);
const potGeometry = new THREE.CylinderGeometry(0.58, 0.46, 0.72, 28);
const rimGeometry = new THREE.TorusGeometry(0.545, 0.052, 10, 32);
const soilGeometry = new THREE.CylinderGeometry(0.515, 0.515, 0.055, 28);
const tagGeometry = new THREE.PlaneGeometry(0.21, 0.21);
const potMaterial = new THREE.MeshStandardMaterial({
color: 0xc87350,
roughness: 0.76,
metalness: 0
});
const rimMaterial = new THREE.MeshStandardMaterial({
color: 0xdf8961,
roughness: 0.7,
metalness: 0
});
function makeCloneTagTexture(letter) {
const canvas = document.createElement("canvas");
canvas.width = 128;
canvas.height = 128;
const context = canvas.getContext("2d");
context.clearRect(0, 0, 128, 128);
context.beginPath();
context.arc(64, 64, 48, 0, Math.PI * 2);
context.fillStyle = "#f8f1e6";
context.fill();
context.lineWidth = 7;
context.strokeStyle = "#765344";
context.stroke();
context.fillStyle = "#4f3c33";
context.font = "bold 62px sans-serif";
context.textAlign = "center";
context.textBaseline = "middle";
context.fillText(letter, 64, 68);
const texture = new THREE.CanvasTexture(canvas);
texture.colorSpace = THREE.SRGBColorSpace;
texture.anisotropy = Math.min(
4,
renderer.capabilities.getMaxAnisotropy()
);
return texture;
}
const tagTextures = [
makeCloneTagTexture("A"),
makeCloneTagTexture("B")
];
function cylinderBetween(parent, a, b, radius, material) {
const direction = new THREE.Vector3().subVectors(b, a);
const length = direction.length();
const midpoint = new THREE.Vector3()
.addVectors(a, b)
.multiplyScalar(0.5);
const mesh = new THREE.Mesh(stemGeometry, material);
mesh.position.copy(midpoint);
mesh.scale.set(radius, length, radius);
mesh.quaternion.setFromUnitVectors(
new THREE.Vector3(0, 1, 0),
direction.normalize()
);
mesh.castShadow = true;
mesh.receiveShadow = true;
parent.add(mesh);
return mesh;
}
function addLeaf(parent, position, direction, size, material) {
const leaf = new THREE.Mesh(leafGeometry, material);
leaf.position.copy(position);
leaf.scale.set(size * 0.38, size * 0.145, size);
leaf.quaternion.setFromUnitVectors(
new THREE.Vector3(0, 0, 1),
direction.clone().normalize()
);
leaf.castShadow = true;
leaf.receiveShadow = true;
parent.add(leaf);
return leaf;
}
const environments = [
{
id: "low",
x: -4.6,
height: 1.32,
spread: 0.54,
branchRise: 0.1,
branchLevels: 4,
leavesPerBranch: 1,
leafSize: 0.37,
leafLift: -0.04,
phase: 0.4,
padColor: 0xe6d6c2,
soilColor: 0xc39770,
stemColor: 0x526b3d,
leafColors: [0x789267, 0x6b835c],
pinHeight: 2.72
},
{
id: "moderate",
x: 0,
height: 2.12,
spread: 0.88,
branchRise: 0.16,
branchLevels: 6,
leavesPerBranch: 2,
leafSize: 0.42,
leafLift: 0.2,
phase: 1.1,
padColor: 0xd4e0d4,
soilColor: 0x79523b,
stemColor: 0x356943,
leafColors: [0x4f8c57, 0x3f7548],
pinHeight: 3.55
},
{
id: "high",
x: 4.6,
height: 3.15,
spread: 1.18,
branchRise: 0.24,
branchLevels: 8,
leavesPerBranch: 2,
leafSize: 0.47,
leafLift: 0.34,
phase: 2.2,
padColor: 0xc6dac8,
soilColor: 0x493027,
stemColor: 0x276d3d,
leafColors: [0x2f8a49, 0x24733c],
pinHeight: 4.78
}
];
const plants = [];
const pinAnchors = {};
function buildPot(x, z, environment, cloneIndex) {
const pot = new THREE.Group();
pot.position.set(x, 0, z);
scene.add(pot);
const body = new THREE.Mesh(potGeometry, potMaterial);
body.position.y = 0.42;
body.castShadow = true;
body.receiveShadow = true;
pot.add(body);
const rim = new THREE.Mesh(rimGeometry, rimMaterial);
rim.rotation.x = Math.PI / 2;
rim.position.y = 0.78;
rim.castShadow = true;
rim.receiveShadow = true;
pot.add(rim);
const soil = new THREE.Mesh(
soilGeometry,
new THREE.MeshStandardMaterial({
color: environment.soilColor,
roughness: 1,
metalness: 0
})
);
soil.position.y = 0.805;
soil.receiveShadow = true;
pot.add(soil);
const tag = new THREE.Mesh(
tagGeometry,
new THREE.MeshBasicMaterial({
map: tagTextures[cloneIndex],
transparent: true,
toneMapped: false
})
);
tag.position.set(0, 0.46, 0.525);
pot.add(tag);
return pot;
}
function buildPlant(x, z, environment, cloneIndex) {
buildPot(x, z, environment, cloneIndex);
const pivot = new THREE.Group();
pivot.position.set(x, 0.82, z);
scene.add(pivot);
const stemMaterial = new THREE.MeshStandardMaterial({
color: environment.stemColor,
roughness: 0.8,
metalness: 0
});
const leafMaterials = environment.leafColors.map(
(color) =>
new THREE.MeshStandardMaterial({
color,
roughness: 0.84,
metalness: 0
})
);
const points = [
new THREE.Vector3(0, 0, 0),
new THREE.Vector3(0.025, environment.height * 0.28, 0.015),
new THREE.Vector3(-0.02, environment.height * 0.6, -0.018),
new THREE.Vector3(0, environment.height, 0)
];
for (let i = 0; i < points.length - 1; i++) {
cylinderBetween(
pivot,
points[i],
points[i + 1],
0.045 - i * 0.006,
stemMaterial
);
}
const goldenAngle = Math.PI * (3 - Math.sqrt(5));
for (let i = 0; i < environment.branchLevels; i++) {
const level = 0.22 + (i / (environment.branchLevels - 1)) * 0.65;
const start = new THREE.Vector3(
0.012 * Math.sin(i * 1.7),
environment.height * level,
0.012 * Math.cos(i * 1.3)
);
const angle =
environment.phase + i * goldenAngle + cloneIndex * 0.025;
const length =
environment.spread *
(0.72 + 0.28 * (1 - level)) *
(1 + 0.025 * cloneIndex);
const end = new THREE.Vector3(
start.x + Math.cos(angle) * length,
start.y + environment.branchRise * (0.8 + level * 0.4),
start.z + Math.sin(angle) * length
);
cylinderBetween(
pivot,
start,
end,
0.025,
stemMaterial
);
for (let leafIndex = 0; leafIndex < environment.leavesPerBranch; leafIndex++) {
const leafAngle = angle + leafIndex * 1.12;
const leafDirection = new THREE.Vector3(
Math.cos(leafAngle),
environment.leafLift + leafIndex * 0.12,
Math.sin(leafAngle)
).normalize();
const size =
environment.leafSize *
(1 - level * 0.12) *
(1 + 0.035 * cloneIndex);
const leafPosition = end
.clone()
.addScaledVector(leafDirection, size * 0.34);
addLeaf(
pivot,
leafPosition,
leafDirection,
size,
leafMaterials[(i + leafIndex) % leafMaterials.length]
);
}
}
const topCount = environment.id === "low" ? 2 : environment.id === "moderate" ? 3 : 4;
for (let i = 0; i < topCount; i++) {
const angle =
environment.phase + i * goldenAngle + Math.PI * 0.25;
const direction = new THREE.Vector3(
Math.cos(angle),
0.52,
Math.sin(angle)
).normalize();
const size = environment.leafSize * (1.04 - i * 0.035);
const position = new THREE.Vector3(
0,
environment.height - 0.03,
0
).addScaledVector(direction, size * 0.36);
addLeaf(
pivot,
position,
direction,
size,
leafMaterials[i % leafMaterials.length]
);
}
plants.push({
pivot,
phase: environment.phase + cloneIndex * 0.7
});
}
environments.forEach((environment) => {
const pad = new THREE.Mesh(
new THREE.BoxGeometry(3.18, 0.1, 2.72),
new THREE.MeshStandardMaterial({
color: environment.padColor,
roughness: 0.96,
metalness: 0
})
);
pad.position.set(environment.x, 0.015, 0);
pad.receiveShadow = true;
scene.add(pad);
// A soft, solid blue marker gives each station a consistent water cue.
const markerColor =
environment.id === "low"
? 0x72a9bb
: environment.id === "moderate"
? 0x408fa8
: 0x247e9f;
const marker = new THREE.Mesh(
new THREE.SphereGeometry(0.13, 16, 10),
new THREE.MeshStandardMaterial({
color: markerColor,
roughness: 0.48,
metalness: 0
})
);
marker.scale.set(1, 0.42, 1);
marker.position.set(environment.x, 0.16, 1.2);
marker.castShadow = true;
scene.add(marker);
buildPlant(
environment.x - 0.72,
0.58,
environment,
0
);
buildPlant(
environment.x + 0.72,
-0.58,
environment,
1
);
pinAnchors[environment.id] = new THREE.Vector3(
environment.x,
environment.pinHeight,
0
);
});
// HTML labels projected from fixed points in the scene.
const pins = {
low: document.getElementById("pin-low"),
moderate: document.getElementById("pin-moderate"),
high: document.getElementById("pin-high")
};
function updatePins() {
Object.entries(pinAnchors).forEach(([id, anchor]) => {
const projected = anchor.clone().project(camera);
const x = (projected.x * 0.5 + 0.5) * window.innerWidth;
const y = (-projected.y * 0.5 + 0.5) * window.innerHeight;
pins[id].style.left = `${x}px`;
pins[id].style.top = `${y}px`;
pins[id].style.visibility =
projected.z > -1 && projected.z < 1 ? "visible" : "hidden";
});
}
// Direct, dependency-free camera controls.
let dragging = false;
let pointerId = null;
let previousX = 0;
let previousY = 0;
const canvas = renderer.domElement;
canvas.addEventListener("pointerdown", (event) => {
dragging = true;
pointerId = event.pointerId;
previousX = event.clientX;
previousY = event.clientY;
canvas.setPointerCapture(event.pointerId);
canvas.style.cursor = "grabbing";
});
canvas.addEventListener("pointermove", (event) => {
if (!dragging || event.pointerId !== pointerId) return;
const deltaX = event.clientX - previousX;
const deltaY = event.clientY - previousY;
previousX = event.clientX;
previousY = event.clientY;
controls.theta -= deltaX * 0.006;
controls.phi = THREE.MathUtils.clamp(
controls.phi - deltaY * 0.005,
0.58,
1.38
);
updateCamera();
});
function endDrag(event) {
if (event.pointerId !== pointerId) return;
dragging = false;
pointerId = null;
canvas.style.cursor = "grab";
}
canvas.addEventListener("pointerup", endDrag);
canvas.addEventListener("pointercancel", endDrag);
canvas.addEventListener(
"wheel",
(event) => {
event.preventDefault();
const factor = Math.exp(-event.deltaY * 0.001);
controls.zoom = THREE.MathUtils.clamp(
controls.zoom * factor,
0.72,
1.7
);
updateCamera();
},
{ passive: false }
);
function resetView() {
controls.theta = defaultControls.theta;
controls.phi = defaultControls.phi;
controls.radius = defaultControls.radius;
controls.zoom = defaultControls.zoom;
updateCamera();
}
canvas.addEventListener("dblclick", resetView);
document.getElementById("reset").addEventListener("click", resetView);
window.addEventListener("keydown", (event) => {
if (event.target instanceof HTMLInputElement) return;
if (event.key === "ArrowLeft") controls.theta += 0.08;
else if (event.key === "ArrowRight") controls.theta -= 0.08;
else if (event.key === "ArrowUp") controls.phi -= 0.06;
else if (event.key === "ArrowDown") controls.phi += 0.06;
else if (event.key === "+" || event.key === "=") controls.zoom += 0.08;
else if (event.key === "-" || event.key === "_") controls.zoom -= 0.08;
else if (event.key.toLowerCase() === "r") {
resetView();
} else {
return;
}
controls.phi = THREE.MathUtils.clamp(controls.phi, 0.58, 1.38);
controls.zoom = THREE.MathUtils.clamp(controls.zoom, 0.72, 1.7);
updateCamera();
});
canvas.style.cursor = "grab";
const clock = new THREE.Clock();
function animate() {
const elapsed = clock.getElapsedTime();
if (!reducedMotion) {
plants.forEach(({ pivot, phase }) => {
pivot.rotation.z = Math.sin(elapsed * 0.8 + phase) * 0.012;
pivot.rotation.x = Math.cos(elapsed * 0.64 + phase) * 0.007;
});
}
updatePins();
renderer.render(scene, camera);
}
renderer.setAnimationLoop(animate);
</script>
</body>
</html>
```