1
0
Fork 0
mirror of https://github.com/GuerillaStudio/compteur-de-greve.git synced 2024-10-09 05:19:02 +00:00

respect reduced motion for counter animation

This commit is contained in:
wryk 2023-03-02 07:38:31 +01:00
parent 419358852d
commit a9cdc16f2a

View file

@ -67,6 +67,9 @@ document.addEventListener('alpine:init', () => {
})
function animateRange(duration, start, end, callback) {
if (matchMedia("(prefers-reduced-motion)").matches) {
callback(end)
} else {
let startTimestamp = null;
const step = (timestamp) => {
@ -82,7 +85,8 @@ function animateRange(duration, start, end, callback) {
}
};
requestAnimationFrame(step);
requestAnimationFrame(step)
}
}
function formatNumber(number) {