GLITCH LAB v1.0 ezolab.dev / lab instrument SYS: READY ✦ Holiday cards

Lab/ Guides/ Technique

prefers-reduced-motion for Glitch, Neon & Flashing CSS

Do not just delete your styles with animation: none. How to build calm, finished static fallbacks for glitch, neon flicker, typing and JS animations using prefers-reduced-motion.

/#animation

Guide // TechniqueLive demos inside
Contents [6]
  1. The quick answer
  2. Static fallback recipes for every effect type
  3. Handling JavaScript animations (scramble, canvas, timers)
  4. Why no-preference is cleaner than reduce
  5. How to test reduced motion in 5 seconds
  6. FAQ

Most accessibility snippets tell you to slap animation: none !important inside @media (prefers-reduced-motion: reduce) and call it a day. On flashy creative effects — neon flicker, glitch slices, typewriter reveals, and JS character scrambles — blindly killing the animation often breaks the UI: a typewriter freezes at 0 width, a neon sign stays stuck half-dimmed, or an overlay stays invisible at opacity: 0.

Good reduced-motion design does not delete your aesthetic. It keeps the color, glow, and layout, and replaces rapid motion or flashing with a calm, finished static state.

The quick answer

Design the static, readable state as your default, and only turn on motion inside @media (prefers-reduced-motion: no-preference) — or explicitly set the finished visual state inside reduce:

/* Default: calm, fully lit, readable */
.neon {
  color: #fff8c2;
  text-shadow: 0 0 6px #ffe600, 0 0 24px #ff9e00;
}

/* Motion only for people who have not asked to reduce it */
@media (prefers-reduced-motion: no-preference) {
  .neon {
    animation: flicker 4s steps(1) infinite;
  }
}

Compare a broken animation: none fallback against an intentional static fallback:

Top: naive animation: none freezes a neon sign mid-blink (dark). Bottom: calm steady glow fallback

Static fallback recipes for every effect type

Different effects fail in different ways when frozen at 0%. Use these exact fallback rules so nothing ever looks half-loaded:

Effect What breaks with naive animation: none Proper reduced-motion fallback
Neon flicker Stuck in the dark "off" frame Set steady full glow (color + text-shadow), no flicker keyframes
Glitch text / RGB split Pseudo-elements stuck mid-offset or doubled animation: none; transform: none; on ::before/::after (or subtle static 1 px fringe)
Typewriter Text hidden at width: 0 or 0ch width: auto; animation: none; + solid non-blinking cursor
Rotating gradient border Looks fine, just stops spinning animation: none; — static gradient ring stays crisp
JS Scramble / decrypt Random gibberish never resolves Check matchMedia in JS and render el.dataset.text immediately

Here is how the static fallback looks for a glitch heading — the word stays sharp and legible, with zero flashing or horizontal tearing:

Top: active glitch burst. Bottom: reduced-motion static state (clean, zero tearing)

Every effect on Glitch Lab ships with a built-in prefers-reduced-motion fallback (and an optional "Play anyway" control in the playground):

[FX_02] CSS + JSNeon SignFlickering neon text in CSS: glass tubes that burn, spark and now and then die, like a real broken sign. Copy the code or download MP4, GIF or PNG.Tweak it live & copy the code →
[FX_03] Pure CSSGlitch TextCSS glitch text effect: the word tears into strips that jump sideways while red and blue channels swing apart — then it rests. Pure CSS, any word.Tweak it live & copy the code →

Handling JavaScript animations (scramble, canvas, timers)

CSS media queries cannot stop a requestAnimationFrame loop or a setTimeout flicker. In vanilla JavaScript, check window.matchMedia once before starting the effect — and listen for live OS changes if the page stays open:

const reducedMotion = window.matchMedia("(prefers-reduced-motion: reduce)");

function startScramble(el) {
  if (reducedMotion.matches) {
    el.textContent = el.dataset.text; // show final word immediately
    return;
  }
  runScrambleLoop(el);
}

This is the exact pattern used in Scramble Text so users with reduced motion enabled never see flickering random glyphs:

[FX_06] CSS + JSScramble TextText scramble effect in vanilla JS: the word turns into random glyphs and decodes back letter by letter, with a fading echo. No GSAP, any text.Tweak it live & copy the code →

Why no-preference is cleaner than reduce

Writing animations inside @media (prefers-reduced-motion: no-preference) flips the default to safe-first:

  • You never accidentally forget to override one of four pseudo-element animations.
  • If a browser or embed strips media queries, the element still renders in its finished, readable state.
  • Short, non-vestibular feedback (like a gentle 150 ms color change on :hover) can stay outside the media query — prefers-reduced-motion means reduced motion, not zero visual feedback.

How to test reduced motion in 5 seconds

You do not have to dig into your operating system settings every time:

  • Chrome / Edge DevTools: press Ctrl+Shift+P (or Cmd+Shift+P on macOS) → type Emulate CSS prefers-reduced-motion: reduce → Enter.
  • Firefox DevTools: open about:config or the Inspector's Accessibility / Rules emulation toggle for prefers-reduced-motion.
  • Safari: System Settings → Accessibility → Display → Reduce motion.

FAQ

Does prefers-reduced-motion mean I have to remove all transitions?

No. Opacity fades, subtle color shifts, and button hover highlights are completely fine. What triggers discomfort is rapid flashing (neon flicker), sudden horizontal tearing (glitch slices), parallax, zooming, and looping movement.

How do I stop a CSS typewriter animation from disappearing under reduced motion?

Reset width: auto (or max-width: none), set animation: none, and keep the cursor solid (opacity: 1) inside @media (prefers-reduced-motion: reduce) so the full text is immediately readable.

What about JavaScript animations like GSAP or requestAnimationFrame?

Read window.matchMedia("(prefers-reduced-motion: reduce)").matches before starting the animation loop. When it is true, skip the animation and render the final state immediately.