18 lines
583 B
TypeScript
18 lines
583 B
TypeScript
|
|
import { browser } from '$app/environment';
|
||
|
|
|
||
|
|
/** Gate unique prefers-reduced-motion (playbook §6). */
|
||
|
|
export function prefersReducedMotion(): boolean {
|
||
|
|
return browser && window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Stagger syncopé de marque OKI (3+3+2) — charte §3.
|
||
|
|
* Délais en ms pour l'index donné (cycle de 8 éléments).
|
||
|
|
*/
|
||
|
|
const SYNCOPATED_DELAYS = [0, 120, 300, 360, 600, 660, 900, 960];
|
||
|
|
|
||
|
|
export function syncopatedDelay(index: number): number {
|
||
|
|
const cycle = Math.floor(index / 8);
|
||
|
|
return SYNCOPATED_DELAYS[index % 8] + cycle * 1200;
|
||
|
|
}
|