Skip to content
animorio
IT
All components

Connect button

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

The Connect button on the dark profile card of a made-up professional network: pressed, it squeezes, the label rolls to Pending with a small clock, the light pill drains to dark and a beam of light runs round its edge while the request waits. When it is accepted the beam becomes a full ring and flashes, Connected arrives with a drawn check, the degree goes from 2nd to 1st, the connections go up by one and your avatar slides out from behind hers.

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>
<!--
  "Connect 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 connect button with the request that gets accepted</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 Connect. The button squeezes, the label rolls to Pending with a small clock, the light
         fill drains to dark and a thin beam of light starts to run round the edge of the pill while the request
         waits. When it is accepted the beam closes into a full ring and flashes, the label rolls to Connected with a
         drawn check, the degree chip rolls from 2nd to 1st, the connections count rolls up by one and your own small
         avatar slides out from behind hers. Hovering Pending offers Withdraw -->
    <section class="card" data-card aria-label="Profile of Maren Okafor">
      <span class="card__glow" aria-hidden="true"></span>

      <div class="card__top">
        <span class="avatars" aria-hidden="true">
          <span class="avatar avatar--her"><span class="avatar__shine"></span><span class="avatar__letters">MO</span></span>
          <span class="avatar avatar--you" data-you><span class="avatar__letters">You</span></span>
        </span>
        <div class="who">
          <p class="who__line">
            <span class="who__name">Maren Okafor</span>
            <span class="chip" aria-label="degree"><span class="chip__win"><span class="chip__col" data-degree><span>2nd</span><span>1st</span></span></span></span>
          </p>
          <span class="who__role">Product designer at Fennick</span>
        </div>
      </div>

      <div class="mutual">
        <span class="faces" aria-hidden="true">
          <span class="face" style="--a:#c9d4ff;--b:#6f7fe0"></span>
          <span class="face" style="--a:#ffd9c2;--b:#e0855f"></span>
          <span class="face" style="--a:#cdeedd;--b:#5fae8a"></span>
        </span>
        <span class="mutual__text"><b>Theo</b>, <b>Ana</b> and 46 other mutuals</span>
      </div>

      <p class="stats">
        <span><span class="stats__num" data-count>512</span> connections</span>
        <span class="stats__sep" aria-hidden="true"></span>
        <span>Replies in about a day</span>
      </p>

      <button class="connect" type="button" data-connect data-autoclic aria-pressed="false">
        <svg class="connect__beam" data-beam aria-hidden="true">
          <rect class="beam beam--haze" data-haze pathLength="100"></rect>
          <rect class="beam beam--tail" data-tail pathLength="100"></rect>
          <rect class="beam beam--core" data-core pathLength="100"></rect>
        </svg>
        <span class="connect__fill" data-fill><span class="connect__sheen" data-sheen></span></span>
        <span class="connect__inner">
          <svg class="connect__icon" viewBox="0 0 24 24" aria-hidden="true">
            <g class="ic ic--add" data-ic-add>
              <circle cx="9.5" cy="8.2" r="3.4"></circle>
              <path d="M3.6 19c.7-3.2 3.1-5 5.9-5s5.2 1.8 5.9 5"></path>
              <path d="M18.6 7.6v6M15.6 10.6h6"></path>
            </g>
            <g class="ic ic--clock" data-ic-clock>
              <circle cx="12" cy="12" r="7.6"></circle>
              <path class="hand hand--min" data-hand-min d="M12 12V7.4"></path>
              <path class="hand hand--hour" data-hand-hour d="M12 12h3.2"></path>
            </g>
            <g class="ic ic--x" data-ic-x>
              <path d="M8 8l8 8M16 8l-8 8"></path>
            </g>
            <path class="ic ic--check" data-ic-check d="M5.6 12.6l4.1 4 8.7-9.2"></path>
          </svg>
          <span class="connect__win" data-win>
            <span class="connect__col" data-labels>
              <span class="lab" data-lab="connect">Connect</span>
              <span class="lab" data-lab="pending">Pending</span>
              <span class="lab" data-lab="withdraw">Withdraw</span>
              <span class="lab" data-lab="connected">Connected</span>
            </span>
          </span>
        </span>
      </button>

      <p class="note" aria-live="polite">
        <span class="note__col" data-note>
          <span class="note__line">Usually accepts requests from people with mutuals</span>
          <span class="note__line">Request sent just now</span>
          <span class="note__line"><b>Maren accepted</b> · say hello in Messages</span>
        </span>
      </p>
    </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.

