Skip to content
animorio
IT
All components

Boost post button

Buttons, Hover, TransitionsGSAP, CSS onlyMediumCompressed weight: Demo 6.0 KBGSAP 28 KBFreeDownload the zip

The «Boost post» button under a post on Loop, a made-up social app: hold it and the pill fills from the left like rising pressure, the estimated reach rolls from 1.2k to 18.4k people and the daily budget steps up, $5, $10, $20. Let go before the end and it springs back; hold to the end and it launches: the pill squashes and stretches, a ring leaves its edges and the label becomes «Boosted · 2 days» with a bolt drawing itself, and Undo beside it. Minimal style, on white, one electric blue.

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>
<!--
  "Boost post 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>Boost post 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 Boost button under a post of a made-up social app, Loop: hold it and the pill fills like rising pressure,
         the estimated reach rolls up and the budget steps up; let go early and it springs back, hold to the end and it launches -->
    <section class="post" data-post aria-label="Post by Mara Okafor">
      <header class="post__head">
        <span class="post__avatar" aria-hidden="true">MO</span>
        <span class="post__who">
          <span class="post__name">Mara Okafor</span>
          <span class="post__meta">@maraokafor · 2h</span>
        </span>
        <span class="post__chip">Ceramics studio</span>
      </header>
      <p class="post__text">The new studio on Calle Luna opens this Saturday. First wheel class is free, coffee is on us.</p>
      <ul class="post__stats" aria-label="Post stats">
        <li><svg viewBox="0 0 16 16" aria-hidden="true"><path d="M2.5 13.5V8.5M6.2 13.5V4.5M9.8 13.5V7M13.5 13.5V2.5"/></svg><span>3.1k</span><span class="sr">views</span></li>
        <li><svg viewBox="0 0 16 16" aria-hidden="true"><path d="M3 3.5h10a1 1 0 0 1 1 1v6a1 1 0 0 1-1 1H7.5L4.5 14v-2.5H3a1 1 0 0 1-1-1v-6a1 1 0 0 1 1-1Z"/></svg><span>31</span><span class="sr">comments</span></li>
        <li><svg viewBox="0 0 16 16" aria-hidden="true"><path d="M2.5 7V6a2 2 0 0 1 2-2h8.5M11 2l2 2-2 2M13.5 9v1a2 2 0 0 1-2 2H3M5 14l-2-2 2-2"/></svg><span>12</span><span class="sr">reposts</span></li>
      </ul>

      <div class="boost">
        <div class="boost__row">
          <span class="boost__label">Est. reach</span>
          <span class="boost__reach"><span data-reach>1.2k</span><span class="boost__people">people</span></span>
          <span class="boost__budget" data-budget-box><span class="roll" data-budget><span class="roll__line">$5</span></span><span class="boost__per">/day</span></span>
        </div>

        <div class="pill-wrap">
          <span class="ring" data-ring aria-hidden="true"></span>
          <button class="pill" type="button" data-pill data-autoclic aria-describedby="hint">
            <span class="pill__face" data-face>
              <span class="pill__fill" data-fill aria-hidden="true"></span>
              <span class="pill__label" data-label-base>
                <svg class="pill__arrow" data-arrow viewBox="0 0 16 16" aria-hidden="true"><path d="M8 13V3.4M3.8 7.4 8 3.2l4.2 4.2"/></svg>
                <span class="roll" data-text><span class="roll__line">Boost post</span></span>
              </span>
              <span class="pill__label pill__label--on" data-label-on aria-hidden="true">
                <svg class="pill__arrow" data-arrow-on viewBox="0 0 16 16"><path d="M8 13V3.4M3.8 7.4 8 3.2l4.2 4.2"/></svg>
                <span class="roll" data-text-on><span class="roll__line">Boost post</span></span>
              </span>
              <span class="pill__done" data-done aria-hidden="true">
                <svg class="pill__bolt" viewBox="0 0 16 16"><path data-bolt pathLength="1" d="M9.2 1.8 3.6 9h4.1l-1 5.2L12.4 7H8.3l.9-5.2Z"/></svg>
                <span>Boosted · <span data-days>2 days</span></span>
              </span>
            </span>
          </button>
        </div>

        <div class="boost__foot">
          <span class="hint" id="hint" data-hint>Hold to boost</span>
          <button class="undo" type="button" data-undo tabindex="-1">Undo</button>
        </div>
      </div>
      <p class="sr" aria-live="polite" data-live></p>
    </section>
  </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.

