Skip to content
animorio
IT
All components

Share location button

Buttons, HoverGSAP, CSS onlyMediumCompressed weight: Demo 9.4 KBGSAP 28 KBFreeDownload the zip

The Share location button of a made-up app for meeting up with friends, on black: on hover the location arrow leans toward the pointer; pressed, the arrow turns north and becomes the centre of a radar, two thin waves leave the pill, three friends pop out one after the other with their distance rolling and the pill says Sharing for 1 hour with a time ring wearing down. Pressed again, the friends go back into the pill and the radar retracts.

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>
<!--
  "Share location 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 Share location button with the radar that finds your friends</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">
    <!-- the Share location button of Orbet, a made-up app for meeting up with friends: pressed, the arrow turns
         north and becomes the centre of a radar, a thin wave leaves the pill, three friends spring out around it
         with their rolling distance and the pill counts the hour down; pressed again, everything comes back in -->
    <div class="wrap" data-wrap>
      <span class="wave" data-wave aria-hidden="true"></span>
      <span class="wave" data-wave aria-hidden="true"></span>
      <span class="range" data-range aria-hidden="true"></span>

      <div class="friends" data-friends aria-hidden="true"></div>

      <div class="pill" data-pill>
        <span class="pill__glow" data-glow aria-hidden="true"></span>
        <div class="pill__clip">
          <span class="pill__grain" aria-hidden="true"></span>
          <span class="pill__sheen" data-sheen aria-hidden="true"></span>
        </div>
        <button class="share" type="button" data-share aria-pressed="false">
          <span class="dial" data-dial aria-hidden="true">
            <svg class="dial__ring" viewBox="0 0 44 44">
              <circle class="dial__track" cx="22" cy="22" r="20.5"></circle>
              <circle class="dial__time" data-time cx="22" cy="22" r="20.5"></circle>
            </svg>
            <span class="dial__disc" data-disc></span>
            <svg class="arrow" data-arrow viewBox="0 0 24 24">
              <path class="arrow__body" data-arrowbody d="M12 3.6 18.6 19.4 12 16.1 5.4 19.4Z"></path>
              <path class="arrow__slash" data-slash d="M5.2 5.2 18.8 18.8"></path>
            </svg>
          </span>
          <span class="words" data-words>
            <span class="word" data-word="idle">Share location</span>
            <span class="word" data-word="on">Sharing for 1 hour</span>
            <span class="word" data-word="off">Sharing stopped</span>
          </span>
        </button>
        <span class="pill__edge" aria-hidden="true"></span>
      </div>
      <p class="sr" data-live aria-live="polite"></p>
    </div>

    <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>

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.

22 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 “Share location button” 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 black background there is just a dark pill sixty pixels tall, its body fading from graphite to near black, a very fine grain, a one pixel edge that catches the light along the top and deep shadows with a faint blue glow: inside, a glass disc with the location arrow drawn in line, tilted as on maps, and the words Share location. On hover the pill lifts by a pixel, the edge thread lights up where the pointer is, the words widen on the wdth axis and the arrow leans toward the pointer, following it on a small spring. Pressed, the pill gives by a pixel and comes back elastically. On click the arrow turns north with a hop and fills with white, the disc lights up blue, a thin ring draws itself around it and the words roll into Sharing for 1 hour while the pill widens. A glow runs along the edge, a shine crosses the body and two thin waves, shaped like the pill itself, spread to the edges of the field and fade; behind them a barely visible dashed ring stays, the radar’s range. Then three friends come out of the pill one after the other and fly to their places on a spring, tilting and straightening: a coloured disc with the initial, a little tail pointing back at you and under it a tag with name and distance, Lea · 300 m, Sam · 850 m, Noor · 120 m, with the digits rolling like an odometer. The friends sway gently, a moment later two of them get closer and their distance rolls again, and meanwhile the time ring around the arrow slowly wears down. A second click stops it: the words turn into a grey Sharing stopped, a coral slash draws across the arrow as it tilts back, the time ring retracts, the friends drop their tags and go back into the pill, the radar shrinks onto the pill along with a wave coming back, and the pill gulps. A moment later the slash leaves and Share location returns. A drawn pointer shows the whole loop on its own and starts again.

How it works

One pill, three labels

The pill holds the disc with the arrow and three labels stacked in a window 22 pixels tall: Share location, Sharing for 1 hour and Sharing stopped. The old one leaves upwards, the new one comes from below with back.out, and GSAP takes the pill’s width to the size of the real word, with elastic.out when it switches on.

The arrow that looks at the pointer

On every pointermove the angle between the arrow’s centre and the pointer comes from atan2; the arrow leans by half the difference from its resting direction, 26 degrees at most, through a back.out quickTo that gives it a small spring. At rest the direction is 45 degrees, while sharing it is north.

Waves shaped like the pill

The waves and the range ring are one pixel outlines with a pill radius: GSAP changes their width and height, not their scale, so the line stays thin while it grows to the edge of the field. One or two leave on click; on stop the ring and a wave come back toward the pill in power3.in.

The friends and the rolling distances

Each friend starts small from the arrow’s disc and flies to its place (a fraction of the field’s width and height, measured again on resize) with back.out, while the disc straightens on an elastic. Each digit of the distance is a column of 0-9 repeated twice that scrolls forward to the right digit, so it always rolls the same way.

The time ring

An SVG circle whose stroke-dasharray equals its circumference: on click it draws in 0.7 seconds, then a linear tween wears it down over RING_SECONDS. On stop it retracts quickly and a slash draws across the arrow with the same trick.

Values to change

NameFileDefaultWhat it changes
LABELscript.jsShare locationThe label of the button at rest.
SHARINGscript.jsSharing for 1 hourThe label while the location is shared.
STOPPEDscript.jsSharing stoppedThe label for a moment after stopping.
FRIENDSscript.jsLea 300, Sam 850, Noor 120The three friends that appear, name and distance in metres, separated by commas.
ACCENTscript.js#6aa8ffThe colour of the arrow, the radar and the time ring.
WAVESscript.js2How many waves leave the pill on click, one or two.
SPRINGscript.js0.8How long the spring that brings in each friend lasts, in seconds.
STAGGERscript.js0.24How many seconds between one friend and the next.
RING_SECONDSscript.js40How many seconds the time ring takes to wear down in the demo (in a real app, an hour).
HOLDscript.js4.4How many seconds the autopilot leaves the sharing on.

Try them in the Playground

When to use it

On the screen of an app for meeting up with friends, in an events or festival app to find your group, in a trip chat, on a restaurant pickup or delivery page where you share your location for an hour: wherever you want to show at once who is nearby.

On phones

The radar field narrows to the screen width and the window height, the friends sit at fixed fractions of the field and the discs shrink to 32 pixels under 360; a finger presses like the mouse. Without hover the arrow stays at its resting tilt and the edge light stays in the middle.

With reduced motion

No springs, growing waves, flights or rolling digits: labels and width change in a moment, the range ring fades in, the friends appear already in place with the right distance and fade out on stop.

Pitfalls

  • Waves made with scale also thickened their one pixel border into a band: they grow by changing width and height, so the line stays thin.
  • A digit going down (850 becoming 820) made the column roll backwards: every column has 0-9 twice and always goes forward; once it has passed the first lap it is moved back to the first one without animation before rolling again.
  • The angle difference between the arrow and the pointer, taken as it is, sometimes went the long way round by 300 degrees: it is brought back between -180 and 180 before halving it.
  • The friends’ places and the range size are in pixels: they are measured again on resize and the tweens read them through function values, even mid-animation.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

Tested on 13 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 components