How do you create liquid, blob and metaball effects?

Liquid effects make shapes flow, merge and split like a fluid. Metaballs are usually made with an SVG filter, a Gaussian blur followed by a high-contrast color matrix (the “goo” technique); blobs morph by animating border-radius or SVG paths, and water ripples use canvas or WebGL.

How to choose, performance and accessibility
  • Use Blob Morph or Fluid Gradient as a soft decorative accent, Liquid Button for a playful call to action, and Metaballs or Lava Lamp for an eye-catching hero.
  • SVG filters are costly on large areas, so keep them to small zones, pause animations that are off screen, and show a static shape for prefers-reduced-motion.
  • Metaballs, Blob Morph, AI Shape Morph, AI Color Shift, Generative Glitch and AI Typo Morph are free with their code; the other liquid effects come with Premium.

Metaballs

Organic blobs that merge together with a surface tension effect.

Canvas Animation Organic
Effect page →
View source code
HTML
<div class="fx-0391-root">
  <div class="metaballs-container">
    <canvas class="metaballs-canvas"></canvas>
  </div>
</div>
CSS
.fx-0391-root,
.fx-0391-root *,
.fx-0391-root *::before,
.fx-0391-root *::after {
  box-sizing: border-box
}

.fx-0391-root {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 250px;
  overflow: hidden;
  position: relative;
  background: rgb(26, 26, 36);
  color: rgb(255, 255, 255);
  font-family: sans-serif;
}

.metaballs-container {
  width: 100%;
  height: 100%;
  position: relative;
}

.metaballs-canvas {
  display: block;
  width: 100%;
  height: 100%;
}
JavaScript
(function() {
  // ============================================
  // METABALLS - 2D canvas, field computed pixel by pixel
  // Per-block settings (optional) on .fx-0391-root:
  //   data-balls="3"            number of balls (6 by default)
  //   data-color="99,102,241"   ball color as R,G,B (indigo by default)
  // ============================================
  var reduce = window.matchMedia('(prefers-reduced-motion: reduce)');

  document.querySelectorAll('.fx-0391-root').forEach(function(root) {
    var canvas = root.querySelector('.metaballs-canvas');
    if (!canvas) return;
    var ctx = canvas.getContext('2d');
    var container = canvas.parentElement;

    var numBalls = parseInt(root.getAttribute('data-balls'), 10) || 6;
    var color = (root.getAttribute('data-color') || '99,102,241').split(',').map(Number);
    var background = [26, 26, 36];
    var PIXEL_BUDGET = 650000;

    var w = 0, h = 0, scale = 1, imageData = null;
    var balls = [];
    var raf = 0, visible = true;

    function resize() {
      w = container.clientWidth;
      h = container.clientHeight;
      // Retina screen: up to 2 canvas pixels per CSS pixel, within a limit of PIXEL_BUDGET pixels
      // computed per frame (the field is computed pixel by pixel: on a large frame, smoothness comes first)
      scale = Math.max(1, Math.min(window.devicePixelRatio || 1, 2, Math.sqrt(PIXEL_BUDGET / Math.max(1, w * h))));
      canvas.width = Math.max(1, Math.round(w * scale));
      canvas.height = Math.max(1, Math.round(h * scale));
      imageData = ctx.createImageData(canvas.width, canvas.height);
      if (!balls.length) {
        for (var i = 0; i < numBalls; i++) {
          var radius = 30 + Math.random() * 40;
          balls.push({
            x: radius + Math.random() * Math.max(0, w - 2 * radius),
            y: radius + Math.random() * Math.max(0, h - 2 * radius),
            vx: (Math.random() - 0.5) * 2,
            vy: (Math.random() - 0.5) * 2,
            radius: radius
          });
        }
      }
      keepInside();
      drawMetaballs();
      start();
    }

    // A ball never leaves the frame, even after the frame shrinks
    function keepInside() {
      for (var i = 0; i < balls.length; i++) {
        var ball = balls[i];
        ball.x = w > 2 * ball.radius ? Math.min(Math.max(ball.x, ball.radius), w - ball.radius) : w / 2;
        ball.y = h > 2 * ball.radius ? Math.min(Math.max(ball.y, ball.radius), h - ball.radius) : h / 2;
      }
    }

    function drawMetaballs() {
      var W = canvas.width, H = canvas.height;
      var data = imageData.data;
      var n = balls.length;
      var bx = [], by = [], r2 = [], dy2 = [];
      for (var i = 0; i < n; i++) {
        bx[i] = balls[i].x * scale;
        by[i] = balls[i].y * scale;
        r2[i] = balls[i].radius * balls[i].radius * scale * scale;
      }
      var soft = scale * scale; // the "+ 1" in r² / (d² + 1), in screen pixels
      var idx = 0;

      for (var y = 0; y < H; y++) {
        for (i = 0; i < n; i++) dy2[i] = (y - by[i]) * (y - by[i]) + soft;
        for (var x = 0; x < W; x++) {
          var sum = 0;
          for (i = 0; i < n; i++) {
            var dx = x - bx[i];
            sum += r2[i] / (dx * dx + dy2[i]);
          }

          if (sum > 1) {
            var intensity = Math.min(sum - 1, 1) * 50; // the core gets lighter where the fields add up
            data[idx] = color[0] + intensity;
            data[idx + 1] = color[1] + intensity;
            data[idx + 2] = color[2] + intensity;
          } else {
            data[idx] = background[0];
            data[idx + 1] = background[1];
            data[idx + 2] = background[2];
          }
          data[idx + 3] = 255;
          idx += 4;
        }
      }

      ctx.putImageData(imageData, 0, 0);
    }

    function updateBalls() {
      for (var i = 0; i < balls.length; i++) {
        var ball = balls[i];
        ball.x += ball.vx;
        ball.y += ball.vy;

        if (ball.x < ball.radius) ball.vx = Math.abs(ball.vx);
        if (ball.x > w - ball.radius) ball.vx = -Math.abs(ball.vx);
        if (ball.y < ball.radius) ball.vy = Math.abs(ball.vy);
        if (ball.y > h - ball.radius) ball.vy = -Math.abs(ball.vy);
      }
      keepInside();
    }

    function animate() {
      raf = 0;
      updateBalls();
      drawMetaballs();
      start();
    }

    // The loop only runs if the block is on screen, the tab visible and motion allowed
    function start() {
      if (!raf && visible && !document.hidden && !reduce.matches) raf = requestAnimationFrame(animate);
    }

    if ('IntersectionObserver' in window) {
      new IntersectionObserver(function(entries) {
        visible = entries[0].isIntersecting;
        if (visible) start();
        else if (raf) { cancelAnimationFrame(raf); raf = 0; }
      }).observe(root);
    }
    document.addEventListener('visibilitychange', start);

    if ('ResizeObserver' in window) new ResizeObserver(resize).observe(container);
    else window.addEventListener('resize', resize);
    resize();
  });
})();