39 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 “Boost post 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

A post by Mara Okafor, a ceramics studio, with initials, two lines of text and the counts of views, comments and reposts. Below it, the boost strip: the estimated reach, the daily budget and the «Boost post» pill. Hold it and the pill fills with blue from the left, the label turns white as the blue passes it, the arrow lifts, the reach climbs and the budget steps from $5 to $10 to $20 with a little bounce. Let go before the end and everything springs back. At the end the pill squashes and stretches, a thin ring leaves its edges, «Boosted · 2 days» appears with a bolt drawing itself, with «Reaching ~18.4k people» and Undo below, which puts everything back.

How it works

One variable

The whole fill is one CSS variable, --p, from 0 to 1: the blue fill is a scaleX(var(--p)) with its origin on the left, and the white label is a copy of the blue one clipped with clip-path: inset(0 calc((1 - var(--p)) * 100%) 0 0). So the white crosses the letters exactly where the blue arrives.

Holding

On press GSAP takes p to 1 in 1.6 seconds with power1.in, the rising pressure; on every frame the reach is worked out between 1,200 and 18,400 and the budget takes the matching step. The pointer is captured with setPointerCapture, so sliding off the pill while holding does not stop it.

Letting go early

On release the tween stops and p goes back to 0 with elastic.out(1, 0.45): the pill empties with a small bounce, and the value is kept above zero so the spring never takes it negative.

The launch

At 1 the button squashes to 1.045 by 0.9 and springs back, a blue-edged ring grows and fades, the label leaves upwards and «Boosted · 2 days» comes up from below; the bolt draws itself with stroke-dashoffset from 1 to 0 (autoRound off).

Keyboard and touch

Holding Space or Enter does the same gesture (ignoring key repeats); for fingers the pill has touch-action: none and no long-press menu.

Values to change

NameFileDefaultWhat it changes
HOLDscript.js1.6Seconds of holding to fill the pill and launch the boost.
REACH_FROMscript.js1200The estimated reach before boosting, in people.
REACH_TOscript.js18400The estimated reach with the full boost, in people.
BUDGETSscript.js"5,10,20"The daily budget steps the pill climbs while you hold, in dollars.
DAYSscript.js2How many days the boost runs.
SPRINGscript.js0.45How springy the pill is when you let go early (lower = more bounce).
LOOP_PAUSEscript.js2.4Seconds the boosted state stays before the loop undoes it.

Try them in the Playground

When to use it

Under a post in a social app or in the panel of whoever runs a brand’s social accounts: promoting a post, sponsoring an ad, pushing a blog article. It suits any action that costs money and wants more confirmation than a single click.

On phones

Everything is in em and the size depends on both the width and the height of the window, so the post with its pill fits the phone box. A finger holds just like the mouse.

With reduced motion

No springs or movement: the pill fills and empties without bouncing, the arrow stays still, labels crossfade and the ring does not appear.

Pitfalls

  • The release spring takes p below zero: keep it at Math.max(0, p), or a negative scaleX flips the blue fill.
  • Without setPointerCapture, sliding off the pill while holding sends a pointerleave and breaks the gesture; for fingers you also need touch-action: none and a cancelled contextmenu.
  • The white label is a copy of the blue one with a clip-path: both must have the same width and place, so they share the same grid cell.
  • The bolt’s stroke-dashoffset must be animated with autoRound off, or it jumps from 1 to 0 at once.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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