Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

Honor prefers-reduced-motion in club entrance and pole stage

nirholasf5b7c3fb9402
diff --git a/src/club-entrance.js b/src/club-entrance.js
index 5ef4ae1aa..08fc74f33 100644
--- a/src/club-entrance.js
+++ b/src/club-entrance.js
@@ -76,6 +76,8 @@ const ARRIVE = 0.9; // final fade (seconds) that reveals the pole stage
const isTouch = typeof window !== 'undefined' &&
('ontouchstart' in window || (navigator.maxTouchPoints || 0) > 0);
+const prefersReducedMotion = typeof window !== 'undefined' &&
+ window.matchMedia('(prefers-reduced-motion: reduce)').matches;
const canvas = document.getElementById('club-door-canvas');
const door = document.getElementById('club-door');
@@ -488,12 +490,12 @@ async function start(canvasEl) {
showPrompt(inRange && inputEnabled);
}
doorGlow.intensity = inRange ? 3.2 : 1.4;
- doorMarker.pulse(now / 1000, inRange);
+ doorMarker.pulse(now / 1000, inRange, prefersReducedMotion);
// Outside the club, the bass leaks louder the closer you get to the
// door, and the neon glows a touch hotter as you arrive.
const near = clamp(1 - d / 12, 0, 1);
if (currentCover) approachAudio.setProximity(near);
- bloomEffect.intensity = 1.2 + near * 0.7;
+ if (!prefersReducedMotion) bloomEffect.intensity = 1.2 + near * 0.7;
}
switch (phase) {
@@ -758,10 +760,11 @@ function buildDoorMarker() {
group.add(post(-0.66), post(0.66), lintel, infill);
return {
group,
- pulse(t, hot) {
+ pulse(t, hot, reduced = false) {
const base = hot ? 2.2 : 1.0;
- glowMat.emissiveIntensity = base + Math.sin(t * 2.4) * 0.35;
- frameMat.emissiveIntensity = (hot ? 1.0 : 0.5) + Math.sin(t * 2.4) * 0.15;
+ const wave = reduced ? 0 : Math.sin(t * 2.4);
+ glowMat.emissiveIntensity = base + wave * 0.35;
+ frameMat.emissiveIntensity = (hot ? 1.0 : 0.5) + wave * 0.15;
},
};
}
diff --git a/src/club.js b/src/club.js
index 63543a06e..615afe0d9 100644
--- a/src/club.js
+++ b/src/club.js
@@ -110,6 +110,9 @@ const POLES = Array.from({ length: POLE_COUNT }, (_, i) => {
};
});
+const prefersReducedMotion = typeof window !== 'undefined' &&
+ window.matchMedia('(prefers-reduced-motion: reduce)').matches;
+
// ── DOM ───────────────────────────────────────────────────────────────────
const canvas = document.getElementById('club-canvas');
const polesPanel = document.getElementById('club-poles');
@@ -1647,7 +1650,8 @@ function animate() {
// Spotlight pulse — gentle sinusoidal intensity variation.
// Only for idle poles; performing poles have their own intensity target.
if (!station.performing && station.spot) {
- const pulse = Math.sin(t * 1.2 + station.idx * 1.5) * 0.15 + 1.0;
+ const pulse = prefersReducedMotion ? 1.0
+ : Math.sin(t * 1.2 + station.idx * 1.5) * 0.15 + 1.0;
station.spot.intensity = station.spotIdleIntensity * pulse;
}
@@ -1655,7 +1659,7 @@ function animate() {
// the beat so the haze pulses in time with her routine.
if (station.beamMat) {
station.beamMat.opacity = station.beamBaseOpacity * (1 + peak * 0.9)
- + Math.sin(t * 1.5 + station.idx) * 0.01;
+ + (prefersReducedMotion ? 0 : Math.sin(t * 1.5 + station.idx) * 0.01);
}
// Update progress bar for performing stations.
@@ -1684,8 +1688,8 @@ function animate() {
// Camera state machine — orbit / VIP / house / auto.
clubCam.tick(dt);
- // Audio-reactive bloom — pulse intensity with the beat.
- bloomEffect.intensity = 1.0 + peak * 1.5;
+ // Audio-reactive bloom — pulse intensity with the beat (skip under reduced motion).
+ if (!prefersReducedMotion) bloomEffect.intensity = 1.0 + peak * 1.5;
composer.render(dt);
rafId = requestAnimationFrame(animate);