All effectsPlay & loop

Breathing Glow

呼吸光

A halo strengthens and fades around an element while its size stays fixed.

Play or pause the demo

Where to use it

Mark a focused listening control or an ambient status display. Use a steady icon or label alongside the halo so users can read the state at any point in the cycle.

Practical example

A language tutor shows “Listening” after a learner starts speaking. The halo around the microphone brightens and fades while the session listens, and returns to a steady outline when recording stops.

AI prompt

Add Breathing Glow to [target]. Put an unchanging halo on a pseudo-element and animate its opacity from .25 to .85 and back over three seconds. Keep the text contrast stable and use a constant low-intensity halo with reduced motion.

Example code

Save the standalone HTML as a file and open it in your browser. It uses the same code as the preview.

View HTML
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Breathing Glow</title>
  <style>
    :root {
      color-scheme: dark;
      --demo-bg: #171629;
      --demo-ink: #f8f5ff;
      --demo-accent: #b9a6ff;
      --demo-muted: #bfbbd3;
      font-family: system-ui, sans-serif;
      color: var(--demo-ink);
      background: var(--demo-bg);
    }

    *, *::before, *::after { box-sizing: border-box; }
    body { margin: 0; min-width: 0; }
    button, input { font: inherit; }

    .demo {
      display: grid;
      place-items: center;
      align-content: center;
      min-height: 100vh;
      padding: 14px;
      overflow: hidden;
      background: radial-gradient(ellipse at 50% 24%, #28233f, var(--demo-bg) 78%);
    }

    .demo-button {
      border: 1px solid #ffffff3d;
      border-radius: 7px;
      background: #ffffff12;
      color: var(--demo-ink);
      padding: 6px 11px;
      font-size: 12px;
      cursor: pointer;
    }

    :focus-visible {
      outline: 2px solid var(--demo-accent);
      outline-offset: 3px;
    }

    .glow-label {
      position: relative; display: grid; place-items: center;
      width: 120px; height: 40px; border-radius: 999px; border: 1px solid #8e75dc;
      background: #392a69; font-weight: 700; font-size: 14px;
    }
    .glow-halo {
      position: absolute; inset: 0; z-index: -1; opacity: .35; border-radius: inherit;
      box-shadow: 0 0 27px 12px #9569fe; animation: breathe 3s ease-in-out infinite;
    }
    @keyframes breathe { 50% { opacity: .85; } }

    .motion-example { display: grid; justify-items: center; width: 100%; gap: 10px; }
    .motion-specimen {
      display: grid;
      place-items: center;
      width: min(100%, 295px);
      height: 108px;
      position: relative;
      isolation: isolate;
    }
    .motion-example [data-motion] { animation-play-state: paused; }
    .motion-example[data-playing] [data-motion] { animation-play-state: running; }
    @media (prefers-reduced-motion: reduce) {
      .motion-example [data-motion] { animation: none; }
      .motion-example [data-loop-toggle] { display: none; }
    }
  </style>
</head>
<body>
  <main class="demo">
    <div class="motion-example">
      <div class="motion-specimen" aria-hidden="true"><span class="glow-label"><span class="glow-halo" data-motion></span>Listening</span></div>
      <button class="demo-button" type="button" data-loop-toggle data-testid="effect-demo-loop-toggle">Play demo</button>
    </div>
  </main>
  <script>
    const example = document.querySelector('.motion-example');
    const toggle = example.querySelector('[data-loop-toggle]');

    toggle.addEventListener('click', () => {
      const playing = example.toggleAttribute('data-playing');
      toggle.textContent = playing ? "Pause demo" : "Play demo";
    });
  </script>
</body>
</html>

Original example by UI Skills