Skip to content
animorio
IT
All components

Duplicate button

Buttons, HoverGSAP, CSS onlyEasyCompressed weight: Demo 5.1 KBGSAP 28 KBFreeDownload the zip

One button, one sign, in the simple style of product interface pieces: the black «Duplicate» pill of a documents app, with a sheet and its folded corner drawn in a few strokes. On tap the sheet splits in two, the copy slides to the bottom right and the original steps back, both a hair too far; a thin line in the accent colour runs down the copy and writes its lines while the label reads «Duplicating», then the copy’s corner folds down with a snap and «Duplicated» arrives.

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>
<!--
  "Duplicate 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 Duplicate button with the sheet that splits in two</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" data-stage>
    <!-- one button, one sign: the sheet splits in two, the copy slides out and its lines are written in -->
    <button class="dup" type="button" data-dup data-autoclic aria-label="Duplicate">
      <span class="dup__body" data-body>
        <svg class="dup__icon" viewBox="4.5 4.5 23 23" aria-hidden="true">
          <g transform="translate(9.5 8)">
            <g data-sheet="original">
              <path class="dup__sheet" d="M1.5 0H9L13 4V14.5A1.5 1.5 0 0 1 11.5 16H1.5A1.5 1.5 0 0 1 0 14.5V1.5A1.5 1.5 0 0 1 1.5 0Z"/>
              <path class="dup__fold" d="M9 0V3A1 1 0 0 0 10 4H13"/>
              <path class="dup__line" d="M3 8H10"/>
              <path class="dup__line" d="M3 10.6H10"/>
              <path class="dup__line" d="M3 13.2H7.4"/>
            </g>
            <g data-sheet="copy">
              <path class="dup__sheet" d="M1.5 0H9L13 4V14.5A1.5 1.5 0 0 1 11.5 16H1.5A1.5 1.5 0 0 1 0 14.5V1.5A1.5 1.5 0 0 1 1.5 0Z"/>
              <path class="dup__fold" data-fold d="M9 0V3A1 1 0 0 0 10 4H13"/>
              <path class="dup__line dup__line--copy" data-line d="M3 8H10"/>
              <path class="dup__line dup__line--copy" data-line d="M3 10.6H10"/>
              <path class="dup__line dup__line--copy" data-line d="M3 13.2H7.4"/>
              <path class="dup__scan" data-scan d="M2 5.6H11"/>
            </g>
          </g>
        </svg>
        <span class="dup__label" aria-hidden="true">
          <span class="dup__word" data-word="idle">Duplicate</span>
          <span class="dup__word" data-word="busy">Duplicating</span>
          <span class="dup__word" data-word="done">Duplicated</span>
        </span>
      </span>
    </button>
    <p class="dup__status" role="status" aria-live="polite" data-status></p>
  </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.

17 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 “Duplicate 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 white, alone in the middle, there is a black pill with a sheet drawn in a thin line, its top right corner folded and three faint lines inside, and the word «Duplicate». On tap the pill gives a little and comes back on a spring; the sheet splits in two: the copy slides out towards the bottom right and the original steps back towards the top left, both landing a hair too far and settling, so the two sheets overlap in the middle of the icon. The copy is born empty and without its folded corner. Meanwhile «Duplicate» rises away and «Duplicating» arrives, coming in narrow and opening up on the width axis; the pill stretches on a spring as much as it needs. A thin line in the accent colour lights up at the top of the copy and runs down: each line of the sheet is written from the left the moment the line passes it. At the bottom it fades, the copy’s corner folds down with a small snap, the copy drops a pixel and comes back, and the label becomes «Duplicated». Another tap slides the copy back into the original, the lines slip away and «Duplicate» returns. Hovering brings the pill a touch closer and the copy peeks out a pixel from under the sheet. Until someone touches it, the pill plays the gesture by itself.

How it works

Two identical sheets

The icon is an SVG with two identical groups, the original and the copy, sitting on top of each other at rest. The copy is filled with the pill’s colour but with fill-opacity at zero: as soon as it moves it fills in 16 hundredths of a second while sliding, so it only covers the original where it has already left, and the lines underneath never vanish all at once.

The split

Copy and original go in opposite directions by the same amount, 2.7 and 2.3 units times SPREAD, with back.out: the copy leaves four hundredths earlier on a livelier spring, the original follows, heavier. The drawing stays centred in the icon even once split.

The line that writes

The accent line goes down 8.6 units in WORK seconds with power1.inOut. Each line of the sheet has strokeDasharray equal to its length and starts at a full strokeDashoffset: it is written when the accent line reaches its height, worked out from the line’s position, so the two stay in step for any value of WORK.

The corner fold and the word

The copy’s folded corner scales up from zero around its vertex (svgOrigin 13 0) with back.out: that is the snap of the done state. The three words share one grid cell; the old one rises and leaves, the new one comes up from below at wdth 75 and weight 420 and lands at 100 and 560, and the pill takes the width of the new word measured in its final shape.

Values to change

NameFileDefaultWhat it changes
ACCENTscript.js#4f7cffThe colour of the thin line that writes the copy.
LABEL_IDLEscript.jsDuplicateThe word at rest.
LABEL_BUSYscript.jsDuplicatingThe word while the copy is being made.
LABEL_DONEscript.jsDuplicatedThe word once the copy is there.
WORKscript.js1.1How many seconds the copy takes to be written.
SPREADscript.js1How far apart the two sheets end up: 0.6 close, 1.4 wide.
SPRINGscript.js1How springy the press and the sheets are: 0.4 calm, 2 very bouncy.
SPEEDscript.js1The speed of everything: 2 twice as fast, 0.5 half.
HOLDscript.js2How many seconds each state stays when the button plays by itself.
AUTOscript.jstrueThe button plays the gesture by itself until someone touches it.

Try them in the Playground

When to use it

For the button that makes a copy of a document, a page or a template in a work app: the sign says by itself that there are two sheets now, with no need for a notice.

On phones

On the phone the pill and the icon take their size from the screen (clamp on the shorter side); there is no hover, everything else is the same.

With reduced motion

The two sheets are already in place and the copy fades in with its lines already written; the words swap with a fade, with no springs or movement.

Pitfalls

  • The copy sits on top of the original: with its fill solid from the start, on the first frame the original’s lines vanished for an instant. The copy’s fill starts transparent and fills in while it slides away.
  • The lines’ timings come from their height in the sheet, not fixed numbers: with fixed timings, changing WORK in the Playground made the accent line pass and the lines get written afterwards.
  • The press scale has to be divided out when measuring the word: if the pill is at 0.95 while measuring, the word comes out shorter and the pill gets too narrow.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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