
The star rating
Ratings, SVG, Hover
The Back to top button of a long article in a made-up baking journal, Field & Loaf, scrolling inside its own window: past the first part of the page the round button springs in bottom right, and a thin ring around the arrow fills with how far down you are. Near the end the ring turns rust and the button opens sideways into a pill that says Top. A click runs the page back up smoothly, the arrow kicks upward, the ring empties backwards and at the top the button tucks itself away. Minimal style, on white.
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>
<!--
"Back to top 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>Back to top button</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/newsreader@5.3.0/opsz.css">
<link rel="stylesheet" href="style.css">
</head>
<body>
<main class="stage">
<!-- a long article of a made-up journal, Field & Loaf, scrolling inside its own window. Past the first screen
the round Back to top button springs in, bottom right; its thin ring fills with how far down the page you
are. Near the end the ring turns rust and the button opens sideways into a «Top» pill. A click runs the
page back up smoothly, the ring empties as it goes and the button tucks itself away at the top. -->
<div class="reader" data-wrap>
<div class="reader__bar" aria-hidden="true">
<span class="reader__brand">Field & Loaf</span>
<span class="reader__meta">Journal · 6 min read</span>
</div>
<div class="page" data-page tabindex="0" aria-label="Article">
<article class="article">
<p class="kicker">Baking notes</p>
<h1>The slow loaf</h1>
<p class="lede">Most of good bread is waiting. The flour, the water and the salt do the rest, if you let them take the night.</p>
<h2>Start the evening before</h2>
<p>Mix four hundred grams of flour with three hundred of water and leave it alone for half an hour. Nothing is happening that you can see, but the flour is drinking, and the dough will be easier to handle for it.</p>
<p>Add the salt and the starter, pinch them in with wet fingers, and fold the dough over itself four times. Cover the bowl and go and do something else.</p>
<h2>Fold, then forget</h2>
<p>Every half hour for two hours, lift one side of the dough and lay it over the rest, turning the bowl a quarter each time. By the last fold it should feel smooth and a little puffed, like a pillow someone has just stood up from.</p>
<p>Then put it in the fridge overnight. The cold slows the yeast and lets the flavour catch up; this is where a plain loaf turns into a good one.</p>
<h2>Shape in the morning</h2>
<p>Tip the dough onto an unfloured board and tighten it into a round with a scraper, pulling it towards you until the skin on top looks taut. Rest it for twenty minutes, then shape it again and lay it seam side up in a floured basket.</p>
<p>An hour at room temperature is usually enough. Press it gently with a finger: if the dent fills back slowly, it is ready.</p>
<h2>Bake it hotter than you think</h2>
<p>Heat the oven and a heavy pot for forty five minutes at the highest setting. Turn the loaf out, score it once with a blade held almost flat, and bake it with the lid on for twenty minutes, then without it until the crust is the colour of chestnuts.</p>
<p>Let it cool on a rack for an hour before you cut it. It is still baking inside, and the crumb will thank you.</p>
<p class="sign">With flour on the keyboard, the Field & Loaf kitchen.</p>
</article>
</div>
<button class="top" type="button" data-top aria-label="Back to top" tabindex="-1">
<span class="top__bg" data-bg aria-hidden="true"></span>
<span class="top__label" data-label aria-hidden="true"><span>Top</span></span>
<span class="top__disc" aria-hidden="true">
<svg viewBox="0 0 48 48" class="top__svg">
<circle class="ring__track" cx="24" cy="24" r="21"></circle>
<circle class="ring__run" data-run cx="24" cy="24" r="21" pathLength="1" transform="rotate(-90 24 24)"></circle>
</svg>
<svg viewBox="0 0 24 24" class="top__arrow" data-arrow>
<path d="M12 18V6.5M6.8 11.4 12 6.2l5.2 5.2"></path>
</svg>
</span>
</button>
<p class="sr" aria-live="polite" data-live></p>
</div>
</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
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 “Back to top button” from Animorio and fit it into my siteAn SVG circle with pathLength=1 and stroke-dasharray 1 1, turned -90 degrees once in its transform attribute: nothing rotates, only stroke-dashoffset changes, set to 1 minus the page position (scrollTop over how far it can scroll). gsap.quickTo makes it follow 0.32 seconds behind, so it never jitters.
Past SHOW the button rises 14 pixels with back.out; under 0.6 of SHOW it hides (the double threshold keeps it from flickering on the edge). Past END GSAP widens the button to OPEN pixels on a spring, the word Top slides in from the left and the ring fades to rust. GSAP only moves the button (size and visibility); the ground and the arrow are separate children, so hover never fights its tweens.
No jumping scrollTo: an object goes from scrollTop to 0 in RETURN seconds with power3.inOut and writes scrollTop at every step. The duration grows a little with the distance. During the run the ring follows the real scroll and empties; at the top the button tucks away to 0.4. A real wheel or finger stops the run.
| Name | File | Default | What it changes |
|---|---|---|---|
SHOW | script.js | 0.16 | How far down the page the button appears |
END | script.js | 0.9 | How far down the ring turns rust and Top opens |
RETURN | script.js | 1.1 | The seconds of the run back up |
SPRING | script.js | 1 | How much the button bounces as it appears |
OPEN | script.js | 92 | The width of the open pill, in pixels |
READ | script.js | 5.2 | The seconds of the scroll down when the demo runs by itself |
IDLE | script.js | 1 | The seconds before the demo starts by itself |
--ruggine | style.css | #c4572e | The ring colour near the end |
At the bottom of any long page: a blog post, a recipe, documentation, a product list, terms of use. The ring also tells how much is left, without a progress bar across the top of the page.
Same animations; on touch there is no hover, the press is there, and a finger on the page during the run stops it. The window is at most 86% of the screen tall and the button stays 48 pixels, easy for a thumb.
The button fades in and out, no spring; on click the page fades, goes back to the top and reappears, no run; the ring follows the scroll with no lag. The demo does not move by itself.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0, Newsreader (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 6.4 KB; the libraries: GSAP 28 KB.
Tested on 20 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.