How are glitch, VHS and distortion effects made on the web?

Distortion effects deliberately corrupt an image or a title to create a retro or digital mood. Glitches use offset copies cut with clip-path and tinted with text-shadow, CRT and VHS looks add scanlines and noise layers, and true warping uses SVG filters such as feTurbulence with feDisplacementMap, or WebGL.

How to choose, performance and accessibility
  • Reserve them for moments that carry the brand, such as a music or gaming landing page, a 404 page or a hero title, with RGB Split, VHS Effect or CRT Screen, and keep body text clean.
  • Fast flicker can cause discomfort: limit intensity, never flash more than three times per second, and turn the animation off for prefers-reduced-motion.
  • RGB Split, Holographic Card, CRT Monitor Effect and Synthwave Scene are free with their code; the other effects come with Premium.
GLITCH

RGB Split

Chromatic separation with a corruption style.

CSS Glitch Text
Effect page →
View source code
HTML
<div class="fx-0251-root">
  <div class="rgbs-text" data-text="GLITCH">GLITCH</div>
</div>
CSS
.fx-0251-root,
.fx-0251-root *,
.fx-0251-root *::before,
.fx-0251-root *::after {
  box-sizing: border-box
}

/* Settings: change them on .fx-0251-root (or on a parent) */
.fx-0251-root {
  --rgbs-size: 3rem;        /* text size */
  --rgbs-color: #fff;       /* main text */
  --rgbs-red: #ff0000;      /* left copy */
  --rgbs-cyan: #00ffff;     /* right copy */
  --rgbs-shift: 3px;        /* copy offset (moves between 1 and 1.67 times this value) */
  --rgbs-speed: 0.15s;      /* duration of one shake */
  --rgbs-bg: rgb(10, 10, 15);
  --rgbs-height: 280px;     /* auto: the height of the text */
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: var(--rgbs-height);
  overflow: hidden;
  position: relative;
  background: var(--rgbs-bg);
  color: var(--rgbs-color);
  font-family: sans-serif;
}

.rgbs-text {
  font-size: var(--rgbs-size);
  font-weight: 900;
  position: relative;
  z-index: 0;
  color: var(--rgbs-color);
}

