
The layered button
Buttons, Hover, Physics
The pitch map of Larchwood Camp, a made-up campsite, in a white card from a real product: on a meadow drawn in SVG, with the path, the lake and the wood just hinted, the pitches for tents, camper vans and glamping bell tents, some already taken with hatching and a lock. Hovering a pitch lifts it with its shadow and opens the card with type, size, price per night and the Shade or Lake view tags; on click the green outline draws itself and the tent stands up on a spring, the camper drives in with its wheels turning. Below, the Pitch C4 · 3 nights · $96 bar and the Reserve pitch button that lights up and confirms with a check.
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>
<!--
"Campsite pitch picker" 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>Campsite pitch picker</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 pitch picker of Larchwood Camp, an invented campsite: a small drawn map with tent, camper and glamping
pitches on the meadow, a hover card for each pitch and the booking bar that lights up -->
<section class="picker" aria-labelledby="p-title" data-card>
<header class="picker__head">
<div>
<p class="picker__brand">
<svg class="picker__pine" viewBox="0 0 16 16" aria-hidden="true"><path d="M8 1.5 11.6 6.4H9.9l2.6 3.6h-1.9L13.4 14H2.6l2.8-4H3.5l2.6-3.6H4.4Z"/><path class="picker__trunk" d="M8 14v1.4"/></svg>
<span>Larchwood Camp</span>
</p>
<h2 class="picker__title" id="p-title">Choose your pitch</h2>
</div>
<p class="picker__free"><span data-free>7</span> of <span data-total>10</span> free</p>
</header>
<div class="map" data-map>
<svg class="map__ground" viewBox="0 0 320 200" aria-hidden="true" data-ground>
<defs>
<clipPath id="meadow-clip"><rect width="320" height="200" rx="16"/></clipPath>
<pattern id="hatch" width="4" height="4" patternUnits="userSpaceOnUse" patternTransform="rotate(45)">
<rect width="4" height="4" fill="#f3f4f1"/>
<path d="M0 0V4" stroke="#d5d9d1" stroke-width="1.3"/>
</pattern>
<linearGradient id="lake-fill" x1="0" y1="0" x2="0.4" y2="1">
<stop offset="0" stop-color="#dfeaee"/>
<stop offset="1" stop-color="#eaf1f3"/>
</linearGradient>
<radialGradient id="meadow-light" cx="0.3" cy="0.1" r="1">
<stop offset="0" stop-color="#fbfcf8"/>
<stop offset="1" stop-color="#f1f4ec"/>
</radialGradient>
</defs>
<g clip-path="url(#meadow-clip)">
<rect class="map__meadow" width="320" height="200" fill="url(#meadow-light)"/>
<g class="map__grass" data-grass></g>
<!-- the lake, just hinted, in the top right corner -->
<path class="map__lake" fill="url(#lake-fill)" d="M246 -4C240 18 252 34 270 44c16 9 22 24 38 30 6 2 10 2 16 1V-4Z"/>
<path class="map__shore" d="M246 -4C240 18 252 34 270 44c16 9 22 24 38 30 6 2 10 2 16 1"/>
<g class="map__ripples" data-ripples>
<path d="M276 14q6-2.4 12 0"/>
<path d="M292 30q5-2 10 0"/>
<path d="M268 26q4-1.6 8 0"/>
</g>
<text class="map__label" x="300" y="56" text-anchor="end">Lake</text>
<!-- the path through the camp -->
<path class="map__path" d="M150 206C146 176 168 160 166 136 164 110 132 102 134 76 136 52 168 40 176 -6"/>
<path class="map__path-line" d="M150 206C146 176 168 160 166 136 164 110 132 102 134 76 136 52 168 40 176 -6" data-path/>
<!-- the wood on the left, just hinted -->
<g class="map__wood" data-wood>
<circle cx="14" cy="170" r="16"/><circle cx="36" cy="188" r="15"/><circle cx="6" cy="140" r="11"/>
<circle cx="60" cy="196" r="12"/><circle cx="30" cy="154" r="9"/><circle cx="-2" cy="196" r="12"/>
<circle cx="10" cy="20" r="12"/><circle cx="-4" cy="40" r="10"/><circle cx="26" cy="4" r="10"/>
</g>
<text class="map__label" x="16" y="128">Pine wood</text>
<!-- the reception, a small square at the entrance of the path -->
<g class="map__office">
<rect x="174" y="180" width="18" height="12" rx="2.5"/>
<path d="M172 181l11-6 11 6"/>
</g>
<text class="map__label" x="198" y="190">Office</text>
</g>
<rect class="map__edge" x="0.5" y="0.5" width="319" height="199" rx="15.5"/>
</svg>
<div class="map__pitches" role="radiogroup" aria-label="Pitches on the map" data-pitches></div>
<div class="tip" role="tooltip" id="pitch-tip" data-tip>
<div class="tip__card" data-tip-card>
<div class="tip__top">
<strong data-tip-id>Pitch C4</strong>
<span class="tip__type" data-tip-type>Tent</span>
</div>
<div class="tip__row" data-tip-row>
<span data-tip-size>7 × 8 m</span>
<span class="tip__price"><b data-tip-price>$32</b> / night</span>
</div>
<div class="tip__tags" data-tip-tags></div>
<span class="tip__nub" aria-hidden="true"></span>
</div>
</div>
</div>
<footer class="bar">
<div class="bar__text">
<p class="bar__main" data-main><span data-main-text>No pitch selected</span></p>
<p class="bar__sub" data-sub>Fri 14 – Mon 17 Aug</p>
</div>
<button class="reserve" type="button" aria-disabled="true" data-reserve data-autoclic>
<span class="reserve__face" data-reserve-face>
<span class="reserve__sheen" aria-hidden="true" data-sheen></span>
<span class="reserve__label" data-label-idle>
<span>Reserve pitch</span>
<svg class="reserve__arrow" viewBox="0 0 16 16" aria-hidden="true"><path d="M3.5 8h8.6M8.6 4.4 12.2 8l-3.6 3.6"/></svg>
</span>
<span class="reserve__label reserve__label--wait" data-label-wait aria-hidden="true">
<svg class="reserve__spin" viewBox="0 0 16 16" data-spin><path d="M8 2.2a5.8 5.8 0 1 1-5.8 5.8"/></svg>
<span>Holding</span>
</span>
<span class="reserve__label reserve__label--done" data-label-done aria-hidden="true">
<svg class="reserve__check" viewBox="0 0 16 16"><path d="M3.4 8.4 6.6 11.4 12.6 4.6" data-check/></svg>
<span>Reserved</span>
</span>
</span>
</button>
</footer>
<p class="sr" aria-live="polite" data-live></p>
</section>
</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.
39 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 “Campsite pitch picker” from Animorio and fit it into my siteThe meadow, the path, the lake and the wood are a single background SVG, 320 by 200; the pitches are real buttons laid on top in percentages, each with its own small SVG inside. So they get focus, the radio role, the preview’s click, and they resize with the map with no maths.
Each pitch has two layers: the shadow on the grass, blurred once in CSS and moved by GSAP only in opacity and scale, and the group that rises by LIFT pixels with a back.out and comes back with an elastic.out. The card above has a wrapper for the position, sliding from one pitch to the next, and a child for the entrance with the scale.
The outline is a rect or a circle with pathLength 1 and the dashoffset going from 1 to 0. The tent squashes in 0.12 seconds and stands up with elastic.out(1, SPRING) from an origin on its pegs; the camper drives in with a fromTo on x and the wheels turn on an svgOrigin taken from the drawing; the bell tent grows from its base.
The group has a single Tab stop; the arrows look for the nearest free pitch in that direction with a score, the distance along the arrow plus 2.2 times the distance across, and Enter or Space choose it. Keyboard focus opens the same card as hover.
| Name | File | Default | What it changes |
|---|---|---|---|
NIGHTS | script.js | 3 | The nights of the stay, for the total in the bar. |
PRICE_TENT | script.js | 32 | The price per night of a tent pitch. |
PRICE_CAMPER | script.js | 48 | The price per night of a camper van pitch. |
PRICE_GLAMP | script.js | 85 | The price per night of a glamping bell tent. |
LIFT | script.js | 3 | How many pixels the pitch lifts under the pointer. |
HOVER_SCALE | script.js | 1.06 | How much the pitch grows under the pointer. |
SPRING | script.js | 0.42 | The spring of the tent setting up: lower bounces more. |
SPEED | script.js | 1 | The speed of every movement. |
--accent | style.css | #2f6b45 | The forest green of the chosen pitch, the outline and the button. |
--accent-soft | style.css | #e6f0e8 | The fill of the chosen pitch. |
--meadow | style.css | #f1f4ec | The meadow of the map. |
In the booking of a campsite, a glamping site, a camper stop or a holiday village, after the dates and before the payment: the guest sees where the lake is, which pitches are free and what they cost, and picks one. The same map works for the tables of an outdoor restaurant or the umbrellas of a beach club.
The card narrows to the screen edge minus 24 pixels and the map scales with it; the height of the box keeps it inside too. Touch does what the mouse does: the pitch squashes under the finger, gets chosen and opens its card, which goes away when you touch outside the pitches.
No lifting, springs or shakes: the card fades in, the chosen pitch’s outline is there at once, the tent only changes colour, the pitch card fades and the button fades to Reserved.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 12 KB; the libraries: GSAP 28 KB.
Tested on 19 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.