Skip to content
animorio
IT
All components

Extend trial button

Buttons, Hover, SVGGSAP, CSS onlyEasyCompressed weight: Demo 4.6 KBGSAP 28 KBFreeDownload the zip

The button that extends a free trial about to run out: on the left an orange ring with the days left, on the right the chip “+7”. Press it and the chip jumps into the ring, which bounces and fills again while the number counts from 3 to 10 and the orange turns green; the label rolls into “Trial extended”, the end date changes and a tick draws itself.

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>
<!--
  "Extend trial 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>Extend trial button</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 button that adds days to a free trial about to end: the chip flies into the ring, the ring fills
         again, the days count up and the end date rolls to the new one, amber turning green -->
    <button class="et" type="button" data-et>
      <span class="et__ring" data-ringbox aria-hidden="true">
        <svg viewBox="0 0 48 48"><circle class="et__track" cx="24" cy="24" r="21"></circle><circle class="et__arc" data-arc pathLength="1" cx="24" cy="24" r="21" transform="rotate(-90 24 24)"></circle></svg>
        <b data-days></b>
      </span>
      <span class="et__text">
        <span class="et__label"><span data-label>Extend trial</span></span>
        <span class="et__sub"><span data-sub></span></span>
      </span>
      <span class="et__side" aria-hidden="true">
        <span class="et__chip" data-chip></span>
        <svg class="et__tick" viewBox="0 0 18 18"><path data-tick pathLength="1" d="M4 9.500l3.300 3.300L14 5.800"></path></svg>
      </span>
    </button>
    <span class="et__say" data-say aria-live="polite"></span>

    <svg class="ghost" data-ghost viewBox="0 0 24 24" aria-hidden="true"><path d="M5 3.200 19.200 11l-6.300 1.600-3.300 5.900Z"></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.

12 values to change

Works with Claude, Claude Code, ChatGPT, Cursor, VS Code, Windsurf, Codex, Gemini CLI

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 “Extend trial 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 white, a pale pill with an orange shadow beneath. On the left a white disc with an orange ring one fifth full and the number 3 in the middle; beside it “Extend trial” and under it “3 days left, ends Nov 25”; on the right a black chip, “+7”. On opening the ring fills up to the three days. On press the pill gives, the chip hops and crosses the button to the ring, shrinking into it; the ring bounces and fills to ten fourteenths while the number counts 4, 5, 6 up to 10 and the orange of ring and shadow turns green. Meanwhile “Extend trial” rolls away for “Trial extended” and the line below for “10 days left, ends Dec 2”; where the chip was, a green tick draws itself. A second tap only makes the button shake slightly: the trial has already been extended.

How it works

One number

The days are a number: the arc (stroke-dashoffset on a circle with pathLength 1), the figure in the middle and the colour all read it from the same function.

From orange to green

gsap.utils.interpolate prepares the passage between the two colours; at each step the right colour goes into a CSS variable used by the ring and the shadow.

The flying chip

The distance between the chip and the ring’s centre is measured at that moment; the x runs on a curve and the y makes a hop, so the flight is an arc.

The dates

The end date is worked out by adding the days to a fixed day and written with toLocaleDateString: change DAYS_LEFT or EXTRA and the dates change too.

Values to change

NameFileDefaultWhat it changes
ACCENTscript.js#1fa971The colour of the ring and the tick once the trial has been extended.
DAYS_LEFTscript.js3How many trial days are left before pressing.
EXTRAscript.js7How many days the button adds.
FILL_TIMEscript.js0.9How many seconds the ring takes to fill while the days count.
SPRINGscript.js1How much the ring bounces when it receives the days: 0.3 = a little, 2 = a lot.
LOOPscript.jstrueLeft alone, the demo’s pointer extends the trial and then everything goes back.

Try them in the Playground

When to use it

In the notice of a free trial about to end, on the plan page of a subscription service or in an in-app message: wherever extra days are given once only.

On phones

The same button, 296 by 66 pixels at most: on a narrow screen the pill shortens and the chip’s flight is measured again; the two lines never wrap.

With reduced motion

No flight, bounce or counting: on tap the ring, the number, the two lines and the tick show the extended trial at once. The demo does not move by itself.

Pitfalls

  • Days and dates are made up and start from a fixed day written in the script: on a real site they come from the server, which also decides whether the trial can be extended.
  • The state is not in the colour alone: the number, the two lines and the tick say it too, and an aria-live region reads the result.
  • The button does not switch off after use: a second tap says the trial has already been extended, instead of not answering.
  • The number in the middle counts in whole days by rounding the animated value: with a variable-width font the step from one to two digits must be centred by the container, not the text.
  • If the days exceed the trial’s length the ring stays full: the measure of the whole ring is a constant to adapt.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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