feat: mobile UX polish with haptics and reduced motion

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Dorian
2026-03-09 00:23:39 +00:00
co-authored by Claude Opus 4.6
parent 8be71e9929
commit aca025a360
5 changed files with 61 additions and 4 deletions
+14 -1
View File
@@ -29,11 +29,24 @@ export function setPerfMode(on: boolean): void {
try { localStorage.setItem(PERF_KEY, on ? '1' : '0') } catch {}
}
/** Scale a particle count down in performance mode (40%) */
/** Scale a particle count down in performance mode (40%) or reduced motion (20%) */
export function perfParticles(count: number): number {
if (_reducedMotion) return Math.max(1, Math.round(count * 0.2))
return _perfMode ? Math.max(1, Math.round(count * 0.4)) : count
}
// --- Reduced motion ---
const _reducedMotion = typeof window !== 'undefined'
? window.matchMedia('(prefers-reduced-motion: reduce)').matches
: false
export function isReducedMotion(): boolean { return _reducedMotion }
// --- Haptic feedback ---
export function haptic(ms: number = 50): void {
try { navigator?.vibrate?.(ms) } catch { /* no vibration support */ }
}
// --- Choreography selection probabilities ---
export const CREATOR_ULTIMATE_CHANCE = 0.5 // Creator ultimate chance (non-crit); 1.0 on crits
export const CREATOR_THEMED_MOVE_RATIO = 0.6 // Creator uses creator-themed moves 60% of the time