Prompt specification
Build or customize the Three.js 3D scene "Raised-button doorbell plate" 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: Raised-button doorbell plate
Category: Everyday & Industrial · Style: Procedural Solid / Shader 3D
License: MIT · Reference: https://three3d.app/scene/raised-button-doorbell-plate-x0013
Scene Description Prompt:
Use Three.js from cdnjs to model a small doorbell with a raised round button, contrasting rim, name window, and two mounting screws; leave enough edge contrast for clear recognition. Deliver one self-contained HTML file with stylized solid shapes.
Technical checks: Keep the name card and the letters ALEX visible inside the rectangular frame. Model the frame as a border around the card while keeping the raised button and screws distinct.
Return one complete HTML document that works with the cdnjs Three.js r160 module inside a sandbox with scripts allowed. Make the requested subject visible at the default camera. Use procedural assets and local button handlers. Do not use native form submission, pointer lock, external assets or runtime requests other than Three.js.
Working Three.js Starter (raised-button-doorbell-plate-x0013):
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="color-scheme" content="light">
<link rel="icon" href="data:,">
<title>Stylized Doorbell</title>
<style>
* {
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: #e8e2d7;
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;
}
.title {
position: fixed;
top: 24px;
left: 26px;
z-index: 2;
max-width: min(340px, calc(100vw - 52px));
color: #18313c;
pointer-events: none;
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.55);
}
.title h1 {
margin: 0;
font-size: clamp(22px, 3vw, 38px);
line-height: 0.98;
letter-spacing: -0.04em;
font-weight: 900;
}
.title p {
margin: 9px 0 0;
color: #64747b;
font-size: 12px;
font-weight: 750;
letter-spacing: 0.13em;
text-transform: uppercase;
}
.status {
position: fixed;
top: 26px;
right: 26px;
z-index: 3;
max-width: calc(100vw - 52px);
padding: 10px 13px;
border: 1px solid rgba(24, 49, 60, 0.12);
border-radius: 999px;
color: #24434b;
background: rgba(255, 252, 244, 0.76);
box-shadow: 0 8px 28px rgba(35, 47, 50, 0.08);
backdrop-filter: blur(10px);
font-size: 11px;
font-weight: 800;
letter-spacing: 0.04em;
}
.status::before {
content: "";
display: inline-block;
width: 8px;
height: 8px;
margin-right: 8px;
border-radius: 50%;
background: #3f9672;
box-shadow: 0 0 0 3px rgba(63, 150, 114, 0.14);
vertical-align: 1px;
}
.status.warn::before {
background: #c45f4d;
box-shadow: 0 0 0 3px rgba(196, 95, 77, 0.14);
}
.controls {
position: fixed;
left: 50%;
bottom: 22px;
z-index: 4;
display: flex;
gap: 8px;
padding: 8px;
border: 1px solid rgba(24, 49, 60, 0.13);
border-radius: 16px;
background: rgba(255, 252, 244, 0.84);
box-shadow: 0 12px 36px rgba(31, 46, 50, 0.13);
backdrop-filter: blur(14px);
transform: translateX(-50%);
}
.controls button {
min-height: 42px;
padding: 0 15px;
border: 0;
border-radius: 10px;
color: #fdfaf1;
background: #24424d;
box-shadow: 0 4px 10px rgba(24, 49, 60, 0.18);
cursor: pointer;
font: inherit;
font-size: 12px;
font-weight: 800;
letter-spacing: 0.02em;
white-space: nowrap;
transition: transform 120ms ease, background 120ms ease, box-shadow 120ms ease;
}
.controls button:hover {
background: #315867;
transform: translateY(-1px);
box-shadow: 0 6px 14px rgba(24, 49, 60, 0.22);
}
.controls button:active,
.controls button.active {
transform: translateY(1px);
background: #d15d49;
box-shadow: 0 2px 6px rgba(24, 49, 60, 0.18);
}
.controls button.secondary {
color: #294650;
background: #e8dfcf;
box-shadow: none;
}
.controls button.secondary:hover {
background: #ddd1bd;
}
.hint {
position: fixed;
right: 26px;
bottom: 25px;
z-index: 2;
color: rgba(38, 63, 71, 0.58);
font-size: 10px;
font-weight: 750;
letter-spacing: 0.08em;
text-transform: uppercase;
pointer-events: none;
}
@media (max-width: 720px) {
.title {
top: 18px;
left: 18px;
}
.title p,
.hint {
display: none;
}
.status {
top: 18px;
right: 18px;
max-width: 44vw;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.controls {
bottom: 14px;
width: calc(100vw - 24px);
justify-content: center;
}
.controls button {
flex: 1;
padding: 0 9px;
}
}
</style>
</head>
<body>
<div id="scene" aria-label="Interactive three-dimensional doorbell model"></div>
<header class="title">
<h1>Doorbell</h1>
<p>Solid-shape study / Name: ALEX</p>
</header>
<div id="status" class="status" role="status" aria-live="polite">
Checking card and name…
</div>
<nav class="controls" aria-label="Doorbell controls">
<button id="bellButton" type="button">Press bell</button>
<button id="nameButton" type="button" class="secondary">Next name</button>
<button id="resetButton" type="button" class="secondary">Reset view</button>
</nav>
<div class="hint">Drag to orbit · Wheel to zoom · Click model</div>
<script type="module">
import * as THREE from "https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
const sceneHost = document.getElementById("scene");
const statusElement = document.getElementById("status");
const bellButton = document.getElementById("bellButton");
const nameButton = document.getElementById("nameButton");
const resetButton = document.getElementById("resetButton");
const renderer = new THREE.WebGLRenderer({ antialias: true, alpha: false });
renderer.setPixelRatio(Math.min(window.devicePixelRatio || 1, 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;
sceneHost.appendChild(renderer.domElement);
const scene = new THREE.Scene();
scene.background = new THREE.Color(0xe8e2d7);
const camera = new THREE.PerspectiveCamera(
34,
window.innerWidth / window.innerHeight,
0.1,
100
);
const view = {
radius: 11.3,
theta: 0.115,
elevation: 0.045,
target: new THREE.Vector3(0, -0.03, 0)
};
function updateCamera() {
const horizontal = Math.cos(view.elevation) * view.radius;
camera.position.set(
view.target.x + Math.sin(view.theta) * horizontal,
view.target.y + Math.sin(view.elevation) * view.radius,
view.target.z + Math.cos(view.theta) * horizontal
);
camera.lookAt(view.target);
camera.updateMatrixWorld();
}
updateCamera();
const hemisphere = new THREE.HemisphereLight(0xfff8e9, 0x7a8b92, 2.25);
scene.add(hemisphere);
const keyLight = new THREE.DirectionalLight(0xfff4dc, 4.0);
keyLight.position.set(-4.5, 6.5, 8.5);
keyLight.castShadow = true;
keyLight.shadow.mapSize.set(2048, 2048);
keyLight.shadow.camera.left = -5;
keyLight.shadow.camera.right = 5;
keyLight.shadow.camera.top = 5;
keyLight.shadow.camera.bottom = -5;
keyLight.shadow.camera.near = 1;
keyLight.shadow.camera.far = 24;
keyLight.shadow.bias = -0.0004;
scene.add(keyLight);
const fillLight = new THREE.DirectionalLight(0xb9d8e7, 1.45);
fillLight.position.set(5, 1, 6);
scene.add(fillLight);
const warmLight = new THREE.PointLight(0xffb46b, 0.7, 14);
warmLight.position.set(-3.5, -1.5, 4.5);
scene.add(warmLight);
const wallMaterial = new THREE.MeshStandardMaterial({
color: 0xe8e2d7,
roughness: 0.96,
metalness: 0
});
const wall = new THREE.Mesh(new THREE.PlaneGeometry(32, 32), wallMaterial);
wall.position.z = -1.05;
wall.receiveShadow = true;
scene.add(wall);
function roundedShape(width, height, radius) {
const x = -width / 2;
const y = -height / 2;
const shape = new THREE.Shape();
shape.moveTo(x + radius, y);
shape.lineTo(x + width - radius, y);
shape.quadraticCurveTo(x + width, y, x + width, y + radius);
shape.lineTo(x + width, y + height - radius);
shape.quadraticCurveTo(
x + width,
y + height,
x + width - radius,
y + height
);
shape.lineTo(x + radius, y + height);
shape.quadraticCurveTo(
x,
y + height,
x,
y + height - radius
);
shape.lineTo(x, y + radius);
shape.quadraticCurveTo(x, y, x + radius, y);
return shape;
}
function roundedGeometry(width, height, radius, depth, bevel = 0.025) {
const geometry = new THREE.ExtrudeGeometry(
roundedShape(width, height, radius),
{
depth,
bevelEnabled: bevel > 0,
bevelSegments: 4,
steps: 1,
bevelSize: bevel,
bevelThickness: bevel,
curveSegments: 12
}
);
geometry.computeBoundingBox();
return geometry;
}
const bodyMaterial = new THREE.MeshStandardMaterial({
color: 0x243f4c,
roughness: 0.38,
metalness: 0.16
});
const body = new THREE.Mesh(
roundedGeometry(2.72, 5.42, 0.34, 0.3, 0.065),
bodyMaterial
);
body.castShadow = true;
body.receiveShadow = true;
scene.add(body);
const sideAccentMaterial = new THREE.MeshStandardMaterial({
color: 0x182f3a,
roughness: 0.42,
metalness: 0.2
});
const lowerInset = new THREE.Mesh(
roundedGeometry(2.32, 1.28, 0.2, 0.025, 0.012),
sideAccentMaterial
);
lowerInset.position.set(0, -0.72, 0.365);
lowerInset.castShadow = true;
scene.add(lowerInset);
const socketMaterial = new THREE.MeshStandardMaterial({
color: 0x13252d,
roughness: 0.3,
metalness: 0.34
});
const buttonSocket = new THREE.Mesh(
new THREE.CylinderGeometry(0.79, 0.83, 0.12, 64),
socketMaterial
);
buttonSocket.rotation.x = Math.PI / 2;
buttonSocket.position.set(0, 1.22, 0.405);
buttonSocket.castShadow = true;
scene.add(buttonSocket);
const brassMaterial = new THREE.MeshStandardMaterial({
color: 0xe1ae55,
roughness: 0.26,
metalness: 0.72
});
const buttonRim = new THREE.Mesh(
new THREE.TorusGeometry(0.675, 0.092, 16, 80),
brassMaterial
);
buttonRim.position.set(0, 1.22, 0.505);
buttonRim.castShadow = true;
scene.add(buttonRim);
const buttonMaterial = new THREE.MeshStandardMaterial({
color: 0xf26f55,
roughness: 0.3,
metalness: 0.04
});
const buttonMovingGroup = new THREE.Group();
buttonMovingGroup.position.set(0, 1.22, 0.54);
scene.add(buttonMovingGroup);
const buttonCap = new THREE.Mesh(
new THREE.CylinderGeometry(0.555, 0.59, 0.2, 64),
buttonMaterial
);
buttonCap.rotation.x = Math.PI / 2;
buttonCap.userData.action = "bell";
buttonCap.castShadow = true;
buttonMovingGroup.add(buttonCap);
const buttonEdgeMaterial = new THREE.MeshStandardMaterial({
color: 0xffa188,
roughness: 0.3,
metalness: 0.03
});
const buttonEdge = new THREE.Mesh(
new THREE.TorusGeometry(0.548, 0.018, 10, 64),
buttonEdgeMaterial
);
buttonEdge.position.z = 0.102;
buttonMovingGroup.add(buttonEdge);
const pulseMaterial = new THREE.MeshBasicMaterial({
color: 0xffd074,
transparent: true,
opacity: 0,
depthWrite: false
});
const pulseRing = new THREE.Mesh(
new THREE.TorusGeometry(0.74, 0.025, 10, 72),
pulseMaterial
);
pulseRing.position.set(0, 1.22, 0.515);
pulseRing.visible = false;
scene.add(pulseRing);
const recessMaterial = new THREE.MeshStandardMaterial({
color: 0x101c22,
roughness: 0.56,
metalness: 0.08
});
const windowRecess = new THREE.Mesh(
roundedGeometry(2.24, 0.84, 0.12, 0.05, 0.016),
recessMaterial
);
windowRecess.position.set(0, -0.72, 0.345);
windowRecess.castShadow = true;
scene.add(windowRecess);
const cardMaterial = new THREE.MeshStandardMaterial({
color: 0xf8efd5,
roughness: 0.72,
metalness: 0
});
const nameCard = new THREE.Mesh(
roundedGeometry(1.94, 0.58, 0.065, 0.025, 0.008),
cardMaterial
);
nameCard.position.set(0, -0.72, 0.42);
nameCard.userData.action = "name";
nameCard.castShadow = true;
nameCard.receiveShadow = true;
scene.add(nameCard);
const frameMaterial = new THREE.MeshStandardMaterial({
color: 0xd4a64e,
roughness: 0.3,
metalness: 0.62
});
function addFrameBar(width, height, x, y) {
const bar = new THREE.Mesh(
new THREE.BoxGeometry(width, height, 0.05),
frameMaterial
);
bar.position.set(x, y, 0.455);
bar.castShadow = true;
scene.add(bar);
return bar;
}
addFrameBar(0.08, 0.66, -1.025, -0.72);
addFrameBar(0.08, 0.66, 1.025, -0.72);
addFrameBar(2.13, 0.08, 0, -0.38);
addFrameBar(2.13, 0.08, 0, -1.06);
const textCanvas = document.createElement("canvas");
textCanvas.width = 1024;
textCanvas.height = 320;
const textContext = textCanvas.getContext("2d", { willReadFrequently: true });
const textTexture = new THREE.CanvasTexture(textCanvas);
textTexture.colorSpace = THREE.SRGBColorSpace;
textTexture.minFilter = THREE.LinearMipmapLinearFilter;
textTexture.magFilter = THREE.LinearFilter;
textTexture.anisotropy = Math.min(8, renderer.capabilities.getMaxAnisotropy());
const textMaterial = new THREE.MeshBasicMaterial({
map: textTexture,
transparent: true,
depthWrite: false,
toneMapped: false
});
const nameText = new THREE.Mesh(
new THREE.PlaneGeometry(1.6, 0.5),
textMaterial
);
nameText.position.set(0, -0.72, 0.468);
nameText.renderOrder = 4;
scene.add(nameText);
const names = ["ALEX", "BEATRIZ", "CAIO"];
let currentNameIndex = 0;
let currentName = names[currentNameIndex];
function drawSpacedText(context, text, fontSize, spacing) {
context.save();
context.font = `900 ${fontSize}px Arial, Helvetica, sans-serif`;
context.textBaseline = "middle";
context.textAlign = "left";
context.fillStyle = "#17313c";
const characters = [...text];
const widths = characters.map((character) => context.measureText(character).width);
const totalWidth = widths.reduce((sum, width) => sum + width, 0) +
spacing * Math.max(0, characters.length - 1);
let x = (textCanvas.width - totalWidth) / 2;
const y = textCanvas.height / 2 + 4;
characters.forEach((character, index) => {
context.fillText(character, x, y);
x += widths[index] + spacing;
});
context.restore();
}
function drawName(text) {
textContext.clearRect(0, 0, textCanvas.width, textCanvas.height);
let fontSize = text.length <= 4 ? 220 : 178;
textContext.font = `900 ${fontSize}px Arial, Helvetica, sans-serif`;
const naturalWidth = textContext.measureText(text).width;
const spacing = text.length <= 4 ? 18 : 8;
const spacedWidth = naturalWidth + spacing * Math.max(0, text.length - 1);
const maximumWidth = 880;
if (spacedWidth > maximumWidth) {
fontSize = Math.floor(fontSize * maximumWidth / spacedWidth);
}
drawSpacedText(textContext, text, fontSize, spacing);
textTexture.needsUpdate = true;
}
drawName(currentName);
const screwMaterial = new THREE.MeshStandardMaterial({
color: 0xcdd4d1,
roughness: 0.22,
metalness: 0.82
});
const slotMaterial = new THREE.MeshStandardMaterial({
color: 0x14232a,
roughness: 0.5,
metalness: 0.2
});
function addScrew(y, slotAngle) {
const screw = new THREE.Mesh(
new THREE.CylinderGeometry(0.145, 0.16, 0.09, 36),
screwMaterial
);
screw.rotation.x = Math.PI / 2;
screw.position.set(0, y, 0.41);
screw.castShadow = true;
scene.add(screw);
const slot = new THREE.Mesh(
new THREE.BoxGeometry(0.205, 0.026, 0.015),
slotMaterial
);
slot.position.set(0, y, 0.462);
slot.rotation.z = slotAngle;
scene.add(slot);
}
addScrew(2.24, -0.55);
addScrew(-2.24, 0.5);
const buttonBaseColor = new THREE.Color(0xf26f55);
const buttonPressedColor = new THREE.Color(0xc84f3c);
let bellPressed = false;
let pressAmount = 0;
let pulseStarted = -Infinity;
window.doorbellState = {
currentName,
pressed: false,
cardVerified: false
};
function triggerBell() {
bellPressed = true;
pulseStarted = performance.now();
bellButton.classList.add("active");
window.doorbellState.pressed = true;
document.body.dataset.bell = "pressed";
window.setTimeout(() => {
bellPressed = false;
bellButton.classList.remove("active");
window.doorbellState.pressed = false;
document.body.dataset.bell = "released";
}, 280);
}
function cycleName() {
currentNameIndex = (currentNameIndex + 1) % names.length;
currentName = names[currentNameIndex];
drawName(currentName);
window.doorbellState.currentName = currentName;
document.body.dataset.name = currentName;
validateVisibleState(`name changed to ${currentName}`);
}
function resetView() {
view.radius = 11.3;
view.theta = 0.115;
view.elevation = 0.045;
view.target.set(0, -0.03, 0);
updateCamera();
validateVisibleState("camera reset");
}
function frontZ(mesh) {
mesh.geometry.computeBoundingBox();
return mesh.position.z + mesh.geometry.boundingBox.max.z;
}
function validateVisibleState(reason) {
camera.updateMatrixWorld();
const cardBounds = new THREE.Box3().setFromObject(nameCard);
const corners = [
new THREE.Vector3(cardBounds.min.x, cardBounds.min.y, cardBounds.max.z),
new THREE.Vector3(cardBounds.max.x, cardBounds.min.y, cardBounds.max.z),
new THREE.Vector3(cardBounds.max.x, cardBounds.max.y, cardBounds.max.z),
new THREE.Vector3(cardBounds.min.x, cardBounds.max.y, cardBounds.max.z)
];
const projected = corners.map((corner) => corner.clone().project(camera));
const cardInsideViewport = projected.every((point) =>
point.z >= -1 && point.z <= 1 &&
point.x >= -1 && point.x <= 1 &&
point.y >= -1 && point.y <= 1
);
const cardIsAhead = frontZ(nameCard) > frontZ(windowRecess);
const textIsAhead = nameText.position.z > frontZ(nameCard);
const frameDoesNotCoverCard =
1.025 - 0.04 > 1.94 / 2 &&
0.38 - 0.04 > 0.58 / 2;
const pixels = textContext.getImageData(
0,
0,
textCanvas.width,
textCanvas.height
).data;
let visibleInkPixels = 0;
for (let index = 3; index < pixels.length; index += 64) {
if (pixels[index] > 24) {
visibleInkPixels += 1;
}
}
const hasRenderedName = visibleInkPixels > 20;
const passed =
cardInsideViewport &&
cardIsAhead &&
textIsAhead &&
frameDoesNotCoverCard &&
hasRenderedName;
window.doorbellState.cardVerified = passed;
statusElement.classList.toggle("warn", !passed);
statusElement.textContent = passed
? `Verified · ivory card + ${currentName}`
: `Check card visibility · ${currentName}`;
console.assert(
passed,
`Doorbell visibility test failed (${reason})`,
{
cardInsideViewport,
cardIsAhead,
textIsAhead,
frameDoesNotCoverCard,
hasRenderedName,
visibleInkPixels
}
);
return passed;
}
bellButton.addEventListener("click", triggerBell);
nameButton.addEventListener("click", cycleName);
resetButton.addEventListener("click", resetView);
const raycaster = new THREE.Raycaster();
const pointer = new THREE.Vector2();
const interactiveMeshes = [buttonCap, nameCard];
function setPointerFromEvent(event) {
const rect = renderer.domElement.getBoundingClientRect();
pointer.x = ((event.clientX - rect.left) / rect.width) * 2 - 1;
pointer.y = -((event.clientY - rect.top) / rect.height) * 2 + 1;
}
function pickAction(event) {
setPointerFromEvent(event);
raycaster.setFromCamera(pointer, camera);
const intersections = raycaster.intersectObjects(interactiveMeshes, false);
return intersections.length ? intersections[0].object.userData.action : null;
}
let dragState = null;
renderer.domElement.addEventListener("pointerdown", (event) => {
if (event.button !== 0) return;
dragState = {
startX: event.clientX,
startY: event.clientY,
previousX: event.clientX,
previousY: event.clientY,
moved: false
};
renderer.domElement.setPointerCapture(event.pointerId);
});
renderer.domElement.addEventListener("pointermove", (event) => {
if (dragState) {
const deltaX = event.clientX - dragState.previousX;
const deltaY = event.clientY - dragState.previousY;
if (
Math.hypot(
event.clientX - dragState.startX,
event.clientY - dragState.startY
) > 5
) {
dragState.moved = true;
}
if (dragState.moved) {
view.theta -= deltaX * 0.0055;
view.elevation = THREE.MathUtils.clamp(
view.elevation + deltaY * 0.0035,
-0.22,
0.34
);
updateCamera();
}
dragState.previousX = event.clientX;
dragState.previousY = event.clientY;
renderer.domElement.style.cursor = "grabbing";
} else {
renderer.domElement.style.cursor =
pickAction(event) ? "pointer" : "grab";
}
});
renderer.domElement.addEventListener("pointerup", (event) => {
if (!dragState) return;
const wasClick = !dragState.moved;
dragState = null;
if (renderer.domElement.hasPointerCapture(event.pointerId)) {
renderer.domElement.releasePointerCapture(event.pointerId);
}
if (wasClick) {
const action = pickAction(event);
if (action === "bell") triggerBell();
if (action === "name") cycleName();
}
renderer.domElement.style.cursor =
pickAction(event) ? "pointer" : "grab";
});
renderer.domElement.addEventListener("pointercancel", () => {
dragState = null;
renderer.domElement.style.cursor = "grab";
});
renderer.domElement.addEventListener(
"wheel",
(event) => {
event.preventDefault();
view.radius = THREE.MathUtils.clamp(
view.radius * Math.exp(event.deltaY * 0.001),
8.6,
14.5
);
updateCamera();
validateVisibleState("camera zoom");
},
{ passive: false }
);
renderer.domElement.addEventListener("dblclick", resetView);
function resize() {
renderer.setPixelRatio(Math.min(window.devicePixelRatio || 1, 2));
renderer.setSize(window.innerWidth, window.innerHeight, false);
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
updateCamera();
validateVisibleState("viewport resize");
}
window.addEventListener("resize", resize);
const clock = new THREE.Clock();
renderer.setAnimationLoop((time) => {
const delta = Math.min(clock.getDelta(), 0.05);
const targetPress = bellPressed ? 1 : 0;
const response = 1 - Math.pow(0.001, delta * 4.5);
pressAmount = THREE.MathUtils.lerp(pressAmount, targetPress, response);
buttonMovingGroup.position.z = THREE.MathUtils.lerp(0.54, 0.43, pressAmount);
buttonMaterial.color.lerpColors(buttonBaseColor, buttonPressedColor, pressAmount);
const pulseAge = (time - pulseStarted) / 850;
if (pulseAge >= 0 && pulseAge < 1) {
pulseRing.visible = true;
pulseRing.scale.setScalar(0.83 + pulseAge * 0.72);
pulseMaterial.opacity = (1 - pulseAge) * 0.58;
} else {
pulseRing.visible = false;
pulseMaterial.opacity = 0;
}
renderer.render(scene, camera);
});
resize();
validateVisibleState("initial ALEX state");
</script>
</body>
</html>
```