Skip to content
animorio
IT
All components

Rent it button

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

The rent button in a shop that also rents out its gear: an orange pill with the return arrow that turns on itself. Pressed, the arrow makes one turn for each day, the tag counts the days and the line below adds up the price; at the end the arrow closes into a tick and the label says until when it is yours.

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>
<!--
  "Rent it 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>Rent it button with the arrow that goes round and the days that count</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 rent button of a shop that also rents its gear: pressed, the return arrow makes one turn for each day,
         the tag counts the days and the line below adds up the price; then the arrow closes into a tick and the
         label says until when it is yours -->
    <button class="rent" type="button" data-rent>
      <span class="rent__body" aria-hidden="true"><span class="rent__sheen" data-sheen></span><span class="rent__light"></span></span>
      <span class="rent__edge" aria-hidden="true"></span>

      <span class="seat" data-seat aria-hidden="true">
        <svg viewBox="0 0 24 24">
          <g data-loop><path d="M18.6 8.2A7.6 7.6 0 1 0 19.6 12"></path><path d="M19.4 3.8v4.6h-4.6"></path></g>
          <path class="seat__tick" data-tick pathLength="1" d="M7.6 12.4 10.6 15.3 16.4 9"></path>
        </svg>
      </span>

      <span class="label">
        <span class="label__main"><span data-word>Rent it</span></span>
        <span class="label__sub"><span data-sub>From €12 a day</span></span>
      </span>
      <span class="tag" data-tag aria-hidden="true"><span data-days>1 day</span></span>
    </button>
    <p class="sr" data-live aria-live="polite"></p>

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

14 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 “Rent it 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

In the centre, on black, an orange pill 60 pixels tall with a warm glow and an edge that catches the light: on the left, in a white seat, an arrow that goes almost all the way round (the return sign), then two lines (“Rent it” and below “From €12 a day”) and on the right a tag with “1 day”. Pressed, the label rolls to “Renting” and the arrow makes three turns, one per day: at each turn the tag bounces and goes to 2 and then 3 days, and the line below adds up (“€24 for 2 days”, “€36 for 3 days”). Then the arrow closes, the seat turns dark and a white tick draws itself in it, the tag turns white, a sheen crosses the pill and the label says “Yours till Sunday”, with “€36, free return” below. After a couple of seconds it goes back.

How it works

One turn per day

A timeline with one cycle for each day: the arrow rotates 360 degrees in TURN seconds with power2.inOut around the centre of the drawing (svgOrigin 12 12), and halfway through the turn the tag and the line below roll to the new number. Changing DAYS the timeline lengthens by itself.

The count

The days text and the price text come from the same number (days times RATE), so they cannot disagree; the plural (“day”, “days”) and the price’s decimals are decided by one function.

The close

The arrow scales to zero, the tick draws itself with stroke-dashoffset, seat and pill make a small elastic bounce and a slanted sheen crosses the pill: the slant (skewX) is given to GSAP together with the movement.

Values to change

NameFileDefaultWhat it changes
DAYSscript.js3For how many days it is rented.
RATEscript.js12The price of one day.
CURRENCYscript.js€The currency symbol.
UNTILscript.jsSundayThe day it must be returned.
TURNscript.js0.55How many seconds one turn of the arrow lasts, one per day.
ACCENTscript.js#ff6a2bThe pill’s colour.
HOLDscript.js2.6On its own: how many seconds the summary stays before going back.
LOOPscript.jstrueLeft alone, a pointer tries it by itself.

Try them in the Playground

When to use it

For a shop that rents as well as sells: mountain gear, cameras and lenses, formal wear, tools, bikes, board games. It sits next to the “Add to cart” button on the product page. In a real product the days come from the calendar chosen earlier.

On phones

The same button: the pill takes at most the screen width minus the margins; it is pressed with a finger and there is no light under the pointer.

With reduced motion

No turns, bounces or sheen: days, price and labels change in place, the tick appears without drawing itself.

Pitfalls

  • The arrow’s rotation is relative (“+=360”): at the end it is worth 1080 degrees, and on the way back it must be set to 0 while invisible, otherwise the next round starts from there.
  • The sheen is slanted: the slant must be given to GSAP (skewX) together with xPercent, because its inline transform replaces the one written in the CSS.
  • While renting the button takes no other press (aria-busy), and a line for screen readers says days, total and return day.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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