Skip to content
animorio
IT
Back to the library

Draggable app dock

Physics, HoverGSAP, CSS onlyAdvancedCompressed weight: Demo 9.0 KBGSAP 28 KBFreeDownload the zip

The dock of Orrin, a made-up desktop, on a warm paper with two soft lights. Every icon is a small body on springs written by hand: it follows the pointer a beat behind, leans into its own speed, and under the pointer it lifts and shows its name. Drag an app from the suggestions over the dock and the icons part to open the place where it will land, while the glass tray stretches on its own spring; let go and the app drops into the gap with a small squash and its neighbours feel the push. Pull an icon out of the dock and past a line it turns see-through; let go and it leaves in a puff while the dock closes 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>
<!--
  "Draggable app dock" 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 drag and drop app dock, with icons that spring out of the way</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 dock of a made-up desktop, Orrin. Drag an app from the suggestions into the dock: the icons spring out of
         the way to make room, the glass tray stretches, and the app drops into the gap with a small squash. Drag an
         icon up out of the dock and it goes in a puff. Every icon is a little body on springs: it leans into its
         speed, lifts under the pointer and its neighbours feel the push when one lands. -->
    <div class="wall" aria-hidden="true">
      <span class="wall__glow wall__glow--a"></span>
      <span class="wall__glow wall__glow--b"></span>
      <span class="wall__grain"></span>
    </div>

    <header class="head" data-head>
      <span class="head__os">
        <svg viewBox="0 0 16 16" aria-hidden="true"><circle cx="8" cy="8" r="6.2" fill="none" stroke="currentColor" stroke-width="1.6"/><path d="M8 1.8a6.2 6.2 0 0 1 0 12.4z" fill="currentColor"/></svg>
        Orrin
      </span>
      <p class="head__hint" data-hint>Drag an app into the Dock</p>
    </header>

    <section class="shelf" data-shelf aria-label="Suggested apps">
      <span class="shelf__label">Suggested</span>
      <span class="shelf__tray" data-tray></span>
    </section>

    <div class="dock" data-dock aria-label="Dock">
      <span class="dock__shine" aria-hidden="true"></span>
    </div>
    <p class="dock-count" data-count aria-live="polite"><span data-count-num>5</span> apps in Dock</p>

    <div class="icons" data-icons></div>
    <div class="puffs" data-puffs aria-hidden="true"></div>
    <p class="toast" data-toast aria-live="polite"></p>

    <svg class="cursor" data-cursor viewBox="0 0 24 24" aria-hidden="true">
      <path d="M5 3.5l13.2 7.6-5.7 1.3 3.3 5.9-2.4 1.3-3.3-5.9-4.1 4.2z" fill="#111" stroke="#fff" stroke-width="1.4" stroke-linejoin="round"/>
    </svg>

    <!-- the app glyphs, drawn once -->
    <svg width="0" height="0" style="position:absolute" aria-hidden="true">
      <symbol id="g-notes" viewBox="0 0 24 24"><rect x="5" y="4" width="14" height="16" rx="2.4" fill="#fff"/><path d="M8 9h8M8 12.5h8M8 16h5" stroke="#d9a21b" stroke-width="1.6" stroke-linecap="round"/></symbol>
      <symbol id="g-mail" viewBox="0 0 24 24"><rect x="3.5" y="6" width="17" height="12.5" rx="2.2" fill="#fff"/><path d="M4.5 7.5l7.5 6 7.5-6" fill="none" stroke="#2f6fe0" stroke-width="1.7" stroke-linejoin="round"/></symbol>
      <symbol id="g-cal" viewBox="0 0 24 24"><rect x="4" y="4.5" width="16" height="15.5" rx="2.6" fill="#fff"/><path d="M4 8.2h16" stroke="#e5484d" stroke-width="3.2"/><text x="12" y="17.6" text-anchor="middle" font-size="8" font-weight="700" font-family="Mona Sans Variable, sans-serif" fill="#1b1b1f">14</text></symbol>
      <symbol id="g-tunes" viewBox="0 0 24 24"><path d="M10 16.5V6.8l9-2.3v9.7" fill="none" stroke="#fff" stroke-width="1.9" stroke-linejoin="round"/><circle cx="7.6" cy="16.6" r="2.6" fill="#fff"/><circle cx="16.6" cy="14.3" r="2.6" fill="#fff"/></symbol>
      <symbol id="g-photos" viewBox="0 0 24 24"><g opacity=".92"><ellipse cx="12" cy="7.6" rx="2.6" ry="4" fill="#ffb02e"/><ellipse cx="16.4" cy="12" rx="4" ry="2.6" fill="#47c26a"/><ellipse cx="12" cy="16.4" rx="2.6" ry="4" fill="#3d8bfd"/><ellipse cx="7.6" cy="12" rx="4" ry="2.6" fill="#f2557a"/></g></symbol>
      <symbol id="g-maps" viewBox="0 0 24 24"><path d="M4 7l5-2 6 2 5-2v12l-5 2-6-2-5 2z" fill="#fff"/><path d="M9 5v12M15 7v12" stroke="#bfe5c9" stroke-width="1.4"/><path d="M15.6 9.2c0 1.9-2.6 4.6-2.6 4.6s-2.6-2.7-2.6-4.6a2.6 2.6 0 0 1 5.2 0z" fill="#e5484d"/><circle cx="13" cy="9.2" r="1" fill="#fff"/></symbol>
      <symbol id="g-weather" viewBox="0 0 24 24"><circle cx="9.5" cy="9" r="3.4" fill="#ffd34d"/><path d="M8 18.5h8.6a3.4 3.4 0 0 0 .2-6.8 4.6 4.6 0 0 0-8.8 1.4A2.7 2.7 0 0 0 8 18.5z" fill="#fff"/></symbol>
    </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>

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.

