Skip to content
animorio
IT
All components

Campsite pitch picker

Pickers, Hover, PhysicsGSAP, CSS onlyMediumCompressed weight: Demo 12 KBGSAP 28 KBFreeDownload the zip

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.

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

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.

39 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 “Campsite pitch picker” 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 white ground there is a single white card with wide corners, its one pixel edge catching the light at the top and a soft layered shadow with a thread of green. At the top Larchwood Camp in small letters with its pine, the title Choose your pitch and, on the right, how many pitches are free. Below, the campsite map drawn in SVG: a very pale green meadow with a few blades of grass, the dirt path with its dashed line, the lake just hinted in the corner with three ripples moving slowly, the pine wood in circles on the side and the office at the entrance. On the meadow ten pitches: three round glamping bell tents by the lake, three long camper van pitches along the path and four square tent pitches, each with its drawing and its name; the ones already taken are hatched in grey, with a dashed edge and a small lock. Hovering a pitch lifts it by three pixels with a bounce, a soft shadow appears under it on the grass and above it the card opens with the name, the type, the size, the price per night and the Shade, Lake view, Hook-up or Deck tags with their icons; moving to the next pitch, the card slides after the pointer. On click the green outline draws itself around the pitch, the fill turns pale green, the tent folds and stands up again on a spring from its pegs, the camper drives in from the left with its wheels turning and settles on its suspension, the bell tent rises from its deck; the pitch rocks by two degrees. Below, the bar goes from No pitch selected to Pitch C4 · 3 nights · $96 with the total counting up, and the Reserve pitch button lights up green with a sheen running across it and a small elastic. Pressed, it squashes, becomes Holding with the turning arc and then Reserved with the check drawing itself, and the bar says Pitch C4 is yours. A booked pitch, clicked, shakes its head; the button pressed with nothing chosen says no and the free pitches hop once to show themselves.

How it works

One map, ten buttons

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

Lifting without breaking the drawing

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 tent setting up

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.

Arrows on the map

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.

Values to change

NameFileDefaultWhat it changes
NIGHTSscript.js3The nights of the stay, for the total in the bar.
PRICE_TENTscript.js32The price per night of a tent pitch.
PRICE_CAMPERscript.js48The price per night of a camper van pitch.
PRICE_GLAMPscript.js85The price per night of a glamping bell tent.
LIFTscript.js3How many pixels the pitch lifts under the pointer.
HOVER_SCALEscript.js1.06How much the pitch grows under the pointer.
SPRINGscript.js0.42The spring of the tent setting up: lower bounces more.
SPEEDscript.js1The speed of every movement.
--accentstyle.css#2f6b45The forest green of the chosen pitch, the outline and the button.
--accent-softstyle.css#e6f0e8The fill of the chosen pitch.
--meadowstyle.css#f1f4ecThe meadow of the map.

Try them in the Playground

When to use it

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.

On phones

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.

With reduced motion

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.

Pitfalls

  • The outline with pathLength 1, a 1 1 dash and round caps at rest left a green dot on top of every round tent: a zero length dash with a round cap shows. The outline stays at zero opacity until it draws.
  • The pitches were SVG groups, but an SVG element has no click(): the preview’s pilot could not choose them. They became HTML buttons laid over the map in percentages.
  • The pilot’s click arrives without hovering: to show the hover in the video, an untrusted click on the marked pitch first lifts it and opens the card, then chooses it and leaves after a moment.
  • The card jumped from one pitch to the next; GSAP moves its wrapper, while the entrance with the scale is on the child, so the two movements do not cancel each other.

Libraries

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.

Testing

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