Water Ripple

Realistic ripple effect simulated with wave propagation.

Canvas Interactive Physics

Liquid Button

Button with animated liquid fill effect on hover.

CSS Hover Button

Dripping Text

Text with a dripping effect that falls continuously.

CSS SVG Text

Bubble Rise

Translucent bubbles rising with organic movements.

CSS Animation Particles

Lava Lamp

Floating lava lamp-style blobs, soft and blurred, rising and sinking.

CSS Animation Blur

Mercury Drops

Metallic drops with realistic reflections and elastic bounces.

CSS Gradient Metallic

Wave Surface

Animated water surface with multiple wave layers.

CSS SVG Layers

Splash Effect

Interactive splash effect with particles and droplets.

Canvas Interactive Particles

Fluid Gradient

Animated gradient that flows like liquid with organic motion.

CSS Gradient Blur

WebGL Fluid Simulation

Neon ink flows under the cursor, swirls and fades; a click bursts a fresh color. With no interaction, the motion carries on by itself.

💡 Perfect for: landing-page heroes, agency homepages, playful 404 pages.

WebGL Shader Fluid Interactive Bloom Premium
BLOB

Blob Morph

Organic shape that continuously morphs between different fluid silhouettes via border-radius animation.

CSS Organic Keyframes
Effect page →
View source code
HTML
<div class="fx-0401-root">
  <div class="blob-morph">BLOB</div>
</div>
CSS
.fx-0401-root,
.fx-0401-root *,
.fx-0401-root *::before,
.fx-0401-root *::after {
  box-sizing: border-box
}

.fx-0401-root {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 250px;
  overflow: hidden;
  position: relative;
  background: rgb(26, 26, 36);
  color: rgb(255, 255, 255);
  font-family: sans-serif;
}

