Prompt specification
Build or customize the Three.js 3D scene "Hopscotch Tiles With Foot Symbols" 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: Hopscotch Tiles With Foot Symbols
Category: Games & Play · Style: Procedural Solid / Shader 3D
License: MIT · Reference: https://three3d.app/scene/hopscotch-tiles-with-foot-symbols-x3617
Scene Description Prompt:
Model an original hopscotch layout with numbered tiles and one-foot or two-foot symbols. Keep the pattern readable without attributing it to one universal traditional ruleset. Use Three.js from cdnjs in a single HTML file, with stylized solid shapes.
Working Three.js Starter (hopscotch-tiles-with-foot-symbols-x3617):
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Twinprint 10 — Original Hopscotch Layout</title>
<style>
:root {
--ink: #172633;
--paper: #f4f1e8;
--glass: rgba(247, 244, 236, 0.88);
--line: rgba(23, 38, 51, 0.16);
}
* {
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: #dce8e5;
color: var(--ink);
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%;
touch-action: none;
outline: none;
}
.intro {
position: fixed;
top: 30px;
left: 34px;
z-index: 5;
width: min(430px, calc(100vw - 68px));
pointer-events: none;
}
.eyebrow {
display: flex;
align-items: center;
gap: 9px;
margin-bottom: 10px;
color: rgba(23, 38, 51, 0.68);
font-size: 11px;
font-weight: 800;
letter-spacing: 0.16em;
text-transform: uppercase;
}
.eyebrow::before {
width: 22px;
height: 3px;
border-radius: 99px;
background: #ef6a5b;
content: "";
}
h1 {
margin: 0;
font-size: clamp(38px, 5vw, 66px);
font-weight: 850;
letter-spacing: -0.065em;
line-height: 0.92;
}
.intro p {
max-width: 390px;
margin: 15px 0 0;
color: rgba(23, 38, 51, 0.73);
font-size: 14px;
line-height: 1.55;
}
.tag {
display: inline-flex;
margin-top: 14px;
padding: 7px 10px;
border: 1px solid var(--line);
border-radius: 99px;
background: rgba(247, 244, 236, 0.54);
color: rgba(23, 38, 51, 0.67);
font-size: 10px;
font-weight: 750;
letter-spacing: 0.08em;
text-transform: uppercase;
}
.controls {
position: fixed;
top: 30px;
right: 32px;
z-index: 8;
display: flex;
gap: 8px;
}
button {
min-height: 38px;
padding: 0 14px;
border: 1px solid rgba(23, 38, 51, 0.16);
border-radius: 12px;
background: var(--glass);
box-shadow: 0 8px 25px rgba(23, 38, 51, 0.08);
color: var(--ink);
font: inherit;
font-size: 11px;
font-weight: 750;
letter-spacing: 0.04em;
cursor: pointer;
backdrop-filter: blur(12px);
transition:
transform 160ms ease,
background 160ms ease;
}
button:hover {
background: #fffaf0;
transform: translateY(-1px);
}
button:active {
transform: translateY(1px);
}
button:focus-visible {
outline: 3px solid rgba(78, 120, 198, 0.45);
outline-offset: 3px;
}
.legend {
position: fixed;
left: 32px;
bottom: 28px;
z-index: 6;
display: flex;
align-items: stretch;
gap: 1px;
overflow: hidden;
border: 1px solid var(--line);
border-radius: 16px;
background: var(--glass);
box-shadow: 0 14px 36px rgba(23, 38, 51, 0.1);
backdrop-filter: blur(14px);
pointer-events: none;
}
.legend-item {
display: flex;
align-items: center;
gap: 10px;
min-width: 144px;
padding: 11px 14px;
border-right: 1px solid var(--line);
}
.legend-item:last-child {
border-right: 0;
}
.legend svg {
flex: 0 0 auto;
width: 30px;
height: 30px;
fill: var(--ink);
}
.legend strong,
.legend span {
display: block;
}
.legend strong {
font-size: 11px;
font-weight: 850;
letter-spacing: 0.07em;
text-transform: uppercase;
}
.legend span {
margin-top: 2px;
color: rgba(23, 38, 51, 0.56);
font-size: 10px;
}
.help {
position: fixed;
right: 32px;
bottom: 31px;
z-index: 5;
color: rgba(23, 38, 51, 0.55);
font-size: 10px;
font-weight: 700;
letter-spacing: 0.055em;
text-transform: uppercase;
pointer-events: none;
}
#loading {
position: fixed;
inset: 0;
z-index: 20;
display: grid;
place-items: center;
background: #dce8e5;
color: var(--ink);
font-size: 12px;
font-weight: 750;
letter-spacing: 0.12em;
text-transform: uppercase;
transition: opacity 350ms ease;
}
#loading.ready {
opacity: 0;
pointer-events: none;
}
@media (max-width: 720px) {
.intro {
top: 18px;
left: 18px;
width: calc(100vw - 36px);
}
h1 {
font-size: 42px;
}
.intro p {
max-width: 310px;
margin-top: 10px;
font-size: 12px;
}
.tag {
margin-top: 9px;
}
.controls {
top: auto;
right: 16px;
bottom: 18px;
}
.legend {
right: 16px;
bottom: 68px;
left: 16px;
}
.legend-item {
flex: 1;
min-width: 0;
padding: 9px 10px;
}
.legend-item:nth-child(3) {
display: none;
}
.legend svg {
width: 24px;
height: 24px;
}
.help {
display: none;
}
}
</style>
</head>
<body>
<main id="scene" aria-label="Interactive 3D model of the Twinprint 10 hopscotch layout"></main>
<header class="intro">
<div class="eyebrow">Solid play / original route</div>
<h1>Twinprint 10</h1>
<p>
A custom ten-stop zigzag. Single or paired footprints identify the
intended one-foot or two-foot landing; the numbers establish the order.
</p>
<div class="tag">Original layout · no universal ruleset implied</div>
</header>
<nav class="controls" aria-label="Camera controls">
<button id="reset" type="button" title="Reset camera view">Reset view</button>
</nav>
<aside class="legend" aria-label="Layout legend">
<div class="legend-item">
<svg viewBox="0 0 48 48" aria-hidden="true">
<path d="M18.8 41.5C12.8 37.8 9.7 30.7 11.4 21.6
C12.7 14.8 16.2 7.7 22 7.1
C28.4 6.4 31.5 12.2 29.2 19.3
C27.7 24.2 27 30.4 23.5 37.2
C22.4 39.5 20.7 42.3 18.8 41.5Z"/>
</svg>
<div>
<strong>One foot</strong>
<span>single print</span>
</div>
</div>
<div class="legend-item">
<svg viewBox="0 0 48 48" aria-hidden="true">
<path d="M13.1 39.7C8.7 36.7 6.5 31.2 7.8 24.2
C8.9 18.6 11.5 13.1 15.8 12.6
C20.6 12.1 22.8 16.5 21 21.8
C19.8 25.4 19.3 30.1 16.7 35.2
C15.8 37 14.4 40.7 13.1 39.7Z"/>
<path d="M31.2 34.7C26.8 31.7 24.6 26.2 25.9 19.2
C27 13.6 29.6 8.1 33.9 7.6
C38.7 7.1 40.9 11.5 39.1 16.8
C37.9 20.4 37.4 25.1 34.8 30.2
C33.9 32 32.5 35.7 31.2 34.7Z"/>
</svg>
<div>
<strong>Two feet</strong>
<span>paired prints</span>
</div>
</div>
<div class="legend-item">
<svg viewBox="0 0 48 48" aria-hidden="true">
<path d="M8 24h25M27 16l8 8-8 8"
fill="none" stroke="currentColor" stroke-width="3.5"
stroke-linecap="round" stroke-linejoin="round"/>
</svg>
<div>
<strong>Order</strong>
<span>follow 1 → 10</span>
</div>
</div>
</aside>
<div class="help">Drag to orbit · wheel to zoom · right-drag to pan</div>
<div id="loading">Building layout…</div>
<script type="module">
import * as THREE from
"https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
const mount = document.querySelector("#scene");
const loading = document.querySelector("#loading");
const resetButton = document.querySelector("#reset");
const reducedMotion = matchMedia("(prefers-reduced-motion: reduce)").matches;
// ---------------------------------------------------------------------
// Renderer, scene, camera, and lighting
// ---------------------------------------------------------------------
const scene = new THREE.Scene();
scene.background = new THREE.Color("#dce8e5");
scene.fog = new THREE.Fog("#dce8e5", 31, 58);
const camera = new THREE.PerspectiveCamera(
42,
innerWidth / innerHeight,
0.1,
100
);
const renderer = new THREE.WebGLRenderer({
antialias: true,
alpha: false,
powerPreference: "high-performance"
});
renderer.setPixelRatio(Math.min(devicePixelRatio, 2));
renderer.setSize(innerWidth, innerHeight);
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1.05;
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
renderer.domElement.setAttribute(
"aria-label",
"Interactive three-dimensional view of a custom numbered hopscotch path"
);
mount.appendChild(renderer.domElement);
const hemisphere = new THREE.HemisphereLight(
0xfff8e8,
0x708e98,
2.25
);
scene.add(hemisphere);
const sun = new THREE.DirectionalLight(0xfff1d6, 3.2);
sun.position.set(-10, 22, 12);
sun.castShadow = true;
sun.shadow.mapSize.set(2048, 2048);
sun.shadow.camera.left = -10;
sun.shadow.camera.right = 10;
sun.shadow.camera.top = 15;
sun.shadow.camera.bottom = -15;
sun.shadow.camera.near = 1;
sun.shadow.camera.far = 60;
sun.shadow.bias = -0.0004;
sun.shadow.normalBias = 0.025;
sun.target.position.set(0, 0, -3.5);
scene.add(sun, sun.target);
const fill = new THREE.DirectionalLight(0xb8d9ff, 1.1);
fill.position.set(12, 8, -12);
scene.add(fill);
// ---------------------------------------------------------------------
// Solid-shape helpers
// ---------------------------------------------------------------------
function roundedRectangleShape(width, height, radius) {
const x = -width / 2;
const y = -height / 2;
const r = Math.min(radius, width / 2, height / 2);
const shape = new THREE.Shape();
shape.moveTo(x + r, y);
shape.lineTo(x + width - r, y);
shape.quadraticCurveTo(x + width, y, x + width, y + r);
shape.lineTo(x + width, y + height - r);
shape.quadraticCurveTo(
x + width,
y + height,
x + width - r,
y + height
);
shape.lineTo(x + r, y + height);
shape.quadraticCurveTo(x, y + height, x, y + height - r);
shape.lineTo(x, y + r);
shape.quadraticCurveTo(x, y, x + r, y);
return shape;
}
function createSlabGeometry(
width,
depth,
thickness,
radius,
bevelSize = 0.055
) {
const geometry = new THREE.ExtrudeGeometry(
roundedRectangleShape(width, depth, radius),
{
depth: thickness,
steps: 1,
curveSegments: 12,
bevelEnabled: true,
bevelSegments: 3,
bevelSize,
bevelThickness: Math.min(0.045, thickness * 0.35)
}
);
geometry.rotateX(-Math.PI / 2);
geometry.computeVertexNormals();
return geometry;
}
// ---------------------------------------------------------------------
// Courtyard and small environmental solids
// ---------------------------------------------------------------------
const ground = new THREE.Mesh(
new THREE.PlaneGeometry(100, 100),
new THREE.MeshStandardMaterial({
color: "#d8e3df",
roughness: 1,
metalness: 0
})
);
ground.rotation.x = -Math.PI / 2;
ground.position.y = -0.1;
ground.receiveShadow = true;
scene.add(ground);
const court = new THREE.Mesh(
createSlabGeometry(8.25, 21.2, 0.075, 1.1, 0.035),
new THREE.MeshStandardMaterial({
color: "#eeeae0",
roughness: 0.96,
metalness: 0
})
);
court.position.set(0, -0.08, -3.55);
court.receiveShadow = true;
scene.add(court);
const decorativePieces = [
[-3.25, 6.2, 0.35, "#b4c8c0"],
[3.45, 5.55, 0.5, "#c8beb0"],
[-3.55, 2.9, 0.46, "#b8c5cc"],
[3.55, 0.15, 0.34, "#b4c8c0"],
[-3.55, -3.55, 0.48, "#c8beb0"],
[3.65, -5.85, 0.4, "#b8c5cc"],
[-3.55, -9.2, 0.35, "#b4c8c0"],
[3.6, -12.3, 0.5, "#c8beb0"]
];
for (const [x, z, radius, color] of decorativePieces) {
const piece = new THREE.Mesh(
new THREE.CylinderGeometry(radius, radius * 0.9, 0.2, 12),
new THREE.MeshStandardMaterial({
color,
roughness: 0.95,
metalness: 0
})
);
piece.position.set(x, 0, z);
piece.castShadow = true;
piece.receiveShadow = true;
scene.add(piece);
}
// ---------------------------------------------------------------------
// Canvas-generated tile graphics: number + one/two footprint symbols
// ---------------------------------------------------------------------
function drawFootprint(context, x, y, scale, color, angle = 0) {
context.save();
context.translate(x, y);
context.rotate(angle);
context.scale(scale, scale);
context.fillStyle = color;
context.beginPath();
context.moveTo(-7, 31);
context.bezierCurveTo(-17, 22, -20, 8, -15, -7);
context.bezierCurveTo(-11, -21, -1, -31, 9, -28);
context.bezierCurveTo(18, -25, 19, -13, 14, -2);
context.bezierCurveTo(10, 8, 7, 20, 1, 30);
context.bezierCurveTo(-2, 34, -5, 34, -7, 31);
context.closePath();
context.fill();
context.restore();
}
function createTileLabel(number, feet) {
const canvas = document.createElement("canvas");
const context = canvas.getContext("2d");
const ink = "#172633";
if (feet === 2) {
canvas.width = 768;
canvas.height = 384;
context.fillStyle = ink;
context.textAlign = "center";
context.textBaseline = "middle";
context.font = "800 188px Arial, Helvetica, sans-serif";
context.fillText(String(number), 145, 194);
context.strokeStyle = "rgba(23, 38, 51, 0.22)";
context.lineWidth = 4;
context.beginPath();
context.moveTo(288, 55);
context.lineTo(288, 329);
context.stroke();
drawFootprint(context, 380, 137, 1.12, ink, -0.12);
drawFootprint(context, 434, 151, 1.12, ink, 0.12);
context.textAlign = "left";
context.font = "750 59px Arial, Helvetica, sans-serif";
context.fillText("2 FEET", 535, 197);
} else {
canvas.width = 512;
canvas.height = 512;
drawFootprint(context, 256, 91, 1.24, ink);
context.fillStyle = ink;
context.textAlign = "center";
context.textBaseline = "middle";
context.font = "800 195px Arial, Helvetica, sans-serif";
context.fillText(String(number), 256, 262);
context.font = "750 43px Arial, Helvetica, sans-serif";
context.fillText("1 FOOT", 256, 421);
}
const texture = new THREE.CanvasTexture(canvas);
texture.colorSpace = THREE.SRGBColorSpace;
texture.anisotropy = Math.min(
renderer.capabilities.getMaxAnisotropy(),
8
);
texture.needsUpdate = true;
return texture;
}
// ---------------------------------------------------------------------
// Original "Twinprint 10" layout
//
// Alternating narrow and wide slabs form a readable S-shaped route.
// Wide slabs use paired footprints and narrow slabs use one footprint.
// ---------------------------------------------------------------------
const layout = [
{ number: 1, x: 0.00, z: 5.00, feet: 1, color: "#ef6a5b", rotation: -0.03 },
{ number: 2, x: 0.00, z: 3.15, feet: 2, color: "#4e78c6", rotation: 0.02 },
{ number: 3, x: -1.15, z: 1.00, feet: 1, color: "#f1b84b", rotation: -0.05 },
{ number: 4, x: -1.15, z: -0.85, feet: 2, color: "#58b89c", rotation: 0.03 },
{ number: 5, x: 1.25, z: -2.55, feet: 1, color: "#8a6bc1", rotation: 0.05 },
{ number: 6, x: 1.25, z: -4.25, feet: 2, color: "#ef6a5b", rotation: -0.02 },
{ number: 7, x: -1.20, z: -6.05, feet: 1, color: "#f1b84b", rotation: -0.04 },
{ number: 8, x: -1.20, z: -7.80, feet: 2, color: "#4e78c6", rotation: 0.03 },
{ number: 9, x: 1.20, z: -9.65, feet: 1, color: "#58b89c", rotation: 0.04 },
{ number: 10, x: 1.20, z: -11.35, feet: 2, color: "#8a6bc1", rotation: -0.02 }
];
const tiles = [];
for (let index = 0; index < layout.length; index++) {
const data = layout[index];
const isWide = data.feet === 2;
const width = isWide ? 3.15 : 1.55;
const depth = 1.55;
const group = new THREE.Group();
group.position.set(data.x, reducedMotion ? 0 : -0.8, data.z);
group.rotation.y = data.rotation;
scene.add(group);
const topColor = new THREE.Color(data.color);
const baseColor = topColor.clone().multiplyScalar(0.69);
const base = new THREE.Mesh(
createSlabGeometry(width * 1.045, depth * 1.045, 0.12, 0.31),
new THREE.MeshStandardMaterial({
color: baseColor,
roughness: 0.9,
metalness: 0
})
);
base.position.y = 0.025;
base.castShadow = true;
base.receiveShadow = true;
group.add(base);
const top = new THREE.Mesh(
createSlabGeometry(width, depth, 0.2, 0.28),
new THREE.MeshStandardMaterial({
color: data.color,
roughness: 0.7,
metalness: 0
})
);
top.position.y = 0.12;
top.castShadow = true;
top.receiveShadow = true;
group.add(top);
const labelWidth = isWide ? 2.7 : 1.28;
const labelHeight = isWide ? 1.35 : 1.28;
const label = new THREE.Mesh(
new THREE.PlaneGeometry(labelWidth, labelHeight),
new THREE.MeshBasicMaterial({
map: createTileLabel(data.number, data.feet),
transparent: true,
depthWrite: false,
toneMapped: false
})
);
label.rotation.x = -Math.PI / 2;
label.position.y = 0.385;
label.renderOrder = 2;
group.add(label);
tiles.push({ group, index });
}
// ---------------------------------------------------------------------
// Custom camera controls: orbit, zoom, pan, touch pinch, and keyboard
// ---------------------------------------------------------------------
const defaultRadius = () => innerWidth < 720 ? 30 : 24.5;
const desired = {
target: new THREE.Vector3(0, 0, -3.55),
theta: 0.52,
phi: 1.03,
radius: defaultRadius()
};
const current = {
target: desired.target.clone(),
theta: desired.theta,
phi: desired.phi,
radius: desired.radius
};
const pointerPositions = new Map();
let orbitPointer = null;
let panPointer = null;
let previousPinchDistance = 0;
const canvas = renderer.domElement;
canvas.tabIndex = 0;
function pinchDistance() {
const points = [...pointerPositions.values()];
if (points.length < 2) return 0;
return Math.hypot(
points[0].x - points[1].x,
points[0].y - points[1].y
);
}
function panCamera(dx, dy) {
camera.updateMatrixWorld();
const right = new THREE.Vector3().setFromMatrixColumn(
camera.matrix,
0
);
const up = new THREE.Vector3().setFromMatrixColumn(
camera.matrix,
1
);
const worldPerPixel =
2 * current.radius *
Math.tan(THREE.MathUtils.degToRad(camera.fov * 0.5)) /
canvas.clientHeight;
desired.target
.addScaledVector(right, -dx * worldPerPixel)
.addScaledVector(up, dy * worldPerPixel);
desired.target.x = THREE.MathUtils.clamp(desired.target.x, -5, 5);
desired.target.z = THREE.MathUtils.clamp(desired.target.z, -11, 6);
desired.target.y = THREE.MathUtils.clamp(desired.target.y, -1, 2);
}
canvas.addEventListener("contextmenu", event => {
event.preventDefault();
});
canvas.addEventListener("pointerdown", event => {
canvas.setPointerCapture(event.pointerId);
pointerPositions.set(event.pointerId, {
x: event.clientX,
y: event.clientY
});
if (event.pointerType === "touch" && pointerPositions.size === 2) {
orbitPointer = null;
panPointer = null;
previousPinchDistance = pinchDistance();
return;
}
if (event.button === 2 || event.shiftKey) {
panPointer = event.pointerId;
orbitPointer = null;
} else {
orbitPointer = event.pointerId;
panPointer = null;
}
});
canvas.addEventListener("pointermove", event => {
const previous = pointerPositions.get(event.pointerId);
if (!previous) return;
const dx = event.clientX - previous.x;
const dy = event.clientY - previous.y;
pointerPositions.set(event.pointerId, {
x: event.clientX,
y: event.clientY
});
if (
event.pointerType === "touch" &&
pointerPositions.size >= 2
) {
const distance = pinchDistance();
if (distance > 0 && previousPinchDistance > 0) {
desired.radius = THREE.MathUtils.clamp(
desired.radius * previousPinchDistance / distance,
14,
43
);
}
previousPinchDistance = distance;
return;
}
if (orbitPointer === event.pointerId) {
desired.theta -= dx * 0.006;
desired.phi = THREE.MathUtils.clamp(
desired.phi + dy * 0.005,
0.48,
1.36
);
} else if (panPointer === event.pointerId) {
panCamera(dx, dy);
}
});
function releasePointer(event) {
pointerPositions.delete(event.pointerId);
if (orbitPointer === event.pointerId) orbitPointer = null;
if (panPointer === event.pointerId) panPointer = null;
if (pointerPositions.size === 1) {
const remaining = [...pointerPositions.keys()][0];
orbitPointer = remaining;
previousPinchDistance = 0;
}
}
canvas.addEventListener("pointerup", releasePointer);
canvas.addEventListener("pointercancel", releasePointer);
canvas.addEventListener(
"wheel",
event => {
event.preventDefault();
desired.radius = THREE.MathUtils.clamp(
desired.radius * Math.exp(event.deltaY * 0.001),
14,
43
);
},
{ passive: false }
);
window.addEventListener("keydown", event => {
const key = event.key.toLowerCase();
if (key === "arrowleft") desired.theta -= 0.12;
else if (key === "arrowright") desired.theta += 0.12;
else if (key === "arrowup") {
desired.phi = THREE.MathUtils.clamp(desired.phi - 0.08, 0.48, 1.36);
} else if (key === "arrowdown") {
desired.phi = THREE.MathUtils.clamp(desired.phi + 0.08, 0.48, 1.36);
} else if (key === "+" || key === "=") {
desired.radius = Math.max(14, desired.radius - 1.2);
} else if (key === "-" || key === "_") {
desired.radius = Math.min(43, desired.radius + 1.2);
} else if (key === "r") {
resetCamera();
} else {
return;
}
event.preventDefault();
});
function resetCamera() {
desired.target.set(0, 0, -3.55);
desired.theta = 0.52;
desired.phi = 1.03;
desired.radius = defaultRadius();
}
resetButton.addEventListener("click", resetCamera);
// ---------------------------------------------------------------------
// Resize and render loop
// ---------------------------------------------------------------------
window.addEventListener("resize", () => {
camera.aspect = innerWidth / innerHeight;
camera.updateProjectionMatrix();
renderer.setPixelRatio(Math.min(devicePixelRatio, 2));
renderer.setSize(innerWidth, innerHeight);
});
const startTime = performance.now();
let previousTime = startTime;
let firstFrame = true;
function animate(now) {
requestAnimationFrame(animate);
const delta = Math.min((now - previousTime) / 1000, 0.05);
previousTime = now;
const damping = 1 - Math.exp(-delta * 10);
current.theta = THREE.MathUtils.lerp(
current.theta,
desired.theta,
damping
);
current.phi = THREE.MathUtils.lerp(
current.phi,
desired.phi,
damping
);
current.radius = THREE.MathUtils.lerp(
current.radius,
desired.radius,
damping
);
current.target.lerp(desired.target, damping);
camera.position.set(
current.target.x +
current.radius * Math.sin(current.phi) * Math.sin(current.theta),
current.target.y + current.radius * Math.cos(current.phi),
current.target.z +
current.radius * Math.sin(current.phi) * Math.cos(current.theta)
);
camera.lookAt(current.target);
if (!reducedMotion) {
const elapsed = now - startTime;
for (const tile of tiles) {
const localTime = THREE.MathUtils.clamp(
(elapsed - tile.index * 85) / 720,
0,
1
);
const eased = 1 - Math.pow(1 - localTime, 3);
tile.group.position.y = -0.8 * (1 - eased);
}
}
renderer.render(scene, camera);
if (firstFrame) {
firstFrame = false;
loading.classList.add("ready");
setTimeout(() => loading.remove(), 400);
}
}
requestAnimationFrame(animate);
</script>
</body>
</html>
```