
The elastic button
Buttons, Hover, Text
An app’s file upload, clean as in a real product: a dashed «Drop files or browse» zone that lights up and swells a touch when a file arrives over it, then folds into a single row with the file type icon, the name, the megabytes growing, the speed, the time left and a thin bar. When it is done the row turns green, the tick draws itself and it slides into the list below; the second file drops out halfway, Retry, and it carries on from where it stopped.
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>
<!--
"One-line upload loader" 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 one-line file upload loader</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">
<!-- an upload card: the dashed drop zone lights up under a dragged file, folds into a single progress row,
and the finished row slides into the list below -->
<section class="card" data-card aria-label="File upload">
<header class="card__head">
<div>
<h1 class="card__title">Upload files</h1>
<p class="card__sub">PDF, PNG or MP4, up to 50 MB each</p>
</div>
<span class="card__count" data-count>No files yet</span>
</header>
<div class="slot" data-slot>
<label class="zone" data-zone>
<input class="zone__input" type="file" multiple data-input aria-label="Choose files to upload">
<svg class="zone__border" aria-hidden="true"><rect data-rect></rect></svg>
<span class="zone__icon" data-zicon>
<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M7 17.5h-.6a4.4 4.4 0 0 1-.6-8.75 6 6 0 0 1 11.6-1.3A4.9 4.9 0 0 1 17 17.5"></path><path d="M12 20v-8.2M8.8 14.6 12 11.4l3.2 3.2"></path></svg>
</span>
<span class="zone__text" data-ztext>Drop files or <b>browse</b></span>
<span class="zone__hint" data-zhint>Max 50 MB per file</span>
</label>
</div>
<ul class="list" data-list aria-live="polite"></ul>
<footer class="card__foot">
<span>Storage</span>
<span class="meter"><i data-meter></i></span>
<span class="card__used" data-used>3.2 GB of 10 GB</span>
</footer>
</section>
<div class="ghost" data-ghost aria-hidden="true">
<div class="chip" data-chip>
<span class="chip__icon" data-chip-icon></span>
<span class="chip__name" data-chip-name></span>
</div>
<svg class="ghost__arrow" viewBox="0 0 24 24"><path d="M5 3.2 19.2 11l-6.3 1.6-3.3 5.9Z"></path></svg>
</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.
28 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 “One-line upload loader” from Animorio and fit it into my siteThe zone and the upload row sit on top of each other in a slot; GSAP takes the slot’s height from the zone’s (a clamp with vh) to the row’s, while the zone fades and the row comes in with back.out. When it is done the height is released and the zone lights up again.
The border is an SVG rect drawn to the zone’s real size and redrawn on resize, with stroke-dasharray 6 6; a GSAP ticker moves stroke-dashoffset at a speed that goes from 8 to 34 when a file is over it.
An object p goes from 0 to 1 on a sine.inOut curve; on every update the speed comes from how much p grew in the last frame, smoothed, and the time left is what remains divided by the speed: the numbers slow down and speed up with the bar.
At the end the row is measured, moved to the top of the list and started from where it was with a FLIP (the x and y difference to zero in 0.6 seconds); the rows already there move down by its height at the same time.
It is a real file input inside a label: you can drag a file from your computer or pick one, and the upload is simulated with its size. The autopilot drags two files, stops the second at FAIL_AT and presses Retry; at the first touch or key it stops.
| Name | File | Default | What it changes |
|---|---|---|---|
FILE_ONE | script.js | brand-deck-q4.pdf | The first file the autopilot drags. |
SIZE_ONE | script.js | 8.1 | How big the first file is, in MB. |
FILE_TWO | script.js | launch-teaser.mp4 | The second file, the one that drops out halfway. |
SIZE_TWO | script.js | 24.6 | How big the second file is, in MB. |
FAIL_AT | script.js | 0.46 | Where the second file drops out (0 to 1). |
UPLOAD_SPEED | script.js | 1 | How fast the upload is (1 = about 3 MB a second). |
ACCENT | script.js | #4f46e5 | The colour of the lit zone and the bar. |
For file uploads in an app or a dashboard: attachments, documents for a client, videos to publish, profile photos, handing in a piece of work; and for any form that asks for a file.
The card takes the width minus the margins, the zone gets lower with the screen height and the rows drop to 54 pixels; tapping the zone opens the phone’s file picker. The same animations, with adapted sizes.
The dashes stay still and nothing moves: the zone and the row swap with a fade, the bar fills, the finished row appears in the list without sliding and the tick is already drawn.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 8.2 KB; the libraries: GSAP 28 KB.
Tested on 25 October 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.