25 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 “Draggable app dock” 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 the desktop paper sit the Orrin label, the «Suggested» shelf with Maps and Weather and, further down, the glass dock with Notes, Mail, Calendar, Tunes and Photos; under it, how many apps there are. Hover the icons and they lift a few pixels and show their name. Picked up, they follow the finger on a spring and lean as they run; over the dock they open their place among the others, which spring aside, and the tray stretches. Let go and they drop into the gap with a little squash, pushing their neighbours; dragged out of the dock past a line they turn see-through and, let go, vanish in a puff with the notice at the bottom. Left alone, a pointer adds Maps between Calendar and Tunes and takes Photos out.

How it works

A spring for everything

Every icon has a position, a speed and a place it wants to reach, on x, on y, in scale and in lean. Each frame the acceleration is the stiffness times the distance to the place minus the damping times the speed: damped below critical, it lands with a small overshoot and comes back.

The place is always recomputed

The dock is a list: the places are spread from the centre. While an icon is in the hand the dock is computed with one extra place where it would land, and the others move there on their own springs: that is what makes them part.

The hand is stiffer

The held icon uses the same spring multiplied (FOLLOW): it follows the finger closely but with a lag you can feel, and it leans in proportion to its horizontal speed.

Landing, removing

Let go over the dock, it joins the list; its scale gets a backward kick (the squash) and the two neighbours a sideways one. Pulled more than REMOVE_AT icons above the dock, let go it shrinks to nothing and nine white drops spread and fade.

Values to change

NameFileDefaultWhat it changes
SPRINGscript.js380Stiffness of the springs that bring every icon to its place.
DAMPINGscript.js25How quickly an icon stops wobbling (lower, more bounce).
FOLLOWscript.js2.4How much tighter the spring of the held icon is.
TILTscript.js0.035Degrees of lean for every pixel per second of speed.
LIFTscript.js8Pixels an icon rises under the pointer.
PUSHscript.js120Nudge the neighbours get when an icon lands in the dock.
GAPscript.js0.22Space between icons, as a share of their size.
REMOVE_ATscript.js1.5How many icon sizes above the dock you pull an icon to remove it.
IDLEscript.js4Seconds before the pointer comes back by itself.
LOOPscript.jstrueLeft alone, it adds an app and takes one out, again and again.

Try them in the Playground

When to use it

For showing off an operating system or a desktop, an app launcher, a customisable toolbar, an app that gets added to favourites, or anywhere you want to show drag and drop with physics you can feel.

On phones

The same physics with adapted sizes: the icon size comes from the smaller of the box width and height, and a dock of seven icons fits even at 341 pixels. With a finger you drag as with a mouse.

With reduced motion

No springs and no wobble: icons go straight to their place, dragging follows the finger with no lag, the count changes without rising, and the puff is a short fade.

Pitfalls

  • A GSAP tween for every icon and every move would pile up as places change: with springs integrated every frame the place can change at any time and the motion stays continuous.
  • The transform is written by hand in one style (translate, rotate, scale): two libraries or CSS on the same element would erase each other.
  • The held icon must not count when places are computed, or the gap opens twice: it leaves the dock while in the hand and goes back to its index if dropped elsewhere.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

Compressed with gzip, the three demo files weigh 9.0 KB; the libraries: GSAP 28 KB.

Testing

Tested on 14 November 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