One multiplier turns a whole project still, a three-state control lets the person
override the operating system in either direction, and an audit of
document.getAnimations() proves it rather than claiming it. The second switch is the
part that matters: a fade is not motion, and it is the substitute every published guideline actually
asks for.
A reveal, a parallax, a flourish. The content is identical without it, so under reduce it does not happen at all.
A toast arriving. The arrival has to be noticed, so the travel goes to zero and the fade stays. It appears rather than flying in.
A view changing. The motion was saying where you went, so it becomes a crossfade with no scale rather than nothing at all.
A progress bar. The movement is the content. Removing it removes the answer to how much is left, so this one is never multiplied by the switch.
document.getAnimations() returns every
animation the document is running, whatever started it — CSS, a script, a scroll timeline.
It is the only honest check, because a search of the stylesheet cannot see an animation that
JavaScript created, and a screenshot cannot see one that is paused.
:root{
--m-ok:1; /* travel: transform, scale, parallax */
--fade-ok:1; /* opacity and colour: never turned off */
--m-dur-medium2: calc(300ms * var(--m-ok) + 0.01ms);
--m-fade: calc(220ms * var(--fade-ok) + 0.01ms);
--travel-ok: calc(24px * var(--m-ok)); /* distance, not just time */
}
@media (prefers-reduced-motion:reduce){ :root{ --m-ok:0 } }
:root[data-motion="full"] { --m-ok:1 } /* the person's choice wins */
:root[data-motion="reduce"]{ --m-ok:0 }
/* and then nothing in the project ever writes a duration again */
.sheet{ transition: translate var(--m-dur-medium2) var(--m-ease-standard) }Two things people miss. The
trailing 0.01ms, because a zero-length transition fires no
transitionend and a lot of code waits for one. And
--travel-ok: a 24px slide with a 0ms duration still jumps 24 pixels, so the distance
has to pass through the switch as well as the time.