
The star rating
Ratings, SVG, Hover
The brush size slider of a made-up drawing app, alone in the middle on white. Drag the handle along a wedge-shaped track, thin on the left and thick on the right, and the freehand stroke in the little canvas above swells and thins on a spring, with the brush tip appearing at its end as a dashed circle. The size in pixels rolls, the handle snaps onto the usual sizes (2, 4, 8, 12, 16, 24, 32, 48) with a little jump of the tick, and pressed it tightens with a blue halo. Also with the minus and plus buttons and the arrow keys.
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>
<!--
"Brush size slider" 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>Brush size slider</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 brush size control of a made-up drawing app: drag the handle and the soft stroke above swells and thins,
the brush tip circle grows at its end, the size in pixels rolls, and the handle snaps onto the usual sizes -->
<section class="tool" data-tool aria-label="Brush">
<header class="tool__head">
<span class="tool__title">
<svg class="tool__icon" viewBox="0 0 24 24" aria-hidden="true">
<path class="brush__handle" d="M19.6 3.6c.7.7.7 1.8 0 2.5l-7.4 7.4-2.5-2.5 7.4-7.4c.7-.7 1.8-.7 2.5 0z"></path>
<path class="brush__tip" d="M9.2 11.6l2.6 2.6c-.4 2.6-2.4 4.4-5.6 4.6-1 .1-2-.3-2.6-.9 1.6-.4 2.2-1.4 2.4-2.8.2-2 1.4-3.3 3.2-3.5z"></path>
</svg>
<span data-label>Brush size</span>
</span>
<span class="readout" aria-hidden="true">
<span class="reels" data-reels>
<span class="reel reel--tens" data-reel="0"><span class="reel__strip"><span>0</span><span>1</span><span>2</span><span>3</span><span>4</span><span>5</span><span>6</span><span>7</span><span>8</span><span>9</span></span></span>
<span class="reel" data-reel="1"><span class="reel__strip"><span>0</span><span>1</span><span>2</span><span>3</span><span>4</span><span>5</span><span>6</span><span>7</span><span>8</span><span>9</span></span></span>
</span>
<span class="readout__unit">px</span>
</span>
</header>
<div class="canvas" aria-hidden="true">
<svg class="canvas__svg" viewBox="0 0 300 140" preserveAspectRatio="xMidYMid meet">
<path class="guide" data-guide d="M30 92 C 66 34, 118 30, 146 66 S 220 116, 268 52"></path>
<path class="stroke__shadow" data-shadow d=""></path>
<path class="stroke" data-stroke d=""></path>
<circle class="tipring" data-tipring cx="268" cy="52" r="6"></circle>
</svg>
</div>
<div class="control">
<button class="step" type="button" data-step="-1" aria-label="Smaller brush" tabindex="-1">
<svg viewBox="0 0 16 16" aria-hidden="true"><path d="M3.5 8h9"></path></svg>
</button>
<div class="track" data-track>
<svg class="track__svg" viewBox="0 0 300 36" preserveAspectRatio="none" aria-hidden="true">
<defs>
<clipPath id="fill-clip"><rect data-fillclip x="0" y="0" width="0" height="36"></rect></clipPath>
</defs>
<path class="wedge" data-wedge d=""></path>
<path class="wedge wedge--fill" data-wedgefill d="" clip-path="url(#fill-clip)"></path>
</svg>
<div class="ticks" data-ticks aria-hidden="true"></div>
<div class="handle" data-handle role="slider" tabindex="0" aria-label="Brush size" aria-valuemin="1" aria-valuemax="48" aria-valuenow="12" aria-valuetext="12 pixels">
<span class="handle__halo" data-halo></span>
<span class="handle__body" data-body>
<span class="handle__dot" data-dot></span>
</span>
</div>
</div>
<button class="step" type="button" data-step="1" aria-label="Bigger brush" tabindex="-1">
<svg viewBox="0 0 16 16" aria-hidden="true"><path d="M3.5 8h9M8 3.5v9"></path></svg>
</button>
</div>
</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>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.
40 values to change
Works with Claude, Claude Code, ChatGPT, Cursor, VS Code, Windsurf, Codex, Gemini CLI
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 “Brush size slider” from Animorio and fit it into my siteThe stroke is not an SVG stroke: it is a filled shape. The script samples 91 points along a hidden curve with getPointAtLength, works out the normal at each and puts two points on either side, half the width away for the pressure (thinner at the ends, with a slight wave); then it closes the shape with two round arcs. So the width changes along the line and is recomputed every frame.
The handle follows the finger almost at once (0.12 seconds), while the stroke width catches up with a back.out tween of FOLLOW seconds: that difference is what makes the stroke feel soft.
The position is the normalised size raised to 0.6: small sizes, the ones used most, get more room. The ticks are placed with the same function and the wedge is redrawn in real pixels on every resize.
If the raw value is within SNAP pixels of a usual size, the handle goes onto the tick; the tick jumps with elastic.out and changes colour. Arrow keys move one pixel at a time without the magnet, Page Up and Down go tick to tick.
Tens and units are two columns of digits in a window one line tall; they move with yPercent and back.out. Below 10 the tens reel shrinks to zero width.
| Name | File | Default | What it changes |
|---|---|---|---|
LABEL | script.js | Brush size | The name written at the top of the tool card. |
SIZE | script.js | 12 | The brush size at the start, in pixels. |
MIN_SIZE | script.js | 1 | The smallest size, in pixels. |
MAX_SIZE | script.js | 48 | The largest size, in pixels. |
TICKS | script.js | 2, 4, 8, 12, 16, 24, 32, 48 | The usual sizes under the track, where the handle snaps, separated by commas. |
SNAP | script.js | 1.5 | How close to a usual size the magnet catches the handle, in pixels of size. |
FOLLOW | script.js | 0.55 | How long the stroke takes to reach the new size, in seconds. |
BOUNCE | script.js | 1.6 | How far the stroke overshoots before settling (0 = no bounce). |
LOOP_PAUSE | script.js | 1.6 | The pause at the end of the self-running loop before it starts again, in seconds. |
In the toolbar of a drawing app, a photo editor or a shared whiteboard, for the size of the brush, the eraser or the line; or in any panel where you pick a size and need to see it straight away.
The card takes at most the width minus 24 pixels and the canvas is sized on the height (between 96 and 132 pixels): everything fits the phone preview box. The track drags with a finger without scrolling the page; the wedge and the ticks are recomputed on the real width.
No springs or jumps: the stroke is already drawn, the width, the handle and the number change straight to the new value, the halo appears without growing and the self-running loop does not start.
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.4 KB; the libraries: GSAP 28 KB.
Tested on 23 November 2026
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.
You asked for
We made it for you: it’s in the library, with the preview, the Playground and the code to copy.
An animation you can’t find, or a site to take apart in the journal: tell us which. We pick the next ones from here.
With your account’s email and password.
or with your email
You’re signed in as .
With your account, you can download the zip of every animation and every pack, for free.