Skip to content
animorio
IT
All components

Follow button

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

A profile’s Follow button, with one gesture: pressed, it squeezes, the label rolls to Following, the button turns from black to light with a border and widens on a short spring, the follower count rolls by one and a row of mutual followers slides in below. Hover it again and it says Unfollow, in soft red.

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>
<!--
  "Follow 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>The follow button that turns into following</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">
    <!-- one gesture: press. A small profile card and a black Follow button: pressed, it squeezes, the label rolls to
         Following, the button turns light with a border and grows on a short spring, the follower count rolls by one
         and a row of mutual followers slides in. Hovering Following offers Unfollow -->
    <section class="card" data-card aria-label="Profile of Juno Hale">
      <div class="card__top">
        <span class="avatar" aria-hidden="true"><span class="avatar__glow"></span><span class="avatar__letters">JH</span></span>
        <div class="who">
          <span class="who__name">Juno Hale</span>
          <span class="who__handle">@junohale · Type designer, Lisbon</span>
        </div>
      </div>

      <div class="card__row">
        <p class="count"><span class="count__num" data-count aria-live="polite">2,481</span> <span class="count__lab">followers</span></p>

        <button class="follow" type="button" data-follow aria-pressed="false">
          <span class="follow__ring" data-ring aria-hidden="true"></span>
          <span class="follow__fill" data-fill></span>
          <span class="follow__inner" data-inner>
            <svg class="follow__icon" data-icon viewBox="0 0 24 24" aria-hidden="true">
              <path class="i-plus" d="M12 5.5v13M5.5 12h13"></path>
              <path class="i-check" d="M5.5 12.4l4.2 4.1 8.8-9"></path>
            </svg>
            <span class="follow__labels">
              <span class="follow__col" data-labels>
                <span class="lab" data-lab="follow">Follow</span>
                <span class="lab" data-lab="following">Following</span>
                <span class="lab" data-lab="unfollow">Unfollow</span>
              </span>
            </span>
          </span>
        </button>
      </div>

      <div class="mutual" data-mutual aria-hidden="true">
        <span class="faces">
          <span class="face" style="--a:#f4c7a1;--b:#e48f6a">A</span>
          <span class="face" style="--a:#b9d3f7;--b:#6f98d8">T</span>
          <span class="face" style="--a:#cfe6c7;--b:#7fb06f">R</span>
        </span>
        <span class="mutual__text">Followed by <b>Ana</b>, <b>Theo</b> and 12 others</span>
      </div>
    </section>

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

38 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 “Follow 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 a very light grey background sits the white card of a made-up profile, Juno Hale, a type designer in Lisbon: a round avatar with a soft gradient and initials, the name, the handle, the follower count in tabular figures and a black pill button with a plus and the word Follow. On hover the button lifts by a pixel; pressed, it squeezes and comes back on an elastic spring. The label rolls up to Following, the plus turns and vanishes while a violet check draws itself, the fill goes from black to white with a thin border, and the button widens just enough for the new word on a short spring. A violet ring spreads and fades once. Meanwhile the follower count rolls from 2,481 to 2,482, only the figures that change, and below opens a row with three small overlapping avatars coming in one after another: Followed by Ana, Theo and 12 others. Leave and hover the button again and Following turns into Unfollow in soft red, with the plus turned into a cross; pressed, it goes back to Follow, the number drops and the row closes. A drawn pointer shows the whole loop on its own.

How it works

Three labels in one column

Follow, Following and Unfollow sit one under the other in a window one line tall; GSAP moves the column by 20 pixels per state with back.out, so the new word arrives from below with a settle.

The width follows the word

The script measures each state’s word (scrollWidth) plus icon and padding, and takes the button’s width there with back.out(1.7): the pill widens or narrows with a short bounce, never in a jump.

Rolling figures

Each figure of the number is a column from 0 to 9 inside a one-figure window; when the number changes only the columns of the figures that differ move, 40 ms apart.

Three looks

Solid black, white with a border, soft red: fill and shadow live in a small object per state and GSAP carries them onto the button’s fill; the label changes colour with them.

Unfollow only later

Right after the click the button shows Following even with the pointer on it: Unfollow appears only after leaving and coming back, so a fresh follow is never undone by mistake.

Values to change

NameFileDefaultWhat it changes
FOLLOWERSscript.js2481How many followers the profile has before the click.
SQUEEZEscript.js0.93How much the button squeezes when pressed (1 = not at all).
SPRINGscript.js0.55How long the width spring lasts, in seconds.
SHOW_MUTUALscript.js11 shows the row of mutual followers after the click, 0 does not.
ACCENTscript.js#6d5efcThe colour of the check, the ring and the focus.
LABELscript.jsFollowThe button’s label at rest.

Try them in the Playground

When to use it

For the profile of a person, a creator, a brand or a channel: in a social network, a community, an author’s page on a blog or a portfolio, an app with accounts to follow.

On phones

The same card at the same size, narrowed to the box: a finger presses like the mouse, and since a phone has no hover, Following stays Following and a second tap unfollows.

With reduced motion

No squeezes, jumps or rings: labels and colours change with a fade, the number changes at once and the row of mutual followers appears without moving.

Pitfalls

  • Measure the width on the real word (scrollWidth) rather than writing it by hand: with another typeface or language Following is longer and would be cut.
  • GSAP writes its transform inline: scale and lift sit on the button, the label column and the fill are children, so they never wipe each other out.
  • After the click do not show Unfollow while the pointer is still on it: it would look like the button asks to undo.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

Tested on 25 October 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