.blob-morph {
  width: 180px;
  height: 180px;
  background: linear-gradient(135deg, #a855f7, #ec4899);
  animation: blobMorph 8s ease-in-out infinite;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  color: white;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  box-shadow:
    0 0 40px rgba(168, 85, 247, 0.4),
    0 0 80px rgba(236, 72, 153, 0.2);
  transition: transform 0.3s ease;
}

.blob-morph:hover {
  transform: scale(1.08);
}

@keyframes blobMorph {
  0% {
    border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
  }

  14% {
    border-radius: 40% 60% 70% 30% / 50% 60% 40% 50%;
  }

  28% {
    border-radius: 70% 30% 50% 50% / 30% 50% 60% 70%;
  }

  42% {
    border-radius: 30% 60% 70% 40% / 50% 30% 70% 60%;
  }

  56% {
    border-radius: 50% 50% 30% 70% / 70% 40% 60% 30%;
  }

  70% {
    border-radius: 40% 70% 60% 30% / 40% 60% 30% 70%;
  }

  84% {
    border-radius: 70% 40% 40% 60% / 60% 50% 50% 40%;
  }

  100% {
    border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
  }
}

/* Reduced motion: one fixed silhouette (the start of the loop), no zoom on hover. */
@media (prefers-reduced-motion: reduce) {
  .fx-0401-root .blob-morph {
    animation: none;
    border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%
  }

  .fx-0401-root .blob-morph:hover { transform: none }
}
JavaScript
/* Pure CSS — no JavaScript required */

Icon Morph

Hamburger icon that transforms into a close cross with smooth CSS transitions on click.

CSS JS Interaction

Shape Shifter

Shape that cycles between circle, square, triangle, hexagon and star using clip-path transitions.

CSS clip-path Cycle

Button Morph

Button that morphs into a loading spinner, then into a validation checkmark on click.

CSS JS UX

Text Morph

Text that morphs between multiple words with blur and opacity for a smooth transition.

CSS JS Typography

Card Morph

Compact card that expands and transforms into a detailed panel on click with smooth transitions.

CSS JS Layout

SVG Path Morph

SVG shape that morphs between star, heart and circle by animating the path attribute.

SVG JS Path

Liquid Morph

Three drops that merge and split thanks to an SVG "goo" filter (blur + threshold) written in the HTML.

CSS SVG Filter Organic

Avatar Morph

Circular avatar that transforms into a rectangular card with user information on hover.

CSS Hover Profile

Toggle Morph

Toggle switch whose knob changes shape while sliding: the circle deforms into a pill before returning to its initial shape.

CSS JS UI

AI & Intelligence

AI Shape Morph

A canvas-drawn shape that smoothly morphs between silhouettes: circle, star, square.

Canvas Morphing Animation
Effect page →
View source code
HTML
<div class="fx-0411-root">
  <div class="ai-shape-morph-container">
    <canvas class="ai-shape-canvas"></canvas>
  </div>
</div>
CSS
.fx-0411-root,
.fx-0411-root *,
.fx-0411-root *::before,
.fx-0411-root *::after {
  box-sizing: border-box
}

.fx-0411-root {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 250px;
  overflow: hidden;
  position: relative;
  background: rgb(26, 26, 36);
  color: rgb(255, 255, 255);
  font-family: sans-serif;
}

.ai-shape-morph-container {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ai-shape-morph-container .ai-shape-canvas {
  display: block;
  width: 100%;
  height: 100%;
}
JavaScript
(function() {
  // ============================================
  // AI & Intelligence Effects
  // ============================================

  // 1. AI Shape Morph
  // One instance per .fx-0411-root block: several copies can live on one page
  document.querySelectorAll('.fx-0411-root').forEach(function(root) {
    const canvas = root.querySelector('.ai-shape-canvas');
    if (!canvas) return;
    const ctx = canvas.getContext('2d');
    // Reduced motion requested: a still star, no loop
    const reduceMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
    let W = 0,
      H = 0;

    // Internal size = displayed size × devicePixelRatio (sharp on Retina screens);
    // drawing stays in CSS pixels thanks to setTransform.
    function resize() {
      const dpr = window.devicePixelRatio || 1;
      W = canvas.clientWidth;
      H = canvas.clientHeight;
      canvas.width = Math.round(W * dpr);
      canvas.height = Math.round(H * dpr);
      ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
      if (reduceMotion) draw();
    }

    const shapes = [
      // Circle points
      Array.from({
        length: 12
      }, (_, i) => {
        const a = (i / 12) * Math.PI * 2;
        return {
          x: Math.cos(a) * 0.35,
          y: Math.sin(a) * 0.35
        };
      }),
      // Star points
      Array.from({
        length: 12
      }, (_, i) => {
        const a = (i / 12) * Math.PI * 2;
        const r = i % 2 === 0 ? 0.4 : 0.2;
        return {
          x: Math.cos(a) * r,
          y: Math.sin(a) * r
        };
      }),
      // Square points
      Array.from({
        length: 12
      }, (_, i) => {
        const t = i / 12;
        const side = Math.floor(t * 4);
        const p = (t * 4) % 1;
        const coords = [{
            x: -0.3 + p * 0.6,
            y: -0.3
          },
          {
            x: 0.3,
            y: -0.3 + p * 0.6
          },
          {
            x: 0.3 - p * 0.6,
            y: 0.3
          },
          {
            x: -0.3,
            y: 0.3 - p * 0.6
          }
        ];
        return coords[side];
      })
    ];

    let currentShape = reduceMotion ? 1 : 0;
    let progress = 0;
    let morphPoints = shapes[currentShape].map(p => ({
      ...p
    }));
    let raf = 0;
    let visible = true;

    function draw() {
      const nextShape = (currentShape + 1) % shapes.length;
      const eased = 0.5 - 0.5 * Math.cos(progress * Math.PI);

      for (let i = 0; i < morphPoints.length; i++) {
        morphPoints[i].x = shapes[currentShape][i].x + (shapes[nextShape][i].x - shapes[currentShape][i].x) * eased;
        morphPoints[i].y = shapes[currentShape][i].y + (shapes[nextShape][i].y - shapes[currentShape][i].y) * eased;
      }

      ctx.clearRect(0, 0, W, H);
      const cx = W / 2;
      const cy = H / 2;
      const scale = Math.min(W, H);

      // Gradient scaled to the shape: ±80 px for a 250 px tall frame
      const g = scale * 0.32;
      const gradient = ctx.createLinearGradient(cx - g, cy - g, cx + g, cy + g);
      gradient.addColorStop(0, '#6366f1');
      gradient.addColorStop(0.5, '#a855f7');
      gradient.addColorStop(1, '#ec4899');

      // Start halfway along the last side: all 12 points act as control points,
      // so the shape closes without a straight edge
      const n = morphPoints.length;
      ctx.beginPath();
      ctx.moveTo(cx + (morphPoints[n - 1].x + morphPoints[0].x) / 2 * scale, cy + (morphPoints[n - 1].y + morphPoints[0].y) / 2 * scale);
      for (let i = 0; i < n; i++) {
        const curr = morphPoints[i];
        const next = morphPoints[(i + 1) % n];
        const cpx = cx + (curr.x + next.x) / 2 * scale;
        const cpy = cy + (curr.y + next.y) / 2 * scale;
        ctx.quadraticCurveTo(cx + curr.x * scale, cy + curr.y * scale, cpx, cpy);
      }
      ctx.closePath();
      ctx.fillStyle = gradient;
      ctx.fill();
    }

    function animate() {
      progress += 0.008;
      if (progress >= 1) {
        progress = 0;
        currentShape = (currentShape + 1) % shapes.length;
      }
      draw();
      // Off screen, the loop stops; the IntersectionObserver restarts it on return
      raf = visible ? requestAnimationFrame(animate) : 0;
    }

    resize();
    if ('ResizeObserver' in window) new ResizeObserver(resize).observe(canvas);
    else window.addEventListener('resize', resize);

    if (!reduceMotion) {
      if ('IntersectionObserver' in window) {
        new IntersectionObserver(function(entries) {
          visible = entries[0].isIntersecting;
          if (visible && !raf) raf = requestAnimationFrame(animate);
        }).observe(canvas);
      }
      raf = requestAnimationFrame(animate);
    }
  });
})();

Generative Flow Field

Flow field generated by smoothed noise, with particles following the force lines.

Canvas Noise Particles

Neural Net Viz

Animated neuron graph with connections and decorative light pulses.

Canvas Network AI

AI Color Shift

Dynamically generated color palette in OKLCH with fluid transitions between harmonies.

CSS OKLCH Colors
Effect page →
View source code
HTML
<div class="fx-0414-root">
  <div class="ai-color-shift">
    <div class="ai-color-swatch"></div>
    <div class="ai-color-swatch"></div>
    <div class="ai-color-swatch"></div>
    <div class="ai-color-swatch"></div>
    <div class="ai-color-swatch"></div>
  </div>
</div>
CSS
.fx-0414-root,
.fx-0414-root *,
.fx-0414-root *::before,
.fx-0414-root *::after {
  box-sizing: border-box
}

.fx-0414-root {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 250px;
  overflow: hidden;
  position: relative;
  background: rgb(26, 26, 36);
  color: rgb(255, 255, 255);
  font-family: sans-serif;
}

.ai-color-shift {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  padding: 20px;
}

.ai-color-swatch {
  border-radius: 12px;
}
JavaScript
(function() {
  // AI Color Shift: five OKLCH hues 72° apart, rotating together
  var reduce = window.matchMedia('(prefers-reduced-motion: reduce)');
  document.querySelectorAll('.ai-color-shift').forEach(function(container) {
    var swatches = container.querySelectorAll('.ai-color-swatch');
    var elapsed = 0; // seconds of animation so far
    var last = 0;
    var raf = 0;
    var onScreen = true;

    function paint() {
      var hueBase = (elapsed * 18) % 360; // 18° per second: one turn in 20 s
      swatches.forEach(function(swatch, i) {
        var hue = (hueBase + i * 72) % 360;
        var lightness = 50 + Math.sin(elapsed * 0.36 + i) * 15;
        swatch.style.background = 'oklch(' + lightness.toFixed(1) + '% 0.2 ' + hue.toFixed(1) + ')';
      });
    }

    function frame(now) {
      elapsed += Math.min(now - last, 100) / 1000;
      last = now;
      paint();
      raf = requestAnimationFrame(frame);
    }

    function update() {
      // Reduced motion, off screen or hidden tab: colors stay still
      var run = onScreen && !document.hidden && !reduce.matches;
      if (run && !raf) {
        last = performance.now();
        raf = requestAnimationFrame(frame);
      } else if (!run && raf) {
        cancelAnimationFrame(raf);
        raf = 0;
      }
    }

    paint();
    if ('IntersectionObserver' in window) {
      new IntersectionObserver(function(entries) {
        onScreen = entries[0].isIntersecting;
        update();
      }).observe(container);
    }
    document.addEventListener('visibilitychange', update);
    update();
  });
})();

Swarm Intelligence

Swarm particles with emergent behavior: cohesion, separation and alignment.

Canvas Boids Emergent
GLITCH

Generative Glitch

Generative glitch art: shifted slices and animated chromatic effects.

CSS Glitch Art
Effect page →
View source code
HTML
<div class="fx-0416-root">
  <div class="ai-glitch-container">
    <span class="ai-glitch-text" data-text="GLITCH">GLITCH</span>
  </div>
</div>
CSS
.fx-0416-root,
.fx-0416-root *,
.fx-0416-root *::before,
.fx-0416-root *::after {
  box-sizing: border-box
}

.fx-0416-root {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 250px;
  overflow: hidden;
  position: relative;
  background: rgb(26, 26, 36);
  color: rgb(255, 255, 255);
  font-family: sans-serif;
}

.ai-glitch-container {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #111;
}

.ai-glitch-text {
  font-size: 2.5rem;
  font-weight: 800;
  color: #fff;
  position: relative;
}

.ai-glitch-text::before,
.ai-glitch-text::after {
  content: attr(data-text);
  content: attr(data-text) / "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.ai-glitch-text::before {
  animation: aiGlitch1 2s infinite linear alternate-reverse;
  clip-path: polygon(0 0, 100% 0, 100% 35%, 0 35%);
  color: #0ff;
}

.ai-glitch-text::after {
  animation: aiGlitch2 3s infinite linear alternate-reverse;
  clip-path: polygon(0 65%, 100% 65%, 100% 100%, 0 100%);
  color: #f0f;
}

@keyframes aiGlitch1 {
  0% {
    transform: translate(0);
  }

  20% {
    transform: translate(-3px, 2px);
  }

  40% {
    transform: translate(3px, -1px);
  }

  60% {
    transform: translate(-2px, -2px);
  }

  80% {
    transform: translate(2px, 1px);
  }

  100% {
    transform: translate(0);
  }
}

@keyframes aiGlitch2 {
  0% {
    transform: translate(0);
  }

  25% {
    transform: translate(2px, -2px);
  }

  50% {
    transform: translate(-3px, 1px);
  }

  75% {
    transform: translate(1px, 2px);
  }

  100% {
    transform: translate(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .ai-glitch-text::before {
    animation: none;
    transform: translate(-2px, 1px);
  }

  .ai-glitch-text::after {
    animation: none;
    transform: translate(2px, -1px);
  }
}
JavaScript
/* Pure CSS — no JavaScript required */

Predictive Grid Morph

Interactive grid whose cells swell and light up around the mouse.

CSS JS Grid

Deep Dream Pattern

Live rainbow plasma: three sine waves cross and shift color across the whole frame.

Canvas Plasma Generative
DESIGN

AI Typo Morph

Letters that fluidly transform between different words with a typographic morphing effect.

JS Typo Morph
Effect page →
View source code
HTML
<div class="fx-0419-root">
  <div class="ai-typo-morph">
    <div class="ai-typo-word" data-words="DESIGN, CREATE, MORPH, DREAM, BUILD">DESIGN</div>
  </div>
</div>
CSS
.fx-0419-root,
.fx-0419-root *,
.fx-0419-root *::before,
.fx-0419-root *::after {
  box-sizing: border-box
}

.fx-0419-root {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 250px;
  overflow: hidden;
  position: relative;
  background: rgb(26, 26, 36);
  color: rgb(255, 255, 255);
  font-family: sans-serif;
}

.ai-typo-morph {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ai-typo-word {
  font-size: 2.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, #6366f1, #a855f7, #ec4899);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 2px;
}
JavaScript
(function() {
  // AI Typo Morph: the word scrambles, then settles letter by letter
  // Words: data-words attribute, comma-separated (read again at each change)
  var reduce = window.matchMedia('(prefers-reduced-motion: reduce)');
  var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789@#$%';

  document.querySelectorAll('.ai-typo-word').forEach(function(wordEl) {
    function readWords() {
      return (wordEl.getAttribute('data-words') || '').split(',')
        .map(function(w) { return w.trim(); })
        .filter(Boolean);
    }
    var currentWord = 0;
    var scramble = 0;
    var onScreen = true;
    if (!wordEl.textContent.trim()) wordEl.textContent = readWords()[0] || '';

    function morphTo(target) {
      clearInterval(scramble);
      // Reduced motion: the word switches at once, no scrambling
      if (reduce.matches) {
        wordEl.textContent = target;
        return;
      }
      var iterations = 0;
      scramble = setInterval(function() {
        var result = '';
        for (var i = 0; i < target.length; i++) {
          if (iterations > i * 2 || target[i] === ' ') {
            result += target[i];
          } else {
            result += chars[Math.floor(Math.random() * chars.length)];
          }
        }
        wordEl.textContent = result;
        iterations++;
        if (iterations > target.length * 2 + 5) {
          clearInterval(scramble);
          wordEl.textContent = target;
        }
      }, 50);
    }

    // Pause while the block is off screen
    if ('IntersectionObserver' in window) {
      new IntersectionObserver(function(entries) {
        onScreen = entries[0].isIntersecting;
      }).observe(wordEl);
    }

    setInterval(function() {
      var words = readWords();
      if (!onScreen || document.hidden || words.length < 2) return;
      currentWord = (currentWord + 1) % words.length;
      morphTo(words[currentWord]);
    }, 3000);
  });
})();

Mesh Distortion AI

A mesh of points and lines that pinches and ripples under the mouse.

Canvas Mesh Interactive

Frequently Asked Questions

How to create metaballs in CSS? +

CSS metaballs use an SVG filter with feGaussianBlur and feColorMatrix. Place colored circles, apply blur, then the color matrix with a high threshold to merge shapes where they overlap.

How to animate a blob in CSS? +

Use border-radius with 8 values (e.g.: 30% 70% 70% 30% / 30% 30% 70% 70%) and animate them with @keyframes. Each frame changes the values to create organic movement. Add a slow rotation for more dynamism.

What is the difference between liquid and glassmorphism? +

Glassmorphism creates a frosted glass effect (static, translucent). Liquid creates organic shapes that move and deform (dynamic, motion). Both can be combined for spectacular effects.

Are liquid animations performant? +

CSS animations (border-radius, transform) are GPU-optimized. SVG filter effects (metaballs) are heavier -- limit to 2-3 blobs. For complex effects, use canvas with requestAnimationFrame.

Can liquid effects be used on mobile? +

Yes, by simplifying: reduce the number of blobs, use CSS animations rather than canvas, and lower the complexity of SVG filters. Test on a real device as performance varies.

Similar Categories