47 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 “Connect 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 black page sits the dark profile card of Maren Okafor, product designer at Fennick, in a made-up professional network: a round avatar with initials on a peach and coral gradient with a highlight, the name with the degree chip, 2nd, three small avatars of mutual connections, the connections count and below a light pill, as tall as a real button, with a person-plus icon and the word Connect. On hover the pill lifts by a pixel, the label widens along the width axis and a band of light crosses it. Pressed, it squeezes and comes back on an elastic spring: the label rolls up to Pending with a small clock whose hand turns, the pill drains from light to dark with a thin border, and a lilac beam of light with a white head and a blurred tail starts running round the edge, at the same speed on the straight sides and the curves. The line under the button rolls to Request sent just now. Leave and hover again and Pending turns into Withdraw in grey with a cross while the beam slows; pressed, the request is withdrawn. Wait, and the request is accepted: the beam speeds up, grows until it closes the whole ring, flashes and goes out leaving a lilac border; the label rolls to Connected and a check draws itself, the button gives a small hop, the degree rolls from 2nd to 1st, the connections from 512 to 513, your avatar slides out from behind hers and settles at her bottom right, the three mutual connections hop one after the other and the line underneath says Maren accepted. A drawn pointer shows the whole loop on its own.

How it works

The beam is a dashed rectangle

The edge is an SVG rect with corners rounded by half its height and pathLength 100, drawn three times: a blurred haze, a lilac tail and a white head. Each has a single dash (stroke-dasharray) and a stroke-dashoffset that GSAP turns by 100 in BEAM_SPEED seconds: unlike a conic gradient, the light keeps one speed on the sides and the curves.

The ring that closes

When the request is accepted the head speeds up (power2.in) and the dash grows to 100, the whole edge; the haze comes to full light, then everything goes out in 0.75 seconds while the button’s border stays lilac in its box-shadow.

Four labels in one column

Connect, Pending, Withdraw and Connected sit one under the other in a 22 pixel window; the column moves by 22 pixels per state with back.out and the window takes the measured width of the new word, so icon and label stay centred together.

Looks with the same shadows

Every state has a fill, a colour and a box-shadow of three shadows written in the same shape (top highlight, border, glow): so GSAP can go from one to the next number by number, without jumps.

Figures that carry

Each figure of the connections is a column from 0 to 9; only the figures that differ move, from right to left 50 ms apart, like a counter carrying over. The degree chip is a column of two lines, 2nd and 1st.

Your avatar from behind

Your avatar waits hidden and small under hers; once the request is accepted it slides to her bottom right with back.out(2) and halfway comes on top (z-index), with a ring in the card’s colour to set it apart.

Values to change

NameFileDefaultWhat it changes
CONNECTIONSscript.js512How many connections the profile has before she accepts.
PENDING_TIMEscript.js2.6How many seconds the request waits before it is accepted.
BEAM_SPEEDscript.js1.7How many seconds the beam takes to run once round the edge.
BEAM_LENGTHscript.js22How long the beam is, as a share of the edge (0 to 60).
SQUEEZEscript.js0.965How much the button gives under the finger (1 = not at all).
ACCENTscript.js#8b9bffThe colour of the beam, the check and the focus.
LABELscript.jsConnectThe button’s label at rest.

Try them in the Playground

When to use it

To ask for a connection the other person has to accept: in a professional network, a community of practitioners, the attendee list of an event, an app to meet colleagues or mentors, an author’s page that takes contact requests.

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, Pending stays Pending and a second tap withdraws the request. With little height the connections line hides.

With reduced motion

No squeezes, rolls or running beam: labels and colours change with a fade, while waiting the edge lights up still and soft, numbers and degree change at once and your avatar appears in place.

Pitfalls

  • A conic gradient on the edge of a wide pill makes the light crawl along the long sides and rush round the curves: with an SVG rect and pathLength 100 the speed is the same everywhere.
  • GSAP blends a box-shadow only if start and end have the same shape: every state has three shadows, even when one is transparent.
  • The autopilot accepts the request itself at the right moment; an extra delayedCall would accept twice. The delayedCall starts only once a real person takes over, even if the pilot had left the request waiting.
  • The beam’s rect is measured in pixels: it is redone on resize and when the typeface arrives, or the light runs off the edge.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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