Making animation compatible with accessibility
Web animation tends to be divisive: poor animation is immediately conspicuous, while good animation disappears into the experience, adding personality or offering visual cues that reduce cognitive load. The perceived conflict between accessibility and animation is unnecessary. Both can coexist with some care.
Deciding whether an animation belongs
Before building anything, two questions are worth asking.
What does this animation accomplish?
The purpose should follow the purpose of the site itself. A personal portfolio can support expressive motion; a tax return form is less likely to benefit from whimsical loading animations. An animated progress bar, by contrast, can be a reasonable addition because it gives visual feedback on the user's action.
Does it pull attention away from content?
The web is fundamentally an information system. Animating text or running looping animations near body copy is highly distracting, particularly for people with ADD or ADHD. Animation that works well on behalf of focus does not compete with it.
Respecting motion sensitivity
Animations should be safe for people with vestibular (inner ear) disorders, who may experience dizziness, headaches or nausea from animated content. The prefers-reduced-motion media query reports whether the user has asked the operating system to minimize motion.

Used as follows:
@media (prefers-reduced-motion: reduce) {
*,
*::before,
*::after {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
scroll-behavior: auto !important;
}
}
This example removes all CSS animations and transitions when the setting is active. It is a blunt instrument — the operative word in the query is reduced. Verify that functionality still works and that users do not lose important context by opting out. Tailoring the reduced-motion path is usually better: simple opacity fades in place of zooming or panning effects.
Handling it in JavaScript
The same media query is reachable from JavaScript.
let motionQuery = matchMedia('(prefers-reduced-motion)');
const handleReduceMotion = () => {
if (motionQuery.matches) {
// reduced motion options
}
}
motionQuery.addListener(handleReduceMotion);
handleReduceMotion()
System preferences are not a complete safeguard, since not everyone affected by motion knows how to change their settings. A reduced-motion toggle in the UI offers an additional layer, leaving the decision with the user; We {the collective} has a solid implementation of this on their site.
Scroll-triggered motion
Hooking animation into user interaction is one of the more rewarding parts of animating on the web, but not every interaction is opt-in. Scrolling is inherently tied to how someone navigates a site.
Research from the Nielson Norman Group found that many task-focused users could not distinguish slow load times from scroll-triggered entrance animations; all they perceived was a frustrating delay in the interface's response time. Waiting for a page to ease and fade into view while scanning for information is a familiar annoyance.
GreenSock's ScrollTrigger plugin provides the fastScrollEnd property to counter this. It detects the user's scroll velocity and, when someone scrolls very fast, skips entrance animations to their end state instead.
Reduced-motion support for scroll animations can also be added through ScrollTrigger.matchMedia().
Consider the purpose, lead with empathy, and use your animation powers responsibly.