/* Coloured copies: decorative, skipped by screen readers (the / "" part) */
.rgbs-text::before,
.rgbs-text::after {
  content: attr(data-text);
  content: attr(data-text) / "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}

.rgbs-text::before {
  color: var(--rgbs-red);
  transform: translate(calc(var(--rgbs-shift) * -1), 0);
  animation: rgbsShiftR var(--rgbs-speed) infinite;
}

.rgbs-text::after {
  color: var(--rgbs-cyan);
  transform: translate(var(--rgbs-shift), 0);
  animation: rgbsShiftC var(--rgbs-speed) infinite;
}

@keyframes rgbsShiftR {

  0%,
  100% {
    transform: translate(calc(var(--rgbs-shift) * -1), 0);
  }

  50% {
    transform: translate(calc(var(--rgbs-shift) * -5 / 3), calc(var(--rgbs-shift) * 2 / 3));
  }
}

@keyframes rgbsShiftC {

  0%,
  100% {
    transform: translate(var(--rgbs-shift), 0);
  }

  50% {
    transform: translate(calc(var(--rgbs-shift) * 5 / 3), calc(var(--rgbs-shift) * -2 / 3));
  }
}

/* Reduced motion: the copies stay offset and still (no flashing) */
@media (prefers-reduced-motion: reduce) {
  .rgbs-text::before,
  .rgbs-text::after {
    animation: none;
  }
}
JavaScript
/* Pure CSS — no JavaScript required */

VHS Effect

Retro VHS cassette effect with scanlines.

CSS Retro Noise

Pixelate Effect

Image that pixelates into blocks on hover, focus or tap.

CSS JS Retro

Melting Text

Letters that sag, stretch and blur in a wave.

CSS JS Text

Wave Distortion

Text wave and twist distortion.

CSS JS Wave

Noise Overlay

Animated film-style grain texture.

CSS Film Texture

CRT Screen

Retro cathode ray tube screen effect.

CSS CRT Terminal

Glitch Blocks

Random corruption blocks.

CSS JS Glitch

Broken Glass

Broken glass effect with shards and cracks.

CSS Overlay Texture

Static Noise

Analog-style static TV interference.

CSS JS Canvas
HOLO CARD

Holographic Card

Dark card with a rainbow sheen that slides on hover, focus or tap.

CSS Hover
Effect page →
View source code
HTML
<div class="fx-0261-root">
  <div class="hlc-card" tabindex="0">HOLO CARD</div>
</div>
CSS
.fx-0261-root,.fx-0261-root *,.fx-0261-root *::before,.fx-0261-root *::after{box-sizing:border-box}
.fx-0261-root{--hlc-w:280px;--hlc-h:180px;--hlc-radius:16px;--hlc-c1:#1a1a2e;--hlc-c2:#16213e;--hlc-font:1.25rem;--hlc-speed:3s;--hlc-ring:#0ff;--hlc-bg:#0a0a0f;--hlc-min-h:280px;display:flex;align-items:center;justify-content:center;width:100%;min-height:var(--hlc-min-h);position:relative;background:var(--hlc-bg);color:#fff;font-family:sans-serif}
.fx-0261-root .hlc-card{width:var(--hlc-w);max-width:100%;height:var(--hlc-h);background:linear-gradient(135deg,var(--hlc-c1) 0%,var(--hlc-c2) 100%);background-color:var(--hlc-c1);border-radius:var(--hlc-radius);position:relative;overflow:hidden;cursor:pointer;display:flex;align-items:center;justify-content:center;font-weight:700;font-size:var(--hlc-font);outline:none}
.fx-0261-root .hlc-card::before{content:'';position:absolute;inset:0;background:linear-gradient(125deg,transparent 0%,rgba(255,0,128,.3) 15%,rgba(0,255,255,.3) 30%,rgba(255,255,0,.3) 45%,rgba(0,255,128,.3) 60%,rgba(128,0,255,.3) 75%,transparent 100%);background-size:200% 200%;opacity:0;transition:opacity .3s;mix-blend-mode:color-dodge;pointer-events:none}
.fx-0261-root .hlc-card::after{content:'';position:absolute;inset:0;background:repeating-linear-gradient(0deg,transparent,transparent 2px,rgba(255,255,255,.03) 2px,rgba(255,255,255,.03) 4px);pointer-events:none}
.fx-0261-root .hlc-card:hover::before,.fx-0261-root .hlc-card:focus::before,.fx-0261-root .hlc-card:focus-within::before{opacity:1;animation:hlcShift var(--hlc-speed) linear infinite}
.fx-0261-root .hlc-card:focus-visible{outline:2px solid var(--hlc-ring);outline-offset:3px}
@keyframes hlcShift{0%{background-position:0% 0%}100%{background-position:200% 200%}}
@media (prefers-reduced-motion:reduce){.fx-0261-root .hlc-card:hover::before,.fx-0261-root .hlc-card:focus::before,.fx-0261-root .hlc-card:focus-within::before{animation:none;background-position:50% 50%}}
JavaScript
/* Pure CSS — no JavaScript required */

Iridescent Surface

Thin ring with pearly colours flowing in a loop around a word, number or photo.

CSS Animation Organic

Prismatic Text

Text with chromatic aberration and dispersion.

CSS Text Glitch

Chrome Reflection

Polished-metal button with a shine that sweeps across on hover or focus.

CSS Metal Shine

Oil Slick

Oil puddle effect with multicolor reflections.

CSS Organic Blur

Hologram Projection

Floating holographic projection with scanlines.

CSS Sci-Fi Float

Rainbow Refraction

Light refracted through a prism.

CSS Rainbow Spin

Crystal Effect

Translucent hexagonal crystal slowly turning in perspective, with a bluish glow.

CSS Luxury

Holographic Badge

Sticker badge with rotating holographic foil effect.

CSS Badge Foil

Laser Beam

Three rainbow laser beams that stretch and shrink behind a neon word.

CSS Animation Sci-Fi
> SYSTEM BOOT OK
> LOADING DATA...
> READY_

CRT Monitor Effect

CRT monitor effect with scanlines, darkened corners and green phosphor glow.

CSS Pseudo-elements Retro
Effect page →
View source code
HTML
<div class="fx-0271-root">
  <div class="crtm-monitor">
    <div class="crtm-content">
      <span>&gt; SYSTEM BOOT OK</span><br>
      <span>&gt; LOADING DATA...</span><br>
      <span>&gt; READY_</span>
    </div>
  </div>
</div>
CSS
.fx-0271-root,.fx-0271-root *,.fx-0271-root *::before,.fx-0271-root *::after{box-sizing:border-box}

/* Settings (all optional, set them on .fx-0271-root or a parent):
   --crtm-w        monitor width (280px; 100% fills the parent)
   --crtm-color    phosphor color of the text (#33ff33)
   --crtm-glow     text glow (rgba(51,255,51,.6))
   --crtm-size     text size (14px)
   --crtm-frame    frame color (#2a2a2a)
   --crtm-page / --crtm-root-h  wrapper background and min height (rgb(10,10,15) / 280px) */
.fx-0271-root{display:flex;align-items:center;justify-content:center;width:100%;min-height:var(--crtm-root-h,280px);position:relative;background:var(--crtm-page,rgb(10,10,15));color:#fff;font-family:sans-serif}

.crtm-monitor{background:#0a0a0a;border:8px solid var(--crtm-frame,#2a2a2a);border-radius:20px;padding:24px;position:relative;overflow:hidden;width:var(--crtm-w,280px);max-width:100%;min-height:160px;box-shadow:inset 0 0 60px rgba(0,255,0,.1),0 0 20px rgba(0,0,0,.5)}

/* scanlines */
.crtm-monitor::before{content:"";position:absolute;top:0;left:0;width:100%;height:100%;background:repeating-linear-gradient(0deg,transparent,transparent 2px,rgba(0,0,0,.15) 2px,rgba(0,0,0,.15) 4px);pointer-events:none;z-index:2}

/* vignetting */
.crtm-monitor::after{content:"";position:absolute;top:0;left:0;width:100%;height:100%;background:radial-gradient(ellipse at center,transparent 60%,rgba(0,0,0,.5) 100%);pointer-events:none;z-index:3}

.crtm-content{color:var(--crtm-color,#33ff33);font-family:"Courier New",monospace;font-size:var(--crtm-size,14px);line-height:1.6;text-shadow:0 0 8px var(--crtm-glow,rgba(51,255,51,.6));position:relative;z-index:1}

/* every 4s the lines dim briefly, like an old tube */
.crtm-content span{animation:crtmFlicker 4s infinite}

@keyframes crtmFlicker{0%,to{opacity:1}92%{opacity:1}93%{opacity:.7}94%{opacity:1}96%{opacity:.8}97%{opacity:1}}

@media (prefers-reduced-motion:reduce){
  .crtm-content span{animation:none}
}
JavaScript
/* Pure CSS — no JavaScript required */

VHS Tracking

Animated VHS tracking distortion with horizontal displacement and color bleeding.

CSS Animation VHS

ASCII Art Renderer

Turns your image into ASCII characters, in glowing terminal green.

JS Canvas Terminal

Pixel Dissolve

Cover that dissolves into square blocks on hover, focus or tap, revealing what lies beneath.

CSS Hover JS

LED Matrix Display

Glowing LED-display style text: a breathing red glow over a dot grid.

CSS Text-shadow LED

Retro Terminal

Green-on-black terminal with typing animation, blinking cursor and CRT scanlines.

CSS Animation Terminal

Retro Handheld Screen

Pocket-console style card: content tinted in four greens with a CSS filter.

CSS Filter Retro

Dot Matrix Printer

Text appearing line by line as if printed by a dot matrix printer.

CSS Animation Print

Retro Desktop UI

A 90s desktop-style kit: bevelled grey window, gradient title bar, buttons that press in on click.

CSS Borders Retro
RETRO

Synthwave Scene

Animated retro scene with perspective grid, neon sun and pink/cyan/purple palette.

CSS Animation Synthwave
Effect page →
View source code
HTML
<div class="fx-0280-root">
  <div class="swv-scene">
    <div class="swv-stars" aria-hidden="true">
      <span></span><span></span><span></span><span></span>
      <span></span><span></span><span></span><span></span>
    </div>
    <div class="swv-sun" aria-hidden="true"></div>
    <div class="swv-text">RETRO</div>
    <div class="swv-grid" aria-hidden="true"></div>
  </div>
</div>
CSS
.fx-0280-root,.fx-0280-root *,.fx-0280-root *::before,.fx-0280-root *::after{box-sizing:border-box}
.fx-0280-root{--swv-w:300px;--swv-scene-h:200px;--swv-radius:12px;--swv-sky:linear-gradient(180deg,#0a001a 0%,#1a0033 30%,#2d004d 50%,#ff006e 51%,#ff006e 52%,#0a001a 52%);--swv-sun:80px;--swv-sun-colors:linear-gradient(180deg,#ff9900,#ff006e,#cc00ff);--swv-glow:#ff006e;--swv-line:rgba(255,0,110,.3);--swv-line-strong:rgba(255,0,110,.4);--swv-depth:200px;--swv-speed:2s;--swv-font:20px;--swv-text-colors:linear-gradient(180deg,#00ffff,#ff00ff);--swv-bg:rgb(10,10,15);--swv-h:280px;display:flex;align-items:center;justify-content:center;width:100%;height:var(--swv-h);overflow:hidden;position:relative;background:var(--swv-bg);color:rgb(255,255,255);font-family:sans-serif}
.fx-0280-root .swv-scene{width:var(--swv-w);height:var(--swv-scene-h);max-width:100%;background:var(--swv-sky);border-radius:var(--swv-radius);position:relative;overflow:hidden}
.fx-0280-root .swv-sun{position:absolute;width:var(--swv-sun);height:var(--swv-sun);background:var(--swv-sun-colors);border-radius:50%;top:20%;left:50%;transform:translateX(-50%);box-shadow:0 0 40px var(--swv-glow),0 0 80px color-mix(in srgb,var(--swv-glow) 40%,transparent);clip-path:polygon(0 0,100% 0,100% 40%,0 40%,0 45%,100% 45%,100% 55%,0 55%,0 60%,100% 60%,100% 100%,0 100%)}
.fx-0280-root .swv-grid{position:absolute;bottom:0;left:-50%;width:200%;height:48%;background:linear-gradient(90deg,transparent 0%,var(--swv-line) 49.5%,var(--swv-glow) 50%,var(--swv-line) 50.5%,transparent 100%),repeating-linear-gradient(90deg,transparent,transparent calc(10% - 1px),var(--swv-line-strong) calc(10% - 1px),var(--swv-line-strong) 10%),repeating-linear-gradient(0deg,transparent,transparent 20px,var(--swv-line) 20px,var(--swv-line) 21px);transform:perspective(var(--swv-depth)) rotateX(60deg);transform-origin:center top;animation:swvGrid var(--swv-speed) linear infinite}
.fx-0280-root .swv-text{position:absolute;top:8%;width:100%;text-align:center;font-family:'Inter',sans-serif;font-weight:900;font-size:var(--swv-font);letter-spacing:4px;text-transform:uppercase;background:var(--swv-text-colors);-webkit-background-clip:text;-webkit-text-fill-color:transparent;background-clip:text;filter:drop-shadow(0 0 10px #ff00ff) drop-shadow(0 0 20px #00ffff)}
.fx-0280-root .swv-stars{position:absolute;top:0;left:0;width:100%;height:52%;overflow:hidden}
.fx-0280-root .swv-stars span{position:absolute;width:2px;height:2px;background:#fff;border-radius:50%;animation:swvTwinkle 3s ease-in-out infinite}
.fx-0280-root .swv-stars span:nth-child(1){top:10%;left:15%;animation-delay:0s}
.fx-0280-root .swv-stars span:nth-child(2){top:20%;left:75%;animation-delay:.7s}
.fx-0280-root .swv-stars span:nth-child(3){top:5%;left:45%;animation-delay:1.2s}
.fx-0280-root .swv-stars span:nth-child(4){top:30%;left:85%;animation-delay:.3s}
.fx-0280-root .swv-stars span:nth-child(5){top:8%;left:60%;animation-delay:1.8s}
.fx-0280-root .swv-stars span:nth-child(6){top:25%;left:25%;animation-delay:2.1s}
.fx-0280-root .swv-stars span:nth-child(7){top:15%;left:90%;animation-delay:.9s}
.fx-0280-root .swv-stars span:nth-child(8){top:35%;left:10%;animation-delay:1.5s}
@keyframes swvGrid{0%{background-position-y:0}to{background-position-y:21px}}
@keyframes swvTwinkle{0%,to{opacity:.3}50%{opacity:1}}
@media (prefers-reduced-motion:reduce){.fx-0280-root .swv-grid{animation:none}.fx-0280-root .swv-stars span{animation:none;opacity:.8}}
JavaScript
/* Pure CSS — no JavaScript required */

Cursed Blood Goo

Liquid blood rendered as metaballs: it drips, merges, flows and pools at the bottom. The cursor carries a glob that flings droplets and attracts nearby blood. Fully customizable color (slime, ink, lava…).

💡 Perfect for: Halloween gore hero, bleeding 404 page, horror film intro, event header, premium section background, loading screen.

Canvas Metaballs Liquid Free
Effect page →
View source code
HTML
<div class="fx-0803-root">
  <div class="goo-scene" data-goo data-color="#c81e2d">
    <canvas class="goo-canvas" aria-hidden="true"></canvas>
    <div class="goo-hint" aria-hidden="true">Sweep the blood…</div>
  </div>
</div>
CSS
.fx-0803-root,
.fx-0803-root *,
.fx-0803-root *::before,
.fx-0803-root *::after {
  box-sizing: border-box
}

.fx-0803-root {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 200px;
  position: relative;
  background: rgb(10, 10, 15);
  color: rgb(255, 255, 255);
  font-family: sans-serif;
}

.goo-scene {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: 14px;
  overflow: hidden;
  isolation: isolate;
  background: #0b0406;
  cursor: crosshair;
  touch-action: none;
}

.goo-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  filter: blur(7px) contrast(16);
}

.goo-hint {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  font-size: 12px;
  color: #ff5a5a;
  opacity: .85;
  white-space: nowrap;
  pointer-events: none;
}
JavaScript
(function() {
  /* ============================================================
     Scoped JS (IIFE) — Cursed Blood Goo (fx-0803)
     Blood metaballs on each [data-goo]
  ============================================================ */
  (function() {
    var reduce = window.matchMedia('(prefers-reduced-motion: reduce)');
    var MAX = 130;

    document.querySelectorAll('.fx-0803-root [data-goo]').forEach(function(scene) {
      var canvas = scene.querySelector('.goo-canvas');
      var ctx = canvas.getContext('2d');
      var dpr = Math.min(window.devicePixelRatio || 1, 2);
      var W = 0, H = 0, drops = [], pool = 0, t = 0, drip = 0;
      var mx = -999, my = -999, on = false, bx = -999, by = -999, pmx = -999, pmy = -999;
      var visible = true, raf = 0, last = 0, awake = 0;

      function blob(x, y, r) {
        ctx.beginPath();
        ctx.arc(x, y, r, 0, 6.2832);
        ctx.fill();
      }

      function render() {
        if (!W || !H) return;
        ctx.fillStyle = '#0b0406';
        ctx.fillRect(0, 0, W, H);
        ctx.fillStyle = scene.dataset.color || '#c81e2d';
        // pool (rippling surface)
        var surf = H - pool;
        ctx.beginPath();
        ctx.moveTo(0, H + 2);
        ctx.lineTo(0, surf);
        for (var x = 0; x <= W + 18 * dpr; x += 18 * dpr) ctx.lineTo(x, surf + Math.sin(x * 0.012 + t * 3) * 6 * dpr);
        ctx.lineTo(W, H + 2);
        ctx.closePath();
        ctx.fill();
        // drops
        for (var i = 0; i < drops.length; i++) blob(drops[i].x, drops[i].y, drops[i].r);
        // pointer glob
        if (on) blob(bx, by, 34 * dpr);
      }

      function resize() {
        var w = Math.round(scene.clientWidth * dpr);
        var h = Math.round(scene.clientHeight * dpr);
        if (!w || !h || (w === W && h === H)) return;
        if (H) pool = pool * h / H;
        else if (reduce.matches) {
          // reduced motion: pool and drops in place from the start, nothing moves without the pointer
          pool = h * 0.22;
          for (var i = 0; i < 9; i++) drops.push({
            x: (0.12 + Math.random() * 0.76) * w,
            y: (0.2 + Math.random() * 0.45) * h,
            vx: 0,
            vy: 0,
            r: (12 + Math.random() * 14) * dpr
          });
        }
        W = canvas.width = w;
        H = canvas.height = h;
        render();
      }

      // f = frame duration in 60 fps frames (capped at 50 ms): same speed at 60, 120 or 144 Hz
      function step(f) {
        t += f / 60;
        // dripping from the top (one drop every 11/60 s), off under reduced motion
        if (!reduce.matches) {
          drip += f;
          while (drip >= 11) {
            drip -= 11;
            if (drops.length < MAX) drops.push({
              x: Math.random() * W,
              y: -12 * dpr,
              vx: (Math.random() - 0.5) * 0.5,
              vy: 1 + Math.random() * 1.4,
              r: (9 + Math.random() * 9) * dpr
            });
          }
        }
        var floorY = H - pool, damp = Math.pow(0.99, f);
        for (var i = drops.length - 1; i >= 0; i--) {
          var d = drops[i];
          d.vy += 0.28 * dpr * f;
          d.vx *= damp;
          if (on) {
            var ax = mx - d.x,
              ay = my - d.y,
              dist = Math.hypot(ax, ay);
            if (dist < 150 * dpr && dist > 1) {
              var k = (1 - dist / (150 * dpr)) * 0.7 * f;
              d.vx += ax / dist * k;
              d.vy += ay / dist * k;
            }
          }
          d.x += d.vx * f;
          d.y += d.vy * f;
          if (d.y + d.r * 0.4 >= floorY) {
            // each drop feeds the pool (share of the height, whatever the width)
            pool = Math.min(H * 0.5, pool + H * 0.012 * d.r * d.r / (169 * dpr * dpr));
            drops.splice(i, 1);
            continue;
          }
          if (d.x < -40 * dpr || d.x > W + 40 * dpr) drops.splice(i, 1);
        }
        // the pool drains slowly: it rises to an equilibrium (≈ 20 % of the height)
        pool -= pool * 0.3 * f / 60;
        if (on) {
          var e = 1 - Math.pow(0.7, f);
          bx += (mx - bx) * e;
          by += (my - by) * e;
          var sp = Math.hypot(mx - pmx, my - pmy) / f;
          if (sp > 13 * dpr && drops.length < MAX) drops.push({
            x: bx + (Math.random() - 0.5) * 22 * dpr,
            y: by + (Math.random() - 0.5) * 22 * dpr,
            vx: (mx - pmx) / f * 0.07,
            vy: (my - pmy) / f * 0.07 + 1,
            r: (6 + Math.random() * 6) * dpr
          });
        }
        pmx = mx;
        pmy = my;
      }

      function frame(now) {
        raf = 0;
        var f = last ? Math.min(now - last, 50) * 0.06 : 1;
        last = now;
        step(f);
        render();
        sync();
      }

      // loop paused off screen / hidden tab; under reduced motion it only runs for 1.5 s after a gesture
      function sync() {
        var run = visible && !document.hidden && W > 0 && (!reduce.matches || performance.now() < awake);
        if (run && !raf) raf = requestAnimationFrame(frame);
        if (!run) {
          if (raf) cancelAnimationFrame(raf);
          raf = 0;
          last = 0;
        }
      }

      function point(e) {
        var r = scene.getBoundingClientRect();
        mx = (e.clientX - r.left) * dpr;
        my = (e.clientY - r.top) * dpr;
        if (!on) {
          bx = pmx = mx;
          by = pmy = my;
        }
        on = true;
        awake = performance.now() + 1500;
        sync();
      }

      function leave() {
        on = false;
        mx = my = -999;
      }

      scene.addEventListener('pointerdown', point);
      scene.addEventListener('pointermove', point);
      scene.addEventListener('pointerleave', leave);
      scene.addEventListener('pointercancel', leave);

      resize();
      if ('ResizeObserver' in window) new ResizeObserver(function() {
        resize();
        sync();
      }).observe(scene);
      else window.addEventListener('resize', resize);
      if ('IntersectionObserver' in window) {
        new IntersectionObserver(function(entries) {
          visible = entries[0].isIntersecting;
          sync();
        }).observe(scene);
      }
      if ('MutationObserver' in window) new MutationObserver(render).observe(scene, {
        attributes: true,
        attributeFilter: ['data-color']
      });
      document.addEventListener('visibilitychange', sync);
      if (reduce.addEventListener) reduce.addEventListener('change', sync);
      sync();
    });
  })();
})();

Frequently Asked Questions

How do you create a glitch effect in CSS? +

The glitch effect uses pseudo-elements (::before, ::after) absolutely positioned with animated clip-paths. Each pseudo-element shows an offset copy of the text with different colors (red, cyan). The animation moves the clip-paths in a jerky manner.

What is displacement mapping in CSS? +

Displacement mapping distorts an image using a displacement map (a grayscale image). In CSS, this effect is simulated with SVG filters (feTurbulence + feDisplacementMap). In JavaScript, WebGL or canvas is used.

Are distortion effects accessible? +

Distortion effects can cause accessibility issues for people with epilepsy or motion sensitivity. Always respect prefers-reduced-motion and avoid rapid flashing (more than 3 flashes per second, WCAG 2.3.1 rule).

Which distortion effect is the most performant? +

Pure CSS effects (glitch with clip-path, noise with background-image) are the lightest. Canvas/WebGL effects (displacement, pixelation) are heavier but more spectacular. Use requestAnimationFrame and pause when off viewport.

How do you apply a distortion effect to an image? +

Use an SVG filter with feTurbulence to generate noise, then feDisplacementMap to distort the image. Apply the filter with CSS filter: url(#myFilter). Animate the baseFrequency attribute of feTurbulence for a dynamic effect.