Skip to content
animorio
IT
Back to the library

Piling upload zone

Physics, HoverGSAP, CSS onlyMediumCompressed weight: Demo 11 KBGSAP 28 KBMatter.js 25 KBFreeDownload the zip

The upload panel of Cartwell, a made-up file sharing app, on warm white, in the style of real product interface pieces: files dragged over the zone spread out and, once released, fall with real physics, bounce, bump into each other and pile up; the pointer passing over them pushes them aside, and you can grab and throw them. Upload sends them one at a time from the top of the pile, each with its own bar and tick, and the ones left fall into the gap.

The code

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>
<!--
  "Piling upload zone" 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 upload drop zone where files fall and pile up</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" data-stage>
    <!-- the upload panel of a made-up file sharing app, Cartwell: dragged files drop into the zone with real
         physics, bump and pile up, step aside when the pointer passes and can be thrown around; Upload sends
         them one at a time from the top of the pile, and the rest fall into the gap -->
    <section class="card" data-card aria-label="Upload files to Q4 Review">
      <header class="head">
        <div class="brand">
          <svg class="brand__mark" viewBox="0 0 24 24" aria-hidden="true"><path d="M3.8 8.2c0-1.1.9-2 2-2h3.6l1.8 1.9h7c1.1 0 2 .9 2 2v7.6c0 1.1-.9 2-2 2H5.8c-1.1 0-2-.9-2-2Z"/><path d="M12 16.6v-5.2M9.7 13.6 12 11.3l2.3 2.3"/></svg>
          <div class="brand__txt">
            <span class="brand__name" data-brand>Cartwell</span>
            <span class="brand__folder" data-folder>Q4 Review</span>
          </div>
        </div>
        <div class="count" data-count-box aria-live="polite">
          <span class="count__lbl">Uploaded</span>
          <span class="count__n"><span class="count__roll" data-count>0</span></span>
          <span class="count__of">of <span data-total>4</span></span>
        </div>
      </header>

      <div class="zone" data-zone>
        <span class="zone__edge" aria-hidden="true"></span>
        <span class="zone__floor" aria-hidden="true"></span>
        <div class="zone__hint" data-hint>
          <svg class="zone__ico" data-hint-ico viewBox="0 0 24 24" aria-hidden="true"><path class="ico-up" d="M12 15.2V5.4M8.3 9 12 5.3 15.7 9"/><path class="ico-tray" d="M4.5 13.6v3.2c0 1 .8 1.8 1.8 1.8h11.4c1 0 1.8-.8 1.8-1.8v-3.2"/><path class="ico-ok" d="m7.6 12.4 3 3 5.8-6.2"/></svg>
          <span class="zone__t" data-hint-t>Drop files here</span>
          <span class="zone__s" data-hint-s>or <u>browse</u> from your computer</span>
        </div>
      </div>

      <footer class="foot">
        <span class="foot__info" data-info>Up to 2 GB per file</span>
        <button class="go" type="button" data-go disabled>
          <span class="go__in">
            <svg class="go__ico" viewBox="0 0 16 16" aria-hidden="true"><path class="go__up" d="M8 12.2V4.2M4.9 7.2 8 4.1l3.1 3.1"/><path class="go__ok" d="m3.6 8.4 2.9 2.8 5.9-6.3"/></svg>
            <span class="go__t" data-go-t>Upload</span>
          </span>
        </button>
      </footer>

      <div class="files" data-files></div>
    </section>

    <svg class="cursor" data-cursor viewBox="0 0 24 24" aria-hidden="true"><path d="M5 2.8v16.4l4.2-4 2.8 6.2 2.9-1.3-2.8-6.1h5.9Z"/></svg>
  </main>

  <script src="https://cdn.jsdelivr.net/npm/gsap@3.15.0/dist/gsap.min.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/matter-js@0.20.0/build/matter.min.js"></script>
  <script src="script.js"></script>
</body>
</html>

Playground

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.

29 values to change

Or ask your AI assistant for it

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 “Piling upload zone” from Animorio and fit it into my site
Platform licenseFree on your sites and your clients’ sites. Want it inside a website builder, a template platform or a client dashboard? There’s a license for agencies and platforms.

What it does

