Skip to content
animorio
IT
All components

Merge duplicates button

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

The button of a made-up CRM, Halden, to merge the three copies of the same contact, Dana Whitfield, that came in from three different imports. The dark pill holds a stack of three avatars with the same initials in three colours: on the tap the third copy slides into the second, the second into the first, the stack narrows to one avatar while a band of light fills the pill like a progress bar and the count below drops from 3 to 1. Then the pill turns violet, the avatar that is left gets its check and the label reads Merged into 1 contact; a moment later the copies come back out from under it and the button is ready again.

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>
<!--
  "Merge duplicates 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 Merge duplicates button with three contacts that become one</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: merge the duplicates of a contact in a CRM. Pressed, the three copies of the same person slide
         into each other one by one, the pill fills like a progress bar and turns violet, and the contact that is
         left gets its check; a moment later the copies come back out and the pill is ready again -->
    <div class="frame" data-wrap>
      <button class="c" type="button" data-btn data-autoclic aria-describedby="c-note">
        <span class="c__body" aria-hidden="true">
          <span class="c__skin"></span>
          <span class="c__ok" data-ok></span>
          <span class="c__prog"><span class="c__prog-fill" data-prog></span></span>
          <span class="c__glow" data-glow></span>
          <span class="c__sheen" data-sheen></span>
        </span>
        <span class="c__stack" data-stack aria-hidden="true">
          <span class="av av--c" data-av="2"><span class="av__in">DW</span></span>
          <span class="av av--b" data-av="1"><span class="av__in">DW</span></span>
          <span class="av av--a" data-av="0">
            <span class="av__in">DW</span>
            <svg class="av__badge" data-badge viewBox="0 0 14 14"><circle cx="7" cy="7" r="6.2"></circle><path data-tick d="M4.2 7.2 6.1 9 9.8 5.2"></path></svg>
          </span>
        </span>
        <span class="c__labels" data-labels>
          <span class="c__label" data-l="idle">Merge 3 duplicates</span>
          <span class="c__label" data-l="wait">Merging records</span>
          <span class="c__label" data-l="done">Merged into 1 contact</span>
        </span>
      </button>

      <div class="note" id="c-note" aria-live="polite">
        <span class="note__line" data-n="idle">Dana Whitfield<span class="note__sep">·</span><span class="note__roll"><span data-count>3</span></span>&nbsp;<span data-word>records</span></span>
        <span class="note__line" data-n="done">Kept 2 emails, 1 phone, 14 notes<span class="note__sep">·</span><button class="note__undo" type="button" data-undo tabindex="-1">Undo</button></span>
      </div>
    </div>
  </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.

29 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 “Merge duplicates 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 ground sits the dark Merge 3 duplicates pill with, on the left, a stack of three round avatars, all with the initials DW but in three colours (lilac, sand, mint), and below it the grey line Dana Whitfield · 3 records. On hover the pill swells with a bounce, the label widens on the wdth axis, a cool light follows the pointer and the avatars fan out a step; pressed, the pill squashes slightly. On the tap the avatars take a small run-up outwards, then the third copy slides under the second and disappears, the second squashes as if it took the hit and the count below rolls to 2; then the second and the first meet in the middle, the stack narrows to a single avatar, the first squashes and settles and the count rolls to 1 record. Meanwhile a band of violet light fills the pill from left to right, with a glowing edge, and the label says Merging records. At the end the pill turns violet with a deeper shadow, swells by a hair, a light crosses it, a white badge pops onto the avatar that is left with its check drawing itself, the label rolls to Merged into 1 contact and the line below says what was kept (Kept 2 emails, 1 phone, 14 notes) with Undo. After a few seconds, or on another tap or on Undo, the two copies come back out from under the avatar on a spring, the stack opens again and the pill goes back to dark.

How it works

The stack centred in its window

The three avatars sit absolutely in the middle of a 56-pixel window and GSAP only moves them on x (-14, 0, 14). So taking the window to 28 pixels and every x to zero is enough to keep the last avatar centred, with nothing to recalculate.

The copies that go into each other

A single timeline: the run-up outwards, the third sliding onto the second and fading as it shrinks, the keyframed squash of the one taking the hit, then the second and first meeting while the window narrows. The count below rolls on the same instant as the impact. timeScale fits the whole timeline to MERGE.

The pill that fills and turns violet

Inside the pill there are stacked layers: the dark skin, the violet one with its own shadow, the progress band (a gradient with a bright edge that comes in with xPercent from -101 to 0) and the light. The violet fades in, and the ring around the avatars changes colour through a CSS variable animated by GSAP.

The elastic label like the site’s pill

The background lives in a child of the pill that grows on hover with an elastic inset transition, and the label takes its width from a --hw variable registered with @property, so it widens with the bounce too. During a swap GSAP squeezes the label with --sq: the label room is measured at the widest setting, after the font has loaded.

Values to change

NameFileDefaultWhat it changes
COPIESscript.js3How many copies of the same contact, in the pill and the line below.
MERGEscript.js1.5The seconds the copies take to slide into each other.
SPREADscript.js14The distance between avatars in the stack, in pixels.
BOUNCEscript.js1.6How much the avatars and the pill bounce.
HOLDscript.js2.6The seconds the Merged state stays before the button is ready again.
SHEENscript.js1How strong the light crossing the violet pill is (0 off).
--violastyle.css#5a48eeThe colour of the finished pill and the check.
--lillastyle.css#d9d3ffThe colour of the avatar that stays.

Try them in the Playground

When to use it

In a CRM, a customer address book, a back office or any dashboard that finds duplicate records (contacts, companies, products): the gesture shows the copies becoming one without losing anything, and the line below says what was kept with a way to undo.

On phones

The pill drops to 56 pixels and the label tightens by a point; the finger taps like the mouse and tells the same story. Without hover the light stays off and the avatars do not fan out before the tap.

With reduced motion

No sliding avatars or squashes: the stack fades out and back in with a single avatar, the label and the line below change with a fade, the violet fades in and the check appears already drawn; on the way back the same in reverse.

Pitfalls

  • Hovering fans the avatars out with a tween on x: if the tap lands while that tween runs, the two animations fight over x and the third copy stops halfway. The avatars’ tweens must be killed before the merge timeline.
  • The preview autopilot clicks every 2.8 seconds and closed the Merged state before it could be read: its clicks (isTrusted false) no longer close it, the return comes by itself after HOLD, while a real tap closes it at once.
  • The label widening on hover in CSS and squeezing during a swap in GSAP cancelled each other out: both now go into a single font-variation-settings, calc(var(--hw) - var(--sq) * 24), with --hw registered through @property so the elastic transition works.
  • The space before the number in the line below, between two spans in a flex, disappeared: it needs &nbsp;.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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