Skip to content
animorio
IT
All components

Repost button

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

A post’s Repost button, with a single gesture: pressed, it squeezes, the two arrows of the loop chase each other half a turn and settle, a soft green spreads from the icon, the label leaves and Reposted comes in, six short strokes flick once around the icon and the repost count rolls by one. Hover it again and it says Undo, 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>
<!--
  "Repost 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 repost button with arrows that chase each other</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 Repost pill with the loop of two arrows and the count beside it: pressed, it squeezes,
         the two arrows chase each other half a turn round the loop and lock, a green tint spreads from the icon, the
         label leaves and Reposted comes in, and the count rolls by one. Coming back over it offers Undo -->
    <button class="repost" type="button" data-repost aria-pressed="false" aria-label="Repost">
      <span class="repost__tint" data-tint aria-hidden="true"></span>
      <span class="repost__inner">
        <span class="repost__icon" aria-hidden="true">
          <svg class="burst" data-burst viewBox="-30 -30 60 60">
            <line x1="0" y1="-15" x2="0" y2="-21"></line>
            <line x1="13" y1="-7.5" x2="18.2" y2="-10.5"></line>
            <line x1="13" y1="7.5" x2="18.2" y2="10.5"></line>
            <line x1="0" y1="15" x2="0" y2="21"></line>
            <line x1="-13" y1="7.5" x2="-18.2" y2="10.5"></line>
            <line x1="-13" y1="-7.5" x2="-18.2" y2="-10.5"></line>
          </svg>
          <svg class="loop loop--trail" data-trail viewBox="0 0 24 24">
            <path d="M5 11V9.5A3.5 3.5 0 0 1 8.5 6H18"></path>
            <path d="M19 13v1.5a3.5 3.5 0 0 1-3.5 3.5H6"></path>
          </svg>
          <svg class="loop" data-loop viewBox="0 0 24 24">
            <g class="arrow arrow--top" data-top>
              <path d="M5 11V9.5A3.5 3.5 0 0 1 8.5 6H18"></path>
              <path d="M15 3l3 3-3 3"></path>
            </g>
            <g class="arrow arrow--bottom" data-bottom>
              <path d="M19 13v1.5a3.5 3.5 0 0 1-3.5 3.5H6"></path>
              <path d="M9 21l-3-3 3-3"></path>
            </g>
          </svg>
        </span>
        <span class="repost__label" data-win>
          <span class="lab" data-lab>Repost</span>
        </span>
        <span class="repost__rule" aria-hidden="true"></span>
        <span class="repost__count" data-count aria-live="polite">1,284</span>
      </span>
    </button>

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

22 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 “Repost 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 white background there is only the button, a white pill 60 pixels tall with a thin border: the loop of two arrows drawn as strokes, the label Repost, a small vertical rule and the repost count, 1,284, in tabular figures and grey. On hover it lifts by a pixel and the two arrowheads lean forward, ready to turn. Pressed, it squeezes and springs back; the arrows chase each other half a turn round the loop, with a thinner trail following and fading, and settle with a small overshoot; the two heads stretch a little along the way. A soft green circle spreads from the icon until it fills the pill, six short strokes flick once around the icon, the word Repost goes up and out and only then Reposted comes in from below, and the pill widens to make room. The count rolls to 1,285 starting from the units, like an odometer. Leave and come back over it, and Reposted becomes Undo in soft red; another click turns the arrows backwards and the number goes down. A drawn pointer shows the round trip by itself until you touch the button.

How it works

Half a turn of the loop

The two arrows are symmetrical: turned by 180 degrees they look the same again, so half a turn with back.out reads as a chase that closes, and the button remembers its angle so undoing turns it back.

The trail and the heads

A thinner copy of the loop starts half a turn behind and a moment later, fading as it catches up with the arrows; the two heads move 1.6 pixels along their way and come back on an elastic spring.

The spreading green

The green background is a 40-pixel circle centred on the icon: its scale comes from the distance between the icon and the farthest corner of the pill, so it always fills it, whatever the label.

One word at a time

The label window is one line tall: the old word rises and vanishes in 0.15 seconds, then the new one comes from below; the width is measured on the real word with a hidden span, and the pill follows it on a spring.

The number as an odometer

Every figure is a column from 0 to 9; only the ones that need to change move, starting from the units, with back.out and 0.05 seconds between them.

Values to change

NameFileDefaultWhat it changes
REPOSTSscript.js1284How many reposts the post has before the click.
SPINscript.js0.75How long the half turn of the two arrows lasts, in seconds.
SQUEEZEscript.js0.95How much the button squeezes when pressed (1 = not at all).
TRAILscript.js0.35How visible the arrows’ trail is while they turn (0 = no trail).
BURSTscript.js11 = the six strokes flicking from the icon when you repost, 0 = none.
ACCENTscript.js#0f9d63The repost colour: arrows, label and strokes.
LABELscript.jsRepostThe button label at rest.
LABEL_DONEscript.jsRepostedThe label after reposting.

Try them in the Playground

When to use it

Under a post in a social network, a community, an app feed or a blog with comments: anywhere something can be reposted or shared again and the number of times is counted.

On phones

The same pill at the same size: a finger presses like the mouse; on a phone there is no hover, so Reposted stays Reposted and a second tap undoes it.

With reduced motion

No squeezes, spins, trails or strokes: the arrows turn at once, labels and colours change with a fade and the number changes straight away. The drawn pointer does not run.

Pitfalls

  • The two labels must never share the window: the new one starts only once the old one has left, otherwise for a moment one reads over the other.
  • The green circle has to be scaled to the pill’s farthest corner, measured for real, because Reposted is longer than Repost: with a fixed scale the right-hand corner stays bare.
  • After a click the label must show the new state, not Undo: Undo appears only after leaving and coming back, otherwise a fresh repost is undone by mistake.
  • A constant called top would shadow window.top and break the site’s player: the two arrows are called arrowTop and arrowBottom.

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