Skip to content
animorio
IT
Back to the library

Nearby share

Hover, SVGGSAP, CSS onlyMediumCompressed weight: Demo 7.1 KBGSAP 28 KBFreeDownload the zip

Sending a file to whoever is near: three people on an arc and the file at the bottom. Drag it and the file tilts with its speed while the people lean towards it; the closest one lights up. Drop it and it goes into their disc, a ring fills with the percentage and the tick snaps in at the end. A tap on a person works too: the file flies there by itself.

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>
<!--
  "Nearby share" 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>Nearby share</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">
    <!-- sharing a file with the devices around you: drag the file towards a person and the avatars lean in,
         drop it and a ring fills round them while it arrives; a tap on a person sends it too -->
    <section class="ns" data-ns aria-label="Share nearby">
      <header class="ns__head">
        <h2>Share nearby</h2>
        <p data-status aria-live="polite">Drag the file onto someone</p>
      </header>
      <div class="ns__field" data-field>
        <svg class="ns__arcs" viewBox="0 0 300 232" aria-hidden="true" preserveAspectRatio="xMidYMid slice">
          <circle cx="150" cy="188" r="104"></circle><circle cx="150" cy="188" r="150"></circle>
        </svg>
        <div class="ns__people" data-people></div>
        <div class="ns__file">
          <span class="ns__slot" data-slot aria-hidden="true"></span>
          <div class="ns__tile" data-tile tabindex="-1">
            <span class="ns__glow" data-glow aria-hidden="true"></span>
            <svg class="ns__doc" viewBox="0 0 26 32" aria-hidden="true"><path class="ns__sheet" d="M3 1h13l8 8v19a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V4a3 3 0 0 1 3-3Z" transform="translate(1 0)"></path><path class="ns__fold" d="M17 1v6a2 2 0 0 0 2 2h6Z"></path><rect class="ns__band" x="5" y="19" width="16" height="7" rx="2"></rect></svg>
            <span class="ns__meta"><b>Moodboard.pdf</b><i>2.4 MB</i></span>
          </div>
        </div>
      </div>
    </section>

    <svg class="ghost" data-ghost viewBox="0 0 24 24" aria-hidden="true"><path d="M5 3.200 19.200 11l-6.300 1.600-3.300 5.900Z"></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>

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.

14 values to change

Works with Claude, Claude Code, ChatGPT, Cursor, VS Code, Windsurf, Codex, Gemini CLI

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 “Nearby share” 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 near-black ground with a blue glow from below, a dark card: “Share nearby” and under it “Drag the file onto someone”. Three glass discs with initials sit on an arc, each with a name and a device (Phone, Laptop, Tablet); bottom centre, the file tile, “Moodboard.pdf, 2.4 MB”, over two thin arcs. Pick the tile up and it lifts with a blue halo, leaving a dashed outline in its place; as it moves it tilts the way it is going, and the discs nearby grow and lean towards it. The one close enough to receive it gets a ring of light. Let go there and the tile shrinks into the disc, which bounces; the others dim, a blue ring fills round it and the percentage climbs under the name. At the end “Sent” appears, a blue tick pops out at the disc’s bottom right and the line at the top says “Sent to Mara”. Shortly after, the tile springs back to its place. Dropped in empty space it bounces home; tap a person and it flies there along a curve.

How it works

The drag

pointerdown captures the pointer, pointermove shifts the tile with x and y inside the field’s edges; every frame the tilt chases the horizontal speed.

The people lean in

In the same frame the distance between the tile and each disc is measured: the closer it is, the more the disc grows and shifts towards it; under a threshold it becomes the target and lights the halo.

The arrival

On release the tile goes to the target’s centre as it shrinks; an SVG circle with pathLength 1 fills with stroke-dashoffset while the same number writes the percentage.

The tap

Tap a person and the x starts slowly while the y arrives slowly: two tweens with two different curves draw the arc of the flight.

Values to change

NameFileDefaultWhat it changes
ACCENTscript.js#6ea8ffThe colour of the ring, the tick and the band on the file.
MAGNETscript.js1How far the people lean towards the file as it passes: 0 = still, 2 = a lot.
SEND_TIMEscript.js1.6How many seconds the file takes to arrive (the ring filling).
SPRINGscript.js1How much the file bounces when it goes back to its place: 0.3 = a little, 2 = a lot.
LOOPscript.jstrueLeft alone, the demo’s pointer drags the file onto one person and taps another.

Try them in the Playground

When to use it

In the share sheet of a file, photo or notes app, when something is sent to nearby devices; also for assigning a task to a person or moving an item onto a container.

On phones

It is made for the phone: the card is 316 pixels wide at most, the field has touch-action none so the finger drags without scrolling the page, and every person can also simply be tapped.

With reduced motion

The file is not dragged and does not fly: tap a person and the others dim, the percentage climbs in the text with the ring, then “Sent” and the tick. The demo does not move by itself.

Pitfalls

  • People, devices and file are made up and nothing is sent in the demo: in a real app the ring follows the transfer’s actual progress, and the receiver has to accept.
  • Dragging alone is not enough: keyboard and screen reader users must be able to choose the person with a button, as here.
  • The discs’ positions are measured again at every gesture and on resize, because the card changes size with the screen.
  • The magnetic pull moves a container and the arrival bounce the disc inside it: two elements, or the two movements cancel each other.
  • transform-origin on an SVG element is measured on its box: the ring starts from the top with a rotate written in the transform attribute.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

Tested on 22 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