Skip to content
animorio
IT
All components

Video trimmer

Sliders, Hover, TransitionsGSAP, CSS onlyMediumCompressed weight: Demo 8.9 KBGSAP 28 KBFreeDownload the zip

The panel to trim a clip in Reelcut, a made-up editing app: a drawn preview of a harbour at dawn, below it a strip of ten frames, and two amber handles to drag that darken what stays out. The chosen length rolls digit by digit from 00:04.2 to 00:02.8, the start and end times sit under the handles, Play runs the white playhead through the cut and the preview follows it. Trim closes into a spinning ring, then the tick and «Saved · 2.8 s». On black, with a single amber accent.

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 trimmer" 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 trimmer</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 trim panel of Reelcut, a made-up editing app: a small preview, the strip of frames,
         two handles that cut the clip, the length that rolls, Play with the playhead, then Trim -->
    <section class="panel" data-panel aria-label="Trim clip in Reelcut">
      <span class="panel__edge" aria-hidden="true"></span>

      <header class="head">
        <div class="head__txt">
          <h1 class="head__title">Trim clip</h1>
          <p class="head__sub">Reelcut · harbour_dawn.mov</p>
        </div>
        <p class="total"><span class="total__lab">Source</span> <span class="total__val" data-total>00:06.0</span></p>
      </header>

      <figure class="preview" aria-label="Preview">
        <svg class="scene" viewBox="0 0 200 100" preserveAspectRatio="xMidYMid slice" data-scene aria-hidden="true">
          <defs>
            <linearGradient id="cielo" x1="0" y1="0" x2="0" y2="1">
              <stop offset="0" data-sky-top stop-color="#1b2140"/>
              <stop offset="1" data-sky-bot stop-color="#e07a4f"/>
            </linearGradient>
            <linearGradient id="acqua" x1="0" y1="0" x2="0" y2="1">
              <stop offset="0" data-sea-top stop-color="#2a2f52"/>
              <stop offset="1" stop-color="#0b0d18"/>
            </linearGradient>
          </defs>
          <rect width="200" height="100" fill="url(#cielo)"/>
          <circle r="11" cx="120" cy="64" fill="#ffd7a1" data-sun/>
          <rect y="64" width="200" height="36" fill="url(#acqua)"/>
          <path d="M0 64 C30 58 46 60 70 64 Z" fill="#0f1224" opacity=".9"/>
          <path d="M150 64 C168 55 184 57 200 61 V64 Z" fill="#0f1224" opacity=".9"/>
          <g data-glints fill="#ffd7a1" opacity=".55">
            <rect x="112" y="69" width="16" height="1.2" rx=".6"/>
            <rect x="116" y="74" width="9" height="1" rx=".5"/>
            <rect x="114" y="79" width="12" height="1" rx=".5"/>
          </g>
          <g data-boat fill="#0b0d18">
            <path d="M0 0 h18 l-3 4 h-12 z"/>
            <rect x="8" y="-11" width="1.2" height="11"/>
            <path d="M9.4 -10 L16 -1 H9.4 Z" opacity=".85"/>
          </g>
        </svg>
        <figcaption class="tc" data-tc>00:00.8</figcaption>
      </figure>

      <div class="strip" data-strip>
        <div class="frames" data-frames aria-hidden="true"></div>
        <div class="shade shade--l" data-shade-l aria-hidden="true"></div>
        <div class="shade shade--r" data-shade-r aria-hidden="true"></div>
        <div class="sel" data-sel aria-hidden="true"></div>
        <div class="head-line" data-playhead aria-hidden="true"><span class="head-line__cap"></span></div>
        <button class="handle handle--l" type="button" data-handle="l" aria-label="Trim start">
          <span class="handle__body" data-handle-body><span class="grip" aria-hidden="true"><i></i><i></i></span></span>
        </button>
        <button class="handle handle--r" type="button" data-handle="r" aria-label="Trim end">
          <span class="handle__body" data-handle-body><span class="grip" aria-hidden="true"><i></i><i></i></span></span>
        </button>
      </div>

      <div class="times" aria-hidden="true">
        <span class="time" data-time="l">0:00.8</span>
        <span class="time" data-time="r">0:05.0</span>
      </div>

      <div class="controls">
        <button class="play" type="button" data-play aria-label="Play selection">
          <span class="play__face play__face--go" data-play-go><svg viewBox="0 0 20 20"><path d="M7.2 5.4 14.6 10 7.2 14.6Z"/></svg></span>
          <span class="play__face play__face--stop" data-play-stop><svg viewBox="0 0 20 20"><rect x="6" y="5.6" width="2.6" height="8.8" rx=".8"/><rect x="11.4" y="5.6" width="2.6" height="8.8" rx=".8"/></svg></span>
        </button>
        <p class="len" aria-live="polite"><span class="len__lab">Length</span> <span class="roll" data-roll>00:04.2</span></p>
        <button class="trim" type="button" data-trim>
          <span class="trim__face trim__face--idle" data-face-idle><span class="trim__lab">Trim</span></span>
          <span class="trim__face trim__face--busy" data-face-busy aria-hidden="true">
            <svg class="ring" viewBox="0 0 20 20" data-ring><circle cx="10" cy="10" r="7" pathLength="1"/></svg>
          </span>
          <span class="trim__face trim__face--done" data-face-done aria-hidden="true">
            <svg class="tick" viewBox="0 0 20 20"><path d="M5.6 10.4 8.6 13.3 14.4 7.2" pathLength="1" data-tick/></svg>
          </span>
        </button>
      </div>
      <p class="saved" data-saved aria-live="polite">Saved · <span data-saved-len>2.8</span> s</p>
    </section>
  </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.

