
The star rating
Ratings, SVG, Hover
The «Get directions» button on the site of an invented car dealership, Morrow & Vale: a graphite pill on white with the turn sign in a dark disc and the drive minutes on the right. Pressed, the label lifts away and a small street plan lights up inside the pill: the route draws itself in blue from the turn sign to the showroom, the navigation arrow at its tip turning at every corner, while the odometer of the minutes rolls from 18 to 14 and the miles count up. At the end the showroom pin drops and squashes, and a glint runs along the route and across the pill.
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>
<!--
"Get directions 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 Get directions button with the route that draws itself and the drive time that rolls</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 Get directions button of a car dealership's site, a graphite pill on white. On hover a soft light follows
the pointer and the turn sign leans its arrow. Pressed, the words lift away and a little street plan lights up
inside the pill: the route draws itself from the turn sign to the showroom, a small navigation arrow riding its
tip, while the drive time rolls on the odometer from the usual estimate to the live one and the miles count up.
At the end the showroom pin drops and squashes, a glint runs along the route and the chip says the time.
Pressed again, the route rolls back up and the words return -->
<div class="gd" data-wrap>
<span class="gd__spill" data-spill aria-hidden="true"></span>
<button class="gd__btn" type="button" data-btn aria-label="Get directions to the Morrow and Vale showroom">
<span class="gd__body" data-body>
<span class="gd__fill" aria-hidden="true"></span>
<span class="gd__glow" aria-hidden="true"><span class="gd__glow-light" data-glow></span></span>
<span class="gd__shine" data-shine aria-hidden="true"></span>
<span class="gd__sweep" aria-hidden="true"><span class="gd__sweep-band" data-sweep></span></span>
<span class="gd__edge" aria-hidden="true"></span>
<span class="gd__row">
<span class="gd__disc" data-disc aria-hidden="true">
<span class="gd__plate" data-plate></span>
<svg class="gd__sign" data-sign viewBox="0 0 24 24">
<path class="gd__sign-shape" d="M12 2.6 21.4 12 12 21.4 2.6 12Z"/>
<g data-turn>
<path class="gd__sign-arrow" d="M9.4 15.6v-3.1c0-.9.7-1.6 1.6-1.6h4.2"/>
<path class="gd__sign-arrow" d="M13.4 8.9l2 2-2 2"/>
</g>
</svg>
<svg class="gd__nav" data-nav viewBox="0 0 24 24">
<path d="M12 3.4 18.8 19.4 12 15.8 5.2 19.4Z"/>
</svg>
</span>
<span class="gd__mid" data-mid>
<span class="gd__text" data-text aria-hidden="true">
<span class="gd__title" data-title>Get directions</span>
<span class="gd__sub" data-sub>Morrow & Vale showroom</span>
</span>
<svg class="gd__map" data-map aria-hidden="true">
<g class="gd__streets" data-streets></g>
<path class="gd__route-under" data-under/>
<path class="gd__route-glow" data-route-glow/>
<path class="gd__route" data-route/>
<path class="gd__route-shine" data-route-shine/>
<path class="gd__start" data-start/>
<g class="gd__car" data-car><path d="M0 -4.6 3.6 3.8 0 2 -3.6 3.8Z"/></g>
<g data-pin-pos>
<ellipse class="gd__pin-shadow" data-pin-shadow cx="0" cy="0" rx="4" ry="1.3"/>
<g class="gd__pin" data-pin>
<path class="gd__pin-body" d="M0 0C-1.2-3.4-6.2-7.2-6.2-11.4a6.2 6.2 0 0 1 12.4 0C6.2-7.2 1.2-3.4 0 0Z"/>
<path class="gd__pin-mark" d="M-3.1-10.9 0-13.6 3.1-10.9V-8.6H-3.1Z"/>
</g>
</g>
</svg>
</span>
<span class="gd__chip" aria-hidden="true">
<span class="gd__eta">
<span class="gd__col" data-col></span><span class="gd__col" data-col></span>
<span class="gd__unit">min</span>
</span>
<span class="gd__chip-sub">
<span class="gd__chip-face" data-face>Drive</span>
<span class="gd__chip-face" data-face><span data-dist>0.0</span> mi</span>
</span>
</span>
</span>
</span>
</button>
</div>
<p class="sr" aria-live="polite" data-live></p>
</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.
24 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 “Get directions button” from Animorio and fit it into my siteThe street plan is an svg whose viewBox is as big as the middle of the pill, measured with clientWidth: three horizontal streets at 30, 50 and 70 percent of the height, cross streets every eighth of the width, a diagonal avenue, blocks as faint rectangles skipping some cells and a green cell for the park. A ResizeObserver rebuilds it when the pill changes width, even halfway through the drawing, because the route's progress is a number from 0 to 1 and not a length.
The route's points zig zag between the middle street and the two side ones (CORNERS corners); at each corner the line stops 5 pixels short and goes on with a quadratic curve that has the corner as its control point. The same d goes to four paths: the dark shadow underneath, the blurred glow, the blue line and the glint; the first three draw with a strokeDasharray equal to the length and a falling strokeDashoffset.
Every frame getPointAtLength gives the point at the tip and the one a pixel and a half before it: their direction through atan2 is the rotation of the white arrow, which so turns by itself at every junction. The same update writes the miles, DISTANCE times the route's progress.
Each digit is a strip of sixty numbers (0 to 9 six times) inside a window 1.1 em tall faded at the top and bottom with a mask. To reach 14 the wheel always moves forward to the right digit plus TURNS turns, the units one turn more than the tens and 0.12 seconds slower; a light back.out passes the mark by a breath and returns, then the strip jumps back to its 0 to 9 position without showing.
The arrow shrinks into the end point while the pin drops on power3.in already a little stretched; on touching down it squashes (scaleX 1.22, scaleY 0.78) from its bottom origin and straightens on an elastic.out, its shadow widening with it. Then a 16 pixel white stroke runs along the route with strokeDashoffset and a band of light in screen blend crosses the graphite.
| Name | File | Default | What it changes |
|---|---|---|---|
DEALER | script.js | 'Morrow & Vale' | The dealership's name, in the small line under the label. |
USUAL | script.js | 18 | The usual drive minutes, shown at rest (10 to 99). |
ETA | script.js | 14 | The minutes with live traffic, where the odometer stops (10 to 99). |
DISTANCE | script.js | 6.2 | The miles of the route, counted while it draws. |
DRAW | script.js | 1.9 | The seconds the route takes to draw itself. |
TURNS | script.js | 1 | The extra turns of the odometer wheels while the route draws. |
CORNERS | script.js | 3 | How many streets the route turns into before the showroom. |
SPRING | script.js | 1 | How springy the moves are: 0.4 calm, 2 very bouncy. |
HOLD | script.js | 2.4 | The seconds the found route stays before going back. |
AUTO | script.js | true | Whether it goes round by itself until someone touches it. |
On the contact page or in the footer of the landing page of a car dealership, a showroom, a garage or a car rental: the button that leads to the directions. It also suits a restaurant, a hotel, a shop or an event with an address, anywhere a «how to get here» with the drive time is needed.
The same animation with adapted sizes: the pill is 88% of the screen wide up to 328 pixels and stays 60 tall, easy for a finger; the street plan rebuilds itself on the real width, so the route always has the same corners. Under 360 pixels the label tightens a little with the wdth axis. A tap does what a click does and the light follows the finger while it rests on the pill.
Nothing moves: the label and the sign fade away, the navigation arrow fades in, the plan appears with the route already drawn and the pin already in place, the minute digits change with a fade instead of rolling, no running arrow and no glints. The way back is the same fade in reverse.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 10 KB; the libraries: GSAP 28 KB.
Tested on 9 November 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.