Ralentir les animations ASCII si la media feature prefers-reduced-motion is activée

This commit is contained in:
Tixie Salander 2024-06-10 11:30:14 +02:00
parent 4978b26ef6
commit 351931fdeb
No known key found for this signature in database

View file

@ -38,7 +38,10 @@ function updateAnimation(id, frames, totalFrames) {
}
animate("illustration-accueil", 500);
animate("rennes", 1000);
animate("orsay", 2000);
// If the user have a setting on their device to minimize the amount of non-essential motion
const preferReduceMotion = window.matchMedia("(prefers-reduced-motion)").matches;
animate("illustration-accueil", preferReduceMotion ? 1500 : 500); // Reduce framerate if use preference is to reduce motion
animate("rennes", preferReduceMotion ? 3000 : 1000); // Reduce framerate if use preference is to reduce motion
animate("orsay", preferReduceMotion ? 4000 : 2000); // Reduce framerate if use preference is to reduce motion
animate("parterre", 1500);