34 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 trimmer” 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

The panel arrives, the ten frames come in one after the other and the two amber handles rise on a spring. The start handle swells when you grab it and slides from 0:00.8 to 0:01.4: the preview shows the frame under the handle, the part left out darkens, and on release the handle goes one pixel too far and comes back. The same for the end, from 0:05.0 to 0:04.2, and the length rolls from 00:04.2 to 00:02.8. Play: the white playhead runs through the cut, the sun rises, the boat crosses the harbour and the timecode counts. Trim: the label rises and fades, the ring spins, then the tick draws itself, the amber frame glows for a moment and «Saved · 2.8 s» appears below. The handles really drag, with the mouse, a finger and the arrow keys; if nobody touches it, the demo does everything by itself and starts over.

How it works

Everything from two numbers

The state is two times, the start and the end, plus the playhead. One function turns them into pixels from the strip width: handles, frame, shades, times and playhead. Resize, dragging and the autopilot all go down the same road.

A frame for every moment

The scene is drawn in SVG and depends on a single time: the colours of sky and sea, the height of the sun, the place of the boat. The same function draws the ten frames of the strip and the large preview, which follows the handle or the playhead.

Three faces in one place

The Trim button has three stacked faces, the label, the ring and the tick, each as wide as the button and centred on its own: no hidden label widens it and the ring sits in the middle.

Values to change

NameFileDefaultWhat it changes
CLIPscript.js6The length of the whole clip, in seconds.
START_INscript.js0.8Where the cut starts at first.
START_OUTscript.js5Where the cut ends at first.
TARGET_INscript.js1.4Where the demo moves the start handle.
TARGET_OUTscript.js4.2Where the demo moves the end handle.
MIN_CUTscript.js0.6The shortest cut the handles allow.
SPRINGscript.js0.55How springy the handles and buttons are (lower, more bounce).
ROLL_TIMEscript.js0.55Seconds each digit of the length takes to roll.
PLAY_SPEEDscript.js1How fast the playhead runs (1 = real time).
TRIM_TIMEscript.js1.2Seconds the ring spins before the clip is saved.
IDLEscript.js6Seconds after your last touch before the demo plays by itself again.

Try them in the Playground

When to use it

In video and audio editing apps, in social tools that trim a clip before posting, in video uploads where you choose the part to keep: it shows right away what stays and how long it lasts, and confirms without leaving the panel.

On phones

Everything is in em and the size depends on both the width and the height of the window, so the whole panel fits the phone box. The handles have a touch area wider than what you see and drag with a finger (touch-action none).

With reduced motion

No springs or rolling: the handles go to their place, the digits change at once, the playhead runs with no bounce, the button changes face with a fade.

Pitfalls

  • The handle is a wide button (for the finger) holding the visible body: GSAP moves the button, the grab spring lives on the body, so the two transforms never overwrite each other.
  • The times under the handles are recomputed with everything else on each render and stay inside the strip even with the handles at the edge; when they get too close they move apart.
  • While dragging the digits do not roll: they are set in place with gsap.set, and roll only when the handle is released.

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 8.9 KB; the libraries: GSAP 28 KB.

Testing

Tested on 1 December 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 components