
The star rating
Ratings, SVG, Hover
The Train model button of a platform for training custom artificial intelligence models, a graphite pill on a near black page, like a Dribbble shot: on hover a dotted grid and the ghost of the last run appear inside it; pressed, it gives and springs back, and the training runs inside the button itself: the loss curve draws itself from the left and falls, with a mint area under it, a glow and a thin cursor at its head, the validation curve follows it dashed, one tick per epoch lights up on the bottom edge, the epoch number rolls and the loss counts down in the chip. At the end the curve flashes, a reflection crosses the pill, the icon turns into a check and the button says Model ready with the accuracy counting up.
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>
<!--
"Train model button" 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>The Train model button with the falling loss curve</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/mona-sans@5.3.0/wdth.css">
<link rel="stylesheet" href="style.css">
</head>
<body>
<main class="stage">
<!-- the Train model button of an AI platform for custom models, a dark graphite pill on a near black page. On hover
a faint grid and the ghost of the last run show inside it; pressed, it gives under the finger and the training
runs inside the button itself: the loss curve draws itself from left to right and falls, the validation curve
follows it dashed, the epochs tick by on the bottom edge and the loss counts down in the chip. At the end the
curve flashes, a reflection crosses the pill, a check draws itself and the button says Model ready -->
<div class="tm" data-wrap>
<span class="tm__floor" data-floor aria-hidden="true"></span>
<button class="tm__btn" type="button" data-btn aria-label="Train model on 12k rows">
<span class="tm__body" data-body>
<span class="tm__clip" aria-hidden="true">
<span class="tm__base"></span>
<svg class="tm__chart" data-chart>
<defs>
<linearGradient id="tm-area" x1="0" y1="0" x2="0" y2="1">
<stop offset="0" stop-color="var(--accent)" stop-opacity="0.32"/>
<stop offset="1" stop-color="var(--accent)" stop-opacity="0"/>
</linearGradient>
<linearGradient id="tm-head" x1="0" y1="0" x2="0" y2="1">
<stop offset="0" stop-color="var(--accent)" stop-opacity="0.9"/>
<stop offset="1" stop-color="var(--accent)" stop-opacity="0"/>
</linearGradient>
<linearGradient id="tm-fade" data-fade gradientUnits="userSpaceOnUse" x1="0" y1="0" x2="20" y2="0">
<stop offset="0" stop-color="#fff" stop-opacity="0"/>
<stop offset="1" stop-color="#fff" stop-opacity="1"/>
</linearGradient>
<mask id="tm-mask" maskUnits="userSpaceOnUse" x="0" y="0" width="400" height="100" data-mask>
<rect data-mask-rect x="0" y="0" width="400" height="100" fill="url(#tm-fade)"/>
</mask>
<filter id="tm-blur" data-filter filterUnits="userSpaceOnUse" x="-20" y="-20" width="340" height="100">
<feGaussianBlur stdDeviation="2.6"/>
</filter>
</defs>
<g class="tm__grid" data-grid></g>
<path class="tm__ghost" data-ghost/>
<path class="tm__area" data-area fill="url(#tm-area)" mask="url(#tm-mask)"/>
<path class="tm__val" data-val/>
<path class="tm__glow" data-glow filter="url(#tm-blur)"/>
<path class="tm__line" data-line/>
<rect class="tm__cursor" data-cursor width="1" fill="url(#tm-head)"/>
<g class="tm__ticks" data-ticks></g>
<text class="tm__value" data-value text-anchor="end">2.310</text>
</svg>
<span class="tm__shine" data-shine></span>
<span class="tm__sweep"><span class="tm__sweep-band" data-sweep></span></span>
</span>
<span class="tm__rim" aria-hidden="true"></span>
<span class="tm__row">
<span class="tm__icon" aria-hidden="true">
<svg viewBox="0 0 24 24">
<path class="tm__mini-axis" d="M5 5v14h14"/>
<path class="tm__mini" data-mini pathLength="1" d="M7.5 7.2c1.6 5.4 3.4 7.6 5.6 8.3 1.9.6 3.6.5 5.4.3"/>
<path class="tm__check" data-check pathLength="1" d="M6.6 12.6l3.7 3.7 7.4-8"/>
</svg>
</span>
<span class="tm__labels" aria-hidden="true">
<span class="tm__label" data-label><span class="tm__main" data-word-rest>Train model</span></span>
<span class="tm__label" data-label>
<span class="tm__main tm__main--busy" data-word-busy>Training</span>
<span class="tm__sub">Epoch <span class="tm__roll" data-epoch><span>1</span></span> of <span data-epochs>8</span></span>
</span>
<span class="tm__label" data-label>
<span class="tm__main" data-word-done>Model ready</span>
<span class="tm__sub">Accuracy <span data-acc>98.4</span>% · <span class="tm__ver" data-ver>v4</span></span>
</span>
</span>
<span class="tm__chip" aria-hidden="true">
<span class="tm__chip-face" data-chip>12k rows</span>
</span>
</span>
</span>
</button>
</div>
<p class="sr" aria-live="polite" data-live></p>
</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.
34 values to change
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 “Train model button” from Animorio and fit it into my siteThe button’s body is a single box moved by GSAP (press and success); inside, a layer clipped with overflow: hidden holds the graphite with its gradient, the SVG chart, the light following the pointer (a radial-gradient with two CSS variables moved by gsap.quickTo) and the final reflection; on top sit the edge with three inner shadows and the row with the icon, the words and the chip.
On every resize a ResizeObserver measures where the widest of the labels ends (offsetLeft plus offsetWidth, hidden ones included) and the chart starts 20 pixels later: so the curve never runs under the text, on desktop or on the phone. Grid, epoch ticks, mask and ghost are rebuilt there.
The three curves (training, validation, last run) are 181 samples computed once: an exponential decay normalised between 1 and 0 plus three sines for the noise, stronger at the start and almost nothing at the end. The path is rebuilt up to the progress p with a last interpolated point, and the area is the same path closed at the bottom, with a mask fading its left side.
A timeline takes p from 0 to 1 in DURATION seconds: from the same value come the curve, the line at its head, the lit ticks (floor of p times EPOCHS), the epoch number, which rolls with yPercent only when it changes, and the loss written at the top, interpolated between START_LOSS and END_LOSS. The drawing is redone only when the state has changed.
At the end the glow and the area rise in 0.14 seconds and settle, the body goes to 1.016 and back with elastic.out, a slanted band crosses the pill with xPercent, the icon’s little curve shrinks away and the check draws itself with pathLength 1 and strokeDashoffset; the accuracy counts up to its value.
| Name | File | Default | What it changes |
|---|---|---|---|
LABEL_REST | script.js | Train model | The words at rest. |
LABEL_BUSY | script.js | Training | The words while the model trains. |
LABEL_DONE | script.js | Model ready | The words at the end. |
ROWS | script.js | 12k rows | The chip at rest: how much data there is. |
VERSION | script.js | v4 | The new version of the model, written at the end. |
EPOCHS | script.js | 8 | How many epochs the run has (one tick each on the bottom edge). |
DURATION | script.js | 4.2 | How many seconds the training takes. |
START_LOSS | script.js | 2.31 | The loss at the start. |
END_LOSS | script.js | 0.087 | The loss at the end. |
ACCURACY | script.js | 98.4 | The accuracy shown at the end, in percent. |
NOISE | script.js | 1 | How jittery the curve is: 0 smooth, 2 very noisy. |
SPRING | script.js | 1 | How springy the press is: 0.4 calm, 2 very bouncy. |
HOLD | script.js | 1.8 | How many seconds Model ready stays before going back to rest. |
AUTO | script.js | true | The button goes round by itself until someone touches it. |
For the main action of a platform that trains or fine-tunes artificial intelligence models, a data analytics app or a developer dashboard: training, importing, indexing, any few-second job with a number that gets better. The button itself becomes the chart, with no extra panel.
On the phone the button is at most 84% of the screen wide and the chart is recomputed to its size, always to the right of the words; there is no hover, so the light under the finger turns on at the touch and the rest, chart included, is the same.
Nothing moves: the button does not sink, the whole curve fades in instead of drawing itself, the epoch and loss numbers change in place, the words swap with a fade and the check fades in.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 9.9 KB; the libraries: GSAP 28 KB.
Tested on 2 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.
Support Animorio
Animorio stays free thanks to the people who support it. If you like, buy us a coffee: it helps us make the next animations.
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.