All effectsClick & switch

Keyframe Timeline Scrubber

关键帧时间轴拖动

One playhead seeks forward and backward through key poses without starting playback.

Slide the playhead or jump to a keyframe

Where to use it

Preview animation timing, video chapters, or a process before playback. Keep scrubbing independent from playback when users need to inspect a single moment or compare neighboring poses.

Practical example

In an onboarding animation editor, a designer drags the playhead to the moment the product card is halfway open. The preview shows that exact pose and stays there while the designer checks the spacing.

AI prompt

Build a scrub-only timeline for [animation]. Represent keyframes as timestamps, use a native range input for time, sample the neighboring keyframes on input, and provide direct keyframe jump controls.

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>Keyframe Timeline Scrubber</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;
    }

    .ui { width: min(100%, 238px); display: grid; gap: 8px; position: relative; font-size: 12px; line-height: 1.35; }
    .ui .surface { min-width: 0; border: 1px solid #676591; border-radius: 10px; background: #282744; padding: 8px; }
    .ui .bar { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
    .ui .actions { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 5px; }
    .ui .muted { color: #cecae9; font-size: 11px; }
    .ui .center { text-align: center; }
    .ui .mono { font: 11px ui-monospace, monospace; font-variant-numeric: tabular-nums; }
    .ui p { margin: 0; }
    .ui .button { min-height: 30px; padding: 4px 7px; border-radius: 7px; border: 1px solid #79779f; background: #3d3a60; color: #f9f5ff; font-size: 11px; font-weight: 650; cursor: pointer; }
    .ui .button:hover { background: #4e4976; }
    .ui .primary { background: #c5eeec; border-color: #dafaee; color: #17213b; }
    .ui .primary:hover { background: #e3fff9; }
    .ui .button:disabled { opacity: .6; cursor: default; }
    .ui .field { min-width: 0; width: 100%; border: 1px solid #79779f; border-radius: 6px; background: #1b1a31; color: #faf5ff; padding: 5px 7px; font-size: 12px; }
    .ui .field::placeholder { color: #c2bcdd; }
    .ui input[type="range"] { accent-color: #b8ebe0; width: 100%; min-width: 0; margin: 0; }
    .ui button { font: inherit; }
    .ui [hidden] { display: none !important; }
    .ui progress { accent-color: #b8ebe0; }
    @media (prefers-reduced-motion: reduce) {
      .ui *, .ui *::after, .ui *::before { transition-duration: 0s !important; animation-duration: 0s !important; scroll-behavior: auto !important; }
    }
    .pose-stage{position:relative;height:69px;border-radius:9px;background:linear-gradient(#6e5b9b22 1px,transparent 1px) 0 0/100% 14px,#282642;border:1px solid #777099}.pose{position:absolute;top:27px;left:12%;width:27px;height:27px;border-radius:7px;background:linear-gradient(145deg,#f8d4a1,#f2997a);box-shadow:0 4px 9px #23182e;translate:-50% 0;transform:translateY(var(--height,0px)) rotate(var(--turn,0deg))}.baseline{position:absolute;inset:54px 10px auto;border-top:1px dashed #a09cc0}
  </style>
</head>
<body>
  <main class="demo">
    <div class="ui"><div class="pose-stage" aria-hidden="true"><span class="pose"></span><span class="baseline"></span></div><input type="range" min="0" max="100" value="0" aria-label="Playhead"><div class="bar"><div class="actions"><button class="button" type="button" data-time="0">0s</button><button class="button" type="button" data-time="50">1s</button><button class="button" type="button" data-time="100">2s</button></div><span class="mono stamp">0.00s</span></div></div>
  </main>
  <script>
    const range = document.querySelector('input');
    const pose = document.querySelector('.pose');
    function seek() { const t = Number(range.value) / 100; pose.style.left = (12 + t * 76) + '%'; pose.style.setProperty('--height', (-24 * Math.sin(Math.PI * t)) + 'px'); pose.style.setProperty('--turn', t * 180 + 'deg'); document.querySelector('.stamp').textContent = (t * 2).toFixed(2) + 's'; }
    range.addEventListener('input', seek);
    for (const keyframe of document.querySelectorAll('[data-time]')) keyframe.addEventListener('click', () => { range.value = keyframe.dataset.time; seek(); });
  </script>
</body>
</html>

Original example by UI Skills

Further examples