
The star rating
Ratings, SVG, Hover
The code block of the docs of Kestrel, a made up payments API, on black: four coloured lines with the Node.js, Python and cURL tabs and the Copy pill in the top right. On hover the two sheets of the icon part by a pixel; on press the lines light up one after another as if they were being read, a ghost copy of the block lifts a few pixels and slides back into the pill, which turns into «Copied» with a tick that draws itself and after two seconds goes back to Copy with a settle. It really copies.
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>
<!--
"Copy code 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 Copy button of a code block with the lines read back into the pill</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" data-stage>
<!-- the code block of an API reference: pressing Copy reads the lines one by one,
a ghost copy of the block lifts off and slides back into the pill, which turns into Copied -->
<figure class="code" data-code>
<div class="code__bar">
<div class="tabs" aria-label="Language">
<span class="tab is-on">Node.js</span>
<span class="tab">Python</span>
<span class="tab">cURL</span>
</div>
<button class="copy" type="button" data-copy data-autoclic aria-label="Copy code">
<span class="copy__light" aria-hidden="true"></span>
<svg class="copy__icon" viewBox="0 0 16 16" aria-hidden="true">
<g class="sheets" data-sheets>
<rect class="sheet sheet--back" data-back x="5.6" y="1.6" width="8.4" height="9.6" rx="2.2"/>
<rect class="sheet sheet--front" data-front x="2" y="4.8" width="8.4" height="9.6" rx="2.2"/>
</g>
<path class="tick" data-tick d="M3.4 8.6 6.5 11.6 12.8 4.6"/>
</svg>
<span class="copy__words" data-words>
<span class="copy__label" data-l-copy>Copy</span>
<span class="copy__label copy__label--done" data-l-done aria-hidden="true">Copied</span>
</span>
</button>
</div>
<pre class="code__body" data-body><code><span class="ln" data-line><span class="ln__glow"></span><span class="ln__n">1</span><span class="ln__t"><span class="t-k">import</span> <span class="t-v">Kestrel</span> <span class="t-k">from</span> <span class="t-s">"kestrel"</span><span class="t-p">;</span></span></span>
<span class="ln" data-line><span class="ln__glow"></span><span class="ln__n">2</span><span class="ln__t"><span class="t-k">const</span> <span class="t-v">k</span> <span class="t-p">=</span> <span class="t-k">new</span> <span class="t-f">Kestrel</span><span class="t-p">(</span><span class="t-c">API_KEY</span><span class="t-p">);</span></span></span>
<span class="ln" data-line><span class="ln__glow"></span><span class="ln__n">3</span><span class="ln__t"><span class="t-k">await</span> <span class="t-v">k</span><span class="t-p">.</span><span class="t-v">payments</span><span class="t-p">.</span><span class="t-f">create</span><span class="t-p">({</span></span></span>
<span class="ln" data-line><span class="ln__glow"></span><span class="ln__n">4</span><span class="ln__t"> <span class="t-a">amount</span><span class="t-p">:</span> <span class="t-n">2400</span><span class="t-p">,</span> <span class="t-a">currency</span><span class="t-p">:</span> <span class="t-s">"eur"</span> <span class="t-p">});</span></span></span></code></pre>
<div class="ghostcopy" data-ghostcopy aria-hidden="true"><div class="ghostcopy__in" data-ghostin></div></div>
</figure>
<p class="sr" data-live aria-live="polite"></p>
<svg class="ghost" data-ghost viewBox="0 0 24 24" aria-hidden="true"><path d="M5 3.2 19.2 11l-6.3 1.6-3.3 5.9Z"></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>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.
53 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 “Copy code button” from Animorio and fit it into my siteThe code is a pre with one span per line, the numbers and syntax colours in classes. The container is a flex column: so the line breaks between the lines, which would count inside a pre, disappear. The text to copy is read from the lines and goes to the clipboard with navigator.clipboard.writeText.
Every line has a layer of light that grows with scaleX from the left, with a mint thread on its edge; they start READ seconds apart, the number takes the accent and the text takes a one pixel step that comes back with elastic.out.
At start the code is cloned inside a glass with backdrop-filter. On press the glass takes the exact place of the code, lifts LIFT pixels with back.out and then animates left, top, width, height and the radius down to the pill: not a scale, which would squash the corners, but the real size, with power3.in speeding towards the end.
Copy and Copied sit one over the other in a 16 pixel window and roll with yPercent and font-stretch; the width of the window is measured from the two words and goes from one to the other with elastic.out, so the pill widens and narrows with a one pixel settle. The tick draws itself with stroke-dashoffset and on the way back leaves from the other end.
Rest, hover and focus with the sheets parting, pressed, copy in progress, done with an aria-live announcement and a changed label, back by itself or with a click. A drawn pointer comes in, rests, clicks and waits for the whole round; at the first real touch it stops and starts again after six quiet seconds.
| Name | File | Default | What it changes |
|---|---|---|---|
READ | script.js | 0.12 | Seconds between one line being read and the next. |
LIFT | script.js | 6 | How many pixels the ghost copy of the block lifts. |
FLY | script.js | 0.55 | Seconds for the copy to go back into the pill. |
HOLD | script.js | 2 | Seconds «Copied» stays before going back to Copy. |
SPLIT | script.js | 1 | How many pixels the two sheets of the icon part on hover. |
PRESS_SCALE | script.js | 0.94 | How far the pressed pill sinks. |
ACCENT | script.js | #7ff0c4 | The accent colour: the light on the lines, the tick and Copied. |
In API docs, a library README, a programming blog or the install page of a developer product: any code block meant to be copied. With working tabs it becomes the multi language block of the guides.
The same animation: the block is at most the screen width minus 32 pixels and the code shrinks with clamp down to 10.4 pixels, so the longest line always fits. A tap is hover and click together.
Nothing moves: the lines light up all together with a fade, the ghost copy appears and fades in place without flying, labels and icon swap with a fade; the pilot’s pointer is hidden.
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.9 KB; the libraries: GSAP 28 KB.
Tested on 11 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.