motion-and-animation
Skill0 starsChanged 29 days agoMITView on GitHub
Use when an animation or parallax effect makes someone dizzy, when a carousel auto-plays or an element flashes, when there is no way to turn off motion, or when a shake-to-undo or tilt interaction has no button alternative.
In this repository33 other files it gives its agents.
- AGENTS.mdAGENTS.md
- accessible-authenticationSkill
- accessible-formsSkill
- accessible-nameSkill
- accordion-disclosureSkill
- audit-componentSkill
- carouselSkill
- charts-and-datavizSkill
- combobox-autocompleteSkill
- data-tableSkill
- email-html-accessibilitySkill
- fix-color-contrastSkill
- forced-colors-and-dark-modeSkill
- headings-and-landmarksSkill
- keyboard-focusSkill
- live-regionsSkill
- media-captionsSkill
- menu-buttonSkill
- modal-dialogSkill
- page-title-and-languageSkill
- pagination-and-searchSkill
- pointer-and-gesturesSkill
- predictable-contextSkill
- progress-and-loadingSkill
- screen-reader-test-planSkill
- semantic-htmlSkill
- skip-linksSkill
- svg-and-iconsSkill
- tabsSkill
- tooltip-popoverSkill
- triage-automated-resultsSkill
- wcag22-new-criteriaSkill
- zoom-reflow-text-spacingSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 85
Keep flashing under the threshold (SC 2.3.1, Level A): No content may flash more than three times in any one-second period, unless the …
≈ “Common” is an estimate: at least 1 in 5 of the 372,429 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Motion and animation
Criteria: SC 2.3.3 Animation from Interactions, SC 2.2.2 Pause, Stop, Hide, SC 2.3.1 Three Flashes or Below Threshold, SC 2.3.2 Three Flashes, SC 2.5.4 Motion Actuation
Motion on a screen is not decoration to the person it makes ill. Vestibular
disorders make large-area movement, parallax and scroll-jacking literally
nauseating, and a fast enough flash can trigger a seizure. The mistake that matters
most is honouring prefers-reduced-motion in the one hero component and forgetting
it in every toast, tooltip and route transition that also animates.
When to use
- A hero, page transition, or scroll effect animates large areas of the viewport.
- A carousel, marquee, ticker, or spinner starts on its own and never stops.
- Someone reports the site makes them dizzy, or asks for a motion-free option.
- A notification flashes, or a banner blinks to draw attention.
- The app uses the device's motion sensor: shake to undo, tilt to pan, step counter.
- Reviewing
prefers-reduced-motionsupport across a design system.
Procedure
Honour
prefers-reduced-motioneverywhere, not in one component (SC 2.3.3). SC 2.3.3 (AAA) requires that motion triggered by interaction can be disabled unless the motion is essential to the functionality. The media query is the mechanism; it must cover every animated surface, including route transitions, drawers, and scroll-linked effects./* Fails SC 2.3.3 — motion only, no way to reduce it */ .drawer { transition: transform 400ms ease; } .card:hover { transform: translateY(-8px); } /* Passes — interaction motion collapses for users who asked for less */ @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; } }The
0.01mspattern keeps state changes instant rather than removing them, so elements still move from A to B; it does not remove opacity fades that carry meaning. Pair it with a persistent in-app toggle (data-reduced-motionor a class on<html>) that layers on top of the media query, because not every user with a vestibular disorder sets the OS preference./* The in-app toggle and the OS preference share one rule */ @media (prefers-reduced-motion: reduce) { html:not([data-motion="full"]) .animated { animation: none; } } html[data-motion="reduced"] .animated { animation: none; }Give automatic motion a pause, stop, or hide control (SC 2.2.2, Level A). Any content that moves, blinks, scrolls, or auto-updates, starts automatically, lasts more than 5 seconds, and is presented in parallel with other content must have a mechanism to pause, stop, or hide it, unless the motion is essential.
<!-- Fails SC 2.2.2 — rotates forever with no control --> <div class="carousel" data-interval="4000">…</div> <!-- Passes — an explicit control, and it stops on both hover and focus --> <div class="carousel"> <ul class="carousel__slides">…</ul> <button type="button" class="carousel__toggle" aria-pressed="false"> Pause carousel </button> </div>Hover-pause alone is not enough: a keyboard or touch user never hovers, so pause on
focusinas well and provide a real button. Auto-updating content (scores, feeds) must offer pause/stop/hide or a way to control the update frequency.Keep flashing under the threshold (SC 2.3.1, Level A). No content may flash more than three times in any one-second period, unless the flash is below the general flash and red flash thresholds. Those thresholds are about the area flashing within the central 10 degrees of vision, so small elements can flash faster. Do not estimate this by eye — run the animation through the Photosensitive Epilepsy Analysis Tool (PEAT) and treat a failure as a blocker, because SC 2.3.1 is a seizure risk, not a preference. SC 2.3.2 Three Flashes (AAA) removes the threshold exception entirely.
// Fails SC 2.3.1 — a CSS flash at ~5 Hz, over the three-per-second limit. @keyframes alarm { 0%, 100% { background: #f00; } 50% { background: #fff; } } .alert { animation: alarm 0.2s steps(1) infinite; } // Passes — a steady state change; the message is conveyed without flashing. .alert { background: #b3261e; color: #fff; border-left: 4px solid #000; }Provide a UI alternative for motion actuation (SC 2.5.4, Level A). Functionality operated by device or user motion — shake to undo, tilt to steer, rotate to change view, step counting — must also be operable by ordinary user interface components, and responding to motion must be disableable to prevent accidental actuation. The exceptions are motion that is essential to the function, and motion actuated through an accessibility-supported interface.
<!-- Fails SC 2.5.4 — shake is the only way to undo --> <p class="hint">Shake your phone to undo.</p> <!-- Passes — a real control plus an off switch --> <button type="button" id="undo">Undo</button> <!-- ...and a "Disable shake gestures" checkbox in settings. -->Detect the sensor through feature APIs and only enable gesture handling when the user has not disabled it.
- Do not decorate with a shake. Shaking a form field on invalid input is a common pattern that both disorients vestibular users and, at high frequency, can cross into flashing. Replace it with a static error style and a message tied to the field. The message, not the movement, is the accessible feedback.
Verify
Emulate the OS preference rather than trusting the CSS by inspection. In Chrome
DevTools open Rendering → Emulate CSS media feature prefers-reduced-motion and
set it to reduce, then walk the page.
// SC 2.3.3 — assert the preference is actually read and applied.
if (window.matchMedia('(prefers-reduced-motion: reduce)').matches) {
const stillAnimating = [...document.querySelectorAll('*')].filter((el) => {
const cs = getComputedStyle(el);
const securing = cs.animationDuration !== '0s' && cs.animationName !== 'none';
return securing;
});
console.warn('SC 2.3.3: animation still running under reduce', stillAnimating.slice(0, 20));
}// SC 2.2.2 — flag motion longer than 5 seconds with no obvious control.
const animated = [...document.querySelectorAll('*')]
.filter((el) => {
const cs = getComputedStyle(el);
return cs.animationName !== 'none' && cs.animationIterationCount === 'infinite';
})
.map((el) => `${el.tagName}.${el.className || ''}`);
console.warn('SC 2.2.2: infinite animation — confirm a pause/stop/hide control exists', animated);
// SC 2.5.4 — find sensor listeners that may need a UI alternative.
const writes = ['DeviceMotionEvent', 'DeviceOrientationEvent']
.filter((name) => typeof window[name] === 'function');
console.log('sensor APIs present:', writes);Neither script can confirm that a control works or that a flash is under threshold. Toggle the pause button with the keyboard and confirm the motion stops; run any flashing asset through PEAT. Those steps are judgement, and no scanner replaces them.
Failure modes
- Partial
prefers-reduced-motionsupport. The hero is fixed, but the modal slide-in, the toast, the skeleton shimmer and the route transition still animate. Users notice the one thing you missed, not the ten you fixed. - A "reduce motion" toggle that defaults to off, resets on reload, or only exists after login. A setting nobody finds or that does not persist is not a mechanism. Persist it and apply it before first paint.
- Pausing only on hover. Carousels that stop on
mouseenterleave keyboard and touch users with no control at all, and they fail SC 2.2.2 despite "having a pause". - Scroll-jacking and parallax that ignore the media query. Custom scroll
handlers (
scrolllisteners that translate sections) are CSS-invisible and are the effects most likely to be missed. Guard them in JavaScript too. - A GIF or Lottie that flashes above the threshold. Compressing or looping an animation can push it over three flashes per second. "It's just a small icon" is not a defence if it exceeds the area and rate limits.
- Shake-to-undo with no button. Common on mobile, satisfies a designer's demo and fails SC 2.5.4 outright. It is also unreachable by anyone using a wheelchair or a phone on a desk.
- Overcorrection: removing all animation and feedback. Stripping every transition, progress indicator, focus movement and loading state to be safe removes information sighted users rely on. Reduce motion, do not delete meaning.
- Overcorrection: a global
transition: none !importantunconditionally. It disables motion for users who never asked for less and still leaves JavaScript-driven motion running, because the guards are in the wrong layer.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