On a warm white background sits the white upload card of Cartwell, a made-up file sharing app: at the top the logo with a drawn folder, the folder name, Q4 Review, and on the right the counter Uploaded 0 of 4. Below is the drop zone, light with a dashed border, the icon of the arrow into the tray, Drop files here and the line or browse from your computer; at the bottom Up to 2 GB per file and the black Upload button, switched off. The drawn pointer arrives holding four files in a fan, each with the icon of its type, its name and its size (brief-q4.pdf, hero-shot.png, interview.mov, moodboard.fig): the files follow it one after another, each a little later. Over the zone the border becomes a blue line, the background tints and the text changes to Release to add 4 files; then the files spread out over the zone and, once released, really fall: they hit the floor, bounce, the top ones fall tilted, strike a corner, rock and settle on the others. Every hit squashes the file for a moment and dips the floor line by a pixel. The pointer passes over the pile and the files step aside, lift with a longer shadow and settle again. Then it presses Upload, which turns into Uploading: the top file uploads with its blue bar along its bottom edge, gets its tick, comes off, straightens up and flies into the counter, which rolls to the next number; the ones left fall into the free spot. When all are done the zone says All files uploaded with a tick, at the bottom 47.9 MB sent, and the button turns into a blue Done; pressed, it all starts again. With real hands the files move as the mouse passes over them and can be grabbed and thrown with a finger or the mouse; a tap on the empty zone drops the files in as if picked from the computer.

How it works

The zone’s world

The physics is Matter.js 0.20.0, with GRAVITY and four static walls around the zone: the floor, the two sides and a roof, six pixels inside the edge. Sizes are read with offsets climbing up to the card, so the world matches the page even when the phone box scales it down; on resize the walls are rebuilt and any file left outside is put back in.

Files in hand

While the pointer carries them the files are not bodies: each chases its place in the fan with an exponential easing a little slower than the one before, so they trail behind. Over the zone the fan spreads out over two rows that do not touch, and on release each file becomes a rounded rectangle with the speed it had in hand and a small spin.

The hits

The engine runs in GSAP’s ticker in fixed 8 millisecond steps, so the autopilot, the video and the tests always give the same pile. On every collisionStart faster than a threshold, the file that is hit squashes by a few per cent and springs back, and when the hit is against the floor the floor line drops by a pixel and comes back up.

The pointer that pushes

On every step, if the pointer is over the zone, every file within a radius of a little more than half its width gets a force that moves it away and lifts it a little, stronger the closer it is (PUSH). The file right under the pointer lifts with a longer shadow; with a finger or a pressed mouse an elastic Matter.js constraint grabs it and you can throw it.

The upload

Upload always takes the top file: its bar fills in a time given by its size divided by SPEED, then the tick comes in with back.out and the body leaves the world. From there GSAP carries it: it rises nine pixels as it straightens, then flies into the counter shrinking, and the counter rolls its number. The other files, with nothing left to hold them, fall on their own.

Values to change

NameFileDefaultWhat it changes
BRANDscript.js'Cartwell'The name of the made-up app, written above the folder.
FOLDERscript.js'Q4 Review'The folder the files go to.
GRAVITYscript.js1.3Gravity in the zone: higher means sharper falls and flatter piles.
BOUNCEscript.js0.16How much a file bounces when it hits the floor or another file.
FRICTIONscript.js0.2The friction between files: low and they slide over each other, high and they stay where they land.
PUSHscript.js1How much the files step aside when the pointer passes over them (0 for not at all).
SPEEDscript.js30The upload speed in megabytes per second: higher and the files leave sooner.
HOLDscript.js1.3The seconds the drawn pointer waits between one gesture and the next.

Try them in the Playground

When to use it

For the file upload of an app or a site: a workspace, an archive, a form to send documents, a client portal. Whoever drags the files in sees they have really arrived, one on top of the other, and sees them leave one at a time.

On phones

The same animation with adapted sizes: the card narrows, the files are a little narrower and the zone lower, sized on the height too; the files are grabbed and thrown with a finger, and a tap on the empty zone drops them in.

With reduced motion

No falls, flights or pushes: the four files are already resting in two tidy columns and the scene fades in; Upload fills the bars and the files fade out one at a time, with the counter changing number without rolling.

Pitfalls

  • Five files in a zone two files wide always ended with two of them wedged at an angle between the wall and the middle one: with four, in two columns, the pile settles and stays lively.
  • Creating the bodies on top of each other in the fan blew the pile apart, because Matter.js pushes overlapping bodies apart at once: before the release the fan spreads out over two rows that do not touch.
  • The engine runs in fixed 8 millisecond steps in GSAP’s ticker and not with Matter.js’s Runner: this way it stops and starts with the rest of the demo, and the pile comes out the same every loop.

Libraries

GSAP 3.15.0, Matter.js 0.20.0, Mona Sans (font variabile) 5.3.0.

Compressed with gzip, the three demo files weigh 11 KB; the libraries: GSAP 28 KB, Matter.js 25 KB.

Testing

Tested on 29 October 2026

  • Desktop: Done
  • Phone: Done
  • Reduced motion: Done
  • Safari on iPhone: To do

License

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.

All animations