All effectsPlay & loop

Pulse

脉冲缩放

A marker briefly grows and returns to its original size in a regular rhythm.

Play or pause the demo

Where to use it

Draw attention to a live-map location or a single active badge. Tie the animation to an active state and keep the marker’s tap target fixed as its artwork changes size.

Practical example

On an airport shuttle map, the marker for the bus that is sharing its location briefly grows and returns to size every few seconds. Travelers can still tap the same target to open arrival times.

AI prompt

Apply Pulse to [target marker]. Use a transform-only keyframe that scales to 1.16 and back with a short rest between pulses. Keep the hit area fixed, provide a pause control if it repeats, and display the unscaled marker 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>Pulse</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;
    }

    .pulse-target {
      width: 61px; aspect-ratio: 1; border: 1px solid #ffa9be;
      background: #e26391; border-radius: 22px; box-shadow: 0 0 0 8px #ec709731;
      animation: pulse 1.5s ease-in-out infinite;
    }
    @keyframes pulse { 0%, 30%, 100% { transform: scale(1); } 57% { transform: scale(1.16); } }

    .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="pulse-target" data-motion></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