Skip to content
animorio
IT
Back to the library

Video editor timeline

HoverGSAP, CSS onlyMediumCompressed weight: Demo 6.1 KBGSAP 28 KBFreeDownload the zip

The timeline bar of a video editor: three clips with their frames, the audio track beneath and the playhead. Play sends the playhead running while the time advances and the audio already played takes colour. Split cuts the clip where the playhead stands: the two halves part on a spring. While dragging, near a cut the playhead snaps onto it and its grip bounces.

The code

A folder that runs on its own: index.html, style.css, script.js and the libraries from a CDN. The React and Vue tabs hold the same demo as a ready component, which switches its animations off when it leaves the page.

<!doctype html>
<!--
  "Video editor timeline" from Animorio · https://animorio.com
  License: free on your own sites and your clients’ sites, paid work included.
  Not for resale, redistribution, templates or code collections · https://animorio.com/en/license/
-->
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Video editor timeline</title>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/mona-sans@5.3.0/wdth.css">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/jetbrains-mono@5.3.0/index.css">
  <link rel="stylesheet" href="style.css">
</head>
<body>
  <main class="stage">
    <!-- the timeline bar of a video editor: the playhead runs over the frames, Split cuts the clip where it
         stands, and dragging near a cut the playhead snaps onto it -->
    <section class="ve" data-ve aria-label="Video timeline">
      <header class="ve__head">
        <button class="ve__play" type="button" data-play aria-label="Play">
          <svg viewBox="0 0 16 16" aria-hidden="true"><path data-playicon d="M5 3.200v9.600L12.500 8Z"></path></svg>
        </button>
        <p class="ve__time"><b data-time>0:00.0</b><span> / <i data-total></i></span></p>
        <button class="ve__split" type="button" data-split>
          <svg viewBox="0 0 16 16" aria-hidden="true"><path d="M8 1.500v13M4.500 5 2 8l2.500 3M11.500 5 14 8l-2.500 3"></path></svg>
          <span>Split</span>
        </button>
      </header>
      <div class="ve__track" data-track role="slider" tabindex="0" aria-label="Playhead" aria-valuemin="0">
        <div class="ve__clips" data-clips></div>
        <div class="ve__wave" data-wave aria-hidden="true"></div>
        <div class="ve__head2" data-head aria-hidden="true"><span class="ve__grip" data-grip></span></div>
      </div>
      <span class="ve__say" data-say aria-live="polite"></span>
    </section>

    <svg class="ghost" data-ghost viewBox="0 0 24 24" aria-hidden="true"><path d="M5 3.200 19.200 11l-6.300 1.600-3.300 5.900Z"></path></svg>
  </main>

  <script src="https://cdn.jsdelivr.net/npm/gsap@3.15.0/dist/gsap.min.js"></script>
  <script src="script.js"></script>
</body>
</html>

Playground

Change values, colours and text with the controls and watch the animation respond live. Or write in the code yourself. Then download the folder with your changes.

13 values to change

Works with Claude, Claude Code, ChatGPT, Cursor, VS Code, Windsurf, Codex, Gemini CLI

Or ask your AI assistant for it

With the Animorio connector, Claude Code, ChatGPT, Cursor or VS Code take it from here, guide included, and fit it into your project. Paste this request:

Take “Video editor timeline” from Animorio and fit it into my site
Platform licenseFree on your sites and your clients’ sites. Want it inside a website builder, a template platform or a client dashboard? There’s a license for agencies and platforms.

What it does

On a near-black ground with a pink glow at the top, a dark card. At the top a pale disc with the Play triangle, the time “0:00.0 / 0:12.0” in monospace and on the right the “Split” button. Below, three clips side by side with round corners: three stretches of one gradient running from blue to violet, orange and green, divided into frames by thin dark lines. Further down the audio track, a row of grey bars of different heights. A white rod with a grip on top crosses it all. Press Play and the triangle becomes two bars, the rod runs to the right, the tenths tick and the bars it leaves behind turn pink. Drag on the track and the rod follows the finger. Press Split and a white flash cuts the clip under the rod while the two halves part with a small bounce: the clips become four, and the picture does not change. Drag near a cut and the rod jumps onto it while the grip stretches and comes back.

How it works

One time

Everything reads one number, the time in seconds: the rod’s x, the time readout and how many audio bars have gone by. GSAP’s ticker advances it while playing.

Clips from cuts

The clips are rebuilt from the list of cuts. Each shows its stretch of the same gradient (same background size, shifted position), so cutting does not change the picture.

The cut

Split adds the rod’s time to the list; on the two clips born from the cut a CSS variable, the space at the sides, is animated from zero to a pixel and a half on an elastic.

The snap

While dragging, if the time is within SNAP seconds of a cut it becomes exactly that; when the snap begins the grip stretches and comes back.

Values to change

NameFileDefaultWhat it changes
ACCENTscript.js#ff5f8fThe colour of the audio already played and of the background glow.
DURATIONscript.js12How many seconds the film lasts.
SNAPscript.js0.3Within how many seconds of a cut the playhead snaps to it.
SPRINGscript.js1How much the grip bounces on snapping and the two halves after a cut: 0.3 = a little, 2 = a lot.
LOOPscript.jstrueLeft alone, the demo’s pointer plays the film, cuts a clip and tries the snap.

Try them in the Playground

When to use it

In a browser video or audio editor, in a social tool that trims clips, in a podcast recorder: wherever a playhead runs over a track made of pieces.

On phones

The same card, 320 pixels wide at most: the track has touch-action none, so the finger drags the playhead without scrolling the page, and the whole track is the grab area, not just the grip.

With reduced motion

The two halves of a cut appear already apart, with no flash or bounce, and the grip does not stretch; the playhead moves only when dragged or played. The demo does not move by itself.

Pitfalls

  • Clips, frames and audio are drawn: in a real editor the frames are thumbnails of the video and the waveform is computed from the file.
  • The track is a slider for the keyboard: arrows for a tenth of a second, Shift for a second, S to split, Space for Play; the time also goes into aria-valuetext.
  • The track’s width is measured again on resize and the clips are rebuilt, because the background position is in pixels.
  • A cut too close to another or to the edges is refused with a small shake: clips shorter than a few tenths can no longer be grabbed with a finger.
  • The time is rewritten in the text only when the tenths digit changes, not at every frame.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0, JetBrains Mono (font variabile) 5.3.0.

Compressed with gzip, the three demo files weigh 6.1 KB; the libraries: GSAP 28 KB.

Testing

Tested on 22 November 2026

  • Desktop: Done
  • Phone: Done
  • Reduced motion: Done
  • Safari on iPhone: To do

License

Use it in your own projects and in your clients’ projects. Do not resell it or redistribute it as is. GSAP stays under its own Standard license. Full license.

All animations