Skip to content
animorio
IT
All components

Sign petition button

Buttons, HoverGSAP, CSS onlyMediumCompressed weight: Demo 5.5 KBGSAP 28 KBFreeDownload the zip

The “Sign the petition” button of a campaign: on tap a pen signature writes itself inside the pill, which turns blue with “Signed, thank you” and its tick. Above it, the count of signatures goes up by one with only the changing digit rolling, the bar moves towards the goal with a light at its head and your avatar makes room for itself in front of the latest signers.

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>
<!--
  "Sign petition 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>Sign petition 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 Sign the petition button of a campaign: the pen signs inside the pill, the count of
         signatures goes up by one, the bar moves towards the goal and you join the last signers -->
    <i class="frame" data-frame aria-hidden="true"></i>
    <section class="pt" data-pt data-state="idle" aria-label="Petition">
      <p class="pt__count"><strong class="pt__digits" data-digits aria-hidden="true"></strong><span class="pt__of">signed of <b data-outgoal>15,000</b></span></p>
      <span class="pt__track" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0" aria-label="Signatures towards the goal" data-track><i data-bar></i><i class="pt__spark" data-spark></i></span>
      <div class="pt__people">
        <span class="pt__faces" data-faces><i class="pt__you" data-you>You</i><i style="--c:#f2b84b">IR</i><i style="--c:#7cc6a4">MT</i><i style="--c:#e58a7b">LO</i></span>
        <span class="pt__names"><span data-outnames>Ines, Mateo and Lore just signed</span></span>
      </div>
      <button class="pt__btn" type="button" data-sign aria-pressed="false">
        <span class="pt__face pt__face--ask"><svg viewBox="0 0 20 20" aria-hidden="true"><path d="M13.200 3.300a1.900 1.900 0 0 1 2.700 0l.800.800a1.900 1.900 0 0 1 0 2.700L8 15.500l-4.200 1 .900-4.300Z"></path><path d="m11.700 4.800 3.500 3.500"></path></svg><span>Sign the petition</span></span>
        <svg class="pt__ink" viewBox="0 0 280 52" aria-hidden="true"><path data-ink pathLength="1" d="M64 31c9-17 16-19 15-8-1 10-8 15-5 6 5-11 14-15 16-7 1 6-3 10 3 4 7-7 10-11 14-5 2 4 1 8 7 3 6-5 10-8 15-3 3 3 7 4 14 1 12-5 32-7 73-6"></path></svg>
        <span class="pt__face pt__face--done"><svg viewBox="0 0 20 20" aria-hidden="true"><path data-tick pathLength="1" d="m4.800 10.400 3.400 3.400 7-7.800"></path></svg><span>Signed, thank you</span></span>
      </button>
    </section>
    <span class="live" aria-live="polite" data-live></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.

21 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 “Sign petition 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: the big number of signatures, “12,847”, with “signed of 15,000” next to it; below, a blue bar showing how far the goal is, then three avatars with initials and “Ines, Mateo and Lore just signed”, and the dark pill “Sign the petition” with a pen. On tap the pill squeezes and comes back on a spring, the words lift away and a white signature writes itself from left to right inside the button; once it is done the pill turns blue, the ink fades and “Signed, thank you” arrives with its tick drawing itself. At the same moment the count becomes 12,848: only the last digit rolls, the others stay put; the bar moves on with a small bounce and a light runs to its head; at the front of the row a blue “You” circle makes room for itself before the other avatars and the line becomes “You, Ines and Mateo just signed”. One more tap withdraws the signature and everything goes back.

How it works

The signature in the pill

Inside the button there is a signature-shaped path, drawn by taking stroke-dashoffset from one to zero. A single timeline sends the words out, writes the signature, changes the colour and brings in the answer with its tick.

One column per digit

The count is written one digit per column. On every change old and new digits are compared, and only the columns that change roll: from 12,847 to 12,848 a single digit moves.

The bar and the avatar

The bar is the share of the goal reached, on a spring and with a light running to its head. Your avatar starts zero wide and widens at the front of the row, pushing the others.

Values to change

NameFileDefaultWhat it changes
ACCENTscript.js#4d5dfbThe colour of the bar, your avatar and the signed button.
SIGNEDscript.js12847How many signatures there are before yours.
GOALscript.js15000The signature goal.
SPRINGscript.js1How much the button, the bar and the avatar bounce.

Try them in the Playground

When to use it

On the page of a petition, a campaign or a nonprofit’s appeal; with other words it carries a waitlist (“Join the waitlist”), a public pledge, an event sign-up or a vote: anywhere a single gesture adds one person to a count everyone can see.

On phones

The block is at most 280 pixels wide and about 190 tall; the big number is sized on height too, so it fits a short window. The pill is 52 pixels tall and as wide as the block: it is thumb-sized and nothing depends on hover.

With reduced motion

No signature writing itself: the button goes straight to “Signed, thank you” with its tick already drawn, the digit changes without rolling, the bar takes its length at once and the avatar is already in place. The demo’s pointer does not start.

Pitfalls

  • The button is a real toggle (aria-pressed): a second tap withdraws the signature, and the state is read out in an aria-live region with the updated count.
  • The visible count is hidden from screen readers, which hear the whole sentence instead: one digit per column would be read letter by letter.
  • The signature is a drawing, not the signature of whoever taps: in a real product name and email come first, and the count comes from the server.
  • Names, numbers and goal are invented.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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