Skip to content
animorio
IT
All components

Remove background button

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

The button of an AI photo app, on an almost black background, in the style of the light effects of AI apps: above, a real photo of a white ceramic jug with a sprig of fern, on a table in front of the window, below, the Remove background pill. A single gesture, press: a blue light starts running round the button’s border, a thread of light runs round the jug along its outline with a brighter head, then the room is wiped away from the jug outwards with a ring of light on its front and the transparency grid is left underneath; the jug lifts by a pixel onto its new shadow, the file becomes a .png and gets lighter, the button says Background removed with a tick and Undo lights up beside it.

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>
<!--
  "Remove background 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 Remove background button with a thread of light that cuts out the photo</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>
    <!-- an AI photo editor: press Remove background and a thread of light runs round the jug, then the room behind it
         is wiped away from the jug outwards, leaving the transparent grid and a new soft shadow -->
    <section class="editor" data-card aria-label="Photo editor">
      <header class="editor__head">
        <p class="editor__brand">
          <span class="editor__logo" aria-hidden="true"><svg viewBox="0 0 24 24"><path d="M6 4v12a2 2 0 0 0 2 2h12"></path><path d="M18 20V8a2 2 0 0 0-2-2H4"></path></svg></span>
          <span data-brand>Cutwell</span>
        </p>
        <span class="chip"><span class="roll"><span class="roll__in" data-file>jug-studio.jpg</span></span></span>
      </header>

      <figure class="shot" data-shot>
        <svg class="scene" viewBox="0 0 300 200" preserveAspectRatio="xMidYMid slice" aria-hidden="true" data-scene>
          <defs>
            <radialGradient id="contact" cx="0.5" cy="0.5" r="0.5">
              <stop offset="0" stop-color="#000" stop-opacity="0.55"></stop>
              <stop offset="1" stop-color="#000" stop-opacity="0"></stop>
            </radialGradient>
            <clipPath id="body"><path clip-rule="evenodd" d="M147.4 49.2C148.6 49.3 150.0 47.9 152.3 47.5C154.6 47.1 158.1 46.9 161.1 46.9C164.2 46.9 167.9 47.5 170.8 47.5C173.7 47.5 175.9 47.2 178.7 46.9C181.5 46.5 184.7 45.8 187.5 45.4C190.3 45.0 192.8 44.6 195.4 44.5C198.0 44.4 200.6 44.5 203.0 44.8C205.5 45.1 208.1 45.8 210.1 46.3C212.0 46.8 214.1 47.4 214.7 48.0C215.4 48.7 214.6 49.0 213.9 50.1C213.1 51.2 211.0 53.2 210.1 54.8C209.1 56.3 208.4 57.7 208.0 59.5C207.6 61.2 207.4 63.0 207.4 65.3C207.4 67.6 207.6 70.2 208.0 73.2C208.4 76.3 209.1 80.1 210.1 83.5C211.0 86.9 212.5 90.1 213.9 93.8C215.2 97.4 217.0 101.6 218.3 105.5C219.5 109.4 220.5 113.3 221.2 117.2C221.9 121.1 222.4 125.0 222.7 128.9C222.9 132.8 223.1 136.7 222.7 140.6C222.2 144.5 221.2 148.4 219.7 152.3C218.3 156.2 216.1 160.9 213.9 164.1C211.7 167.2 209.0 169.4 206.5 171.4C204.1 173.3 202.4 174.6 199.2 175.8C196.0 177.0 191.4 178.1 187.5 178.7C183.6 179.3 179.4 179.4 175.8 179.3C172.1 179.2 168.2 178.7 165.5 177.8C162.8 177.0 161.9 176.6 159.7 174.3C157.5 172.0 154.3 167.7 152.3 164.1C150.4 160.4 149.2 156.2 147.9 152.3C146.7 148.4 145.8 144.5 145.0 140.6C144.3 136.7 143.6 132.8 143.6 128.9C143.6 125.0 144.5 120.5 145.0 117.2C145.5 113.9 146.7 111.9 146.5 109.3C146.2 106.7 144.7 104.1 143.6 101.7C142.4 99.2 141.1 96.8 139.7 94.6C138.4 92.5 137.0 90.9 135.6 88.8C134.3 86.7 133.1 84.5 131.8 82.0C130.6 79.6 129.2 76.7 128.3 74.1C127.4 71.5 127.0 69.1 126.6 66.5C126.2 63.9 125.8 60.9 126.0 58.6C126.1 56.3 126.7 54.3 127.4 52.7C128.2 51.1 129.0 49.9 130.4 48.9C131.7 47.9 133.8 47.3 135.6 46.9C137.5 46.4 139.6 46.2 141.2 46.3C142.8 46.3 144.0 46.7 145.0 47.2C146.0 47.7 146.1 49.2 147.4 49.2ZM141.5 50.7C143.2 50.6 144.7 51.0 146.5 51.9C148.3 52.7 150.5 54.1 152.3 55.7C154.2 57.3 156.3 59.7 157.3 61.5C158.3 63.3 158.4 63.7 158.2 66.5C158.0 69.3 157.1 74.7 156.2 78.2C155.2 81.8 153.7 84.3 152.3 87.9C151.0 91.5 148.9 96.9 147.9 99.6C147.0 102.3 147.0 104.5 146.5 104.0C146.0 103.5 145.8 99.0 145.0 96.7C144.2 94.3 142.7 92.2 141.5 89.9C140.3 87.6 139.0 85.4 137.7 82.9C136.4 80.5 134.9 78.2 133.9 75.3C132.9 72.4 132.1 68.5 131.8 65.3C131.6 62.2 131.7 58.7 132.4 56.5C133.2 54.3 134.7 53.1 136.2 52.1C137.7 51.2 139.8 50.7 141.5 50.7Z"></path></clipPath>
            <filter id="soft" x="-30%" y="-30%" width="160%" height="160%"><feGaussianBlur stdDeviation="9"></feGaussianBlur></filter>
            <filter id="edge" x="-10%" y="-10%" width="120%" height="120%"><feGaussianBlur stdDeviation="2.2"></feGaussianBlur></filter>
            <mask id="keep" maskUnits="userSpaceOnUse" x="0" y="0" width="300" height="200">
              <rect width="300" height="200" fill="#fff"></rect>
              <circle data-hole cx="183" cy="112" r="0" fill="#000" filter="url(#soft)"></circle>
            </mask>
          </defs>

          <!-- the room: the real photo of the jug by the window, wiped away from the jug outwards -->
          <g mask="url(#keep)" data-room>
            <image href="stanza.webp" x="0" y="0" width="300" height="200" preserveAspectRatio="xMidYMid slice"></image>
          </g>

          <!-- the sweep: a ring of light riding on the edge of the wipe -->
          <circle class="sweep" data-sweep cx="183" cy="112" r="0" filter="url(#edge)"></circle>

          <!-- the new shadow, under the cut-out jug -->
          <ellipse data-shadow cx="178" cy="180" rx="42" ry="4.5" fill="url(#contact)" opacity="0"></ellipse>

          <!-- the jug: the same photo, clipped to the jug's own outline (handle hole included), so it stays when the room goes -->
          <g data-jug>
            <image href="stanza.webp" x="0" y="0" width="300" height="200" preserveAspectRatio="xMidYMid slice" clip-path="url(#body)"></image>
          </g>

          <!-- the thread of light that cuts the jug out, and its brighter head: a short dash running ahead of it -->
          <path class="trace trace--glow" data-trace d="M147.4 49.2C148.6 49.3 150.0 47.9 152.3 47.5C154.6 47.1 158.1 46.9 161.1 46.9C164.2 46.9 167.9 47.5 170.8 47.5C173.7 47.5 175.9 47.2 178.7 46.9C181.5 46.5 184.7 45.8 187.5 45.4C190.3 45.0 192.8 44.6 195.4 44.5C198.0 44.4 200.6 44.5 203.0 44.8C205.5 45.1 208.1 45.8 210.1 46.3C212.0 46.8 214.1 47.4 214.7 48.0C215.4 48.7 214.6 49.0 213.9 50.1C213.1 51.2 211.0 53.2 210.1 54.8C209.1 56.3 208.4 57.7 208.0 59.5C207.6 61.2 207.4 63.0 207.4 65.3C207.4 67.6 207.6 70.2 208.0 73.2C208.4 76.3 209.1 80.1 210.1 83.5C211.0 86.9 212.5 90.1 213.9 93.8C215.2 97.4 217.0 101.6 218.3 105.5C219.5 109.4 220.5 113.3 221.2 117.2C221.9 121.1 222.4 125.0 222.7 128.9C222.9 132.8 223.1 136.7 222.7 140.6C222.2 144.5 221.2 148.4 219.7 152.3C218.3 156.2 216.1 160.9 213.9 164.1C211.7 167.2 209.0 169.4 206.5 171.4C204.1 173.3 202.4 174.6 199.2 175.8C196.0 177.0 191.4 178.1 187.5 178.7C183.6 179.3 179.4 179.4 175.8 179.3C172.1 179.2 168.2 178.7 165.5 177.8C162.8 177.0 161.9 176.6 159.7 174.3C157.5 172.0 154.3 167.7 152.3 164.1C150.4 160.4 149.2 156.2 147.9 152.3C146.7 148.4 145.8 144.5 145.0 140.6C144.3 136.7 143.6 132.8 143.6 128.9C143.6 125.0 144.5 120.5 145.0 117.2C145.5 113.9 146.7 111.9 146.5 109.3C146.2 106.7 144.7 104.1 143.6 101.7C142.4 99.2 141.1 96.8 139.7 94.6C138.4 92.5 137.0 90.9 135.6 88.8C134.3 86.7 133.1 84.5 131.8 82.0C130.6 79.6 129.2 76.7 128.3 74.1C127.4 71.5 127.0 69.1 126.6 66.5C126.2 63.9 125.8 60.9 126.0 58.6C126.1 56.3 126.7 54.3 127.4 52.7C128.2 51.1 129.0 49.9 130.4 48.9C131.7 47.9 133.8 47.3 135.6 46.9C137.5 46.4 139.6 46.2 141.2 46.3C142.8 46.3 144.0 46.7 145.0 47.2C146.0 47.7 146.1 49.2 147.4 49.2ZM141.5 50.7C143.2 50.6 144.7 51.0 146.5 51.9C148.3 52.7 150.5 54.1 152.3 55.7C154.2 57.3 156.3 59.7 157.3 61.5C158.3 63.3 158.4 63.7 158.2 66.5C158.0 69.3 157.1 74.7 156.2 78.2C155.2 81.8 153.7 84.3 152.3 87.9C151.0 91.5 148.9 96.9 147.9 99.6C147.0 102.3 147.0 104.5 146.5 104.0C146.0 103.5 145.8 99.0 145.0 96.7C144.2 94.3 142.7 92.2 141.5 89.9C140.3 87.6 139.0 85.4 137.7 82.9C136.4 80.5 134.9 78.2 133.9 75.3C132.9 72.4 132.1 68.5 131.8 65.3C131.6 62.2 131.7 58.7 132.4 56.5C133.2 54.3 134.7 53.1 136.2 52.1C137.7 51.2 139.8 50.7 141.5 50.7Z" filter="url(#edge)"></path>
          <path class="trace" data-trace d="M147.4 49.2C148.6 49.3 150.0 47.9 152.3 47.5C154.6 47.1 158.1 46.9 161.1 46.9C164.2 46.9 167.9 47.5 170.8 47.5C173.7 47.5 175.9 47.2 178.7 46.9C181.5 46.5 184.7 45.8 187.5 45.4C190.3 45.0 192.8 44.6 195.4 44.5C198.0 44.4 200.6 44.5 203.0 44.8C205.5 45.1 208.1 45.8 210.1 46.3C212.0 46.8 214.1 47.4 214.7 48.0C215.4 48.7 214.6 49.0 213.9 50.1C213.1 51.2 211.0 53.2 210.1 54.8C209.1 56.3 208.4 57.7 208.0 59.5C207.6 61.2 207.4 63.0 207.4 65.3C207.4 67.6 207.6 70.2 208.0 73.2C208.4 76.3 209.1 80.1 210.1 83.5C211.0 86.9 212.5 90.1 213.9 93.8C215.2 97.4 217.0 101.6 218.3 105.5C219.5 109.4 220.5 113.3 221.2 117.2C221.9 121.1 222.4 125.0 222.7 128.9C222.9 132.8 223.1 136.7 222.7 140.6C222.2 144.5 221.2 148.4 219.7 152.3C218.3 156.2 216.1 160.9 213.9 164.1C211.7 167.2 209.0 169.4 206.5 171.4C204.1 173.3 202.4 174.6 199.2 175.8C196.0 177.0 191.4 178.1 187.5 178.7C183.6 179.3 179.4 179.4 175.8 179.3C172.1 179.2 168.2 178.7 165.5 177.8C162.8 177.0 161.9 176.6 159.7 174.3C157.5 172.0 154.3 167.7 152.3 164.1C150.4 160.4 149.2 156.2 147.9 152.3C146.7 148.4 145.8 144.5 145.0 140.6C144.3 136.7 143.6 132.8 143.6 128.9C143.6 125.0 144.5 120.5 145.0 117.2C145.5 113.9 146.7 111.9 146.5 109.3C146.2 106.7 144.7 104.1 143.6 101.7C142.4 99.2 141.1 96.8 139.7 94.6C138.4 92.5 137.0 90.9 135.6 88.8C134.3 86.7 133.1 84.5 131.8 82.0C130.6 79.6 129.2 76.7 128.3 74.1C127.4 71.5 127.0 69.1 126.6 66.5C126.2 63.9 125.8 60.9 126.0 58.6C126.1 56.3 126.7 54.3 127.4 52.7C128.2 51.1 129.0 49.9 130.4 48.9C131.7 47.9 133.8 47.3 135.6 46.9C137.5 46.4 139.6 46.2 141.2 46.3C142.8 46.3 144.0 46.7 145.0 47.2C146.0 47.7 146.1 49.2 147.4 49.2ZM141.5 50.7C143.2 50.6 144.7 51.0 146.5 51.9C148.3 52.7 150.5 54.1 152.3 55.7C154.2 57.3 156.3 59.7 157.3 61.5C158.3 63.3 158.4 63.7 158.2 66.5C158.0 69.3 157.1 74.7 156.2 78.2C155.2 81.8 153.7 84.3 152.3 87.9C151.0 91.5 148.9 96.9 147.9 99.6C147.0 102.3 147.0 104.5 146.5 104.0C146.0 103.5 145.8 99.0 145.0 96.7C144.2 94.3 142.7 92.2 141.5 89.9C140.3 87.6 139.0 85.4 137.7 82.9C136.4 80.5 134.9 78.2 133.9 75.3C132.9 72.4 132.1 68.5 131.8 65.3C131.6 62.2 131.7 58.7 132.4 56.5C133.2 54.3 134.7 53.1 136.2 52.1C137.7 51.2 139.8 50.7 141.5 50.7Z"></path>
          <path class="head head--glow" data-head d="M147.4 49.2C148.6 49.3 150.0 47.9 152.3 47.5C154.6 47.1 158.1 46.9 161.1 46.9C164.2 46.9 167.9 47.5 170.8 47.5C173.7 47.5 175.9 47.2 178.7 46.9C181.5 46.5 184.7 45.8 187.5 45.4C190.3 45.0 192.8 44.6 195.4 44.5C198.0 44.4 200.6 44.5 203.0 44.8C205.5 45.1 208.1 45.8 210.1 46.3C212.0 46.8 214.1 47.4 214.7 48.0C215.4 48.7 214.6 49.0 213.9 50.1C213.1 51.2 211.0 53.2 210.1 54.8C209.1 56.3 208.4 57.7 208.0 59.5C207.6 61.2 207.4 63.0 207.4 65.3C207.4 67.6 207.6 70.2 208.0 73.2C208.4 76.3 209.1 80.1 210.1 83.5C211.0 86.9 212.5 90.1 213.9 93.8C215.2 97.4 217.0 101.6 218.3 105.5C219.5 109.4 220.5 113.3 221.2 117.2C221.9 121.1 222.4 125.0 222.7 128.9C222.9 132.8 223.1 136.7 222.7 140.6C222.2 144.5 221.2 148.4 219.7 152.3C218.3 156.2 216.1 160.9 213.9 164.1C211.7 167.2 209.0 169.4 206.5 171.4C204.1 173.3 202.4 174.6 199.2 175.8C196.0 177.0 191.4 178.1 187.5 178.7C183.6 179.3 179.4 179.4 175.8 179.3C172.1 179.2 168.2 178.7 165.5 177.8C162.8 177.0 161.9 176.6 159.7 174.3C157.5 172.0 154.3 167.7 152.3 164.1C150.4 160.4 149.2 156.2 147.9 152.3C146.7 148.4 145.8 144.5 145.0 140.6C144.3 136.7 143.6 132.8 143.6 128.9C143.6 125.0 144.5 120.5 145.0 117.2C145.5 113.9 146.7 111.9 146.5 109.3C146.2 106.7 144.7 104.1 143.6 101.7C142.4 99.2 141.1 96.8 139.7 94.6C138.4 92.5 137.0 90.9 135.6 88.8C134.3 86.7 133.1 84.5 131.8 82.0C130.6 79.6 129.2 76.7 128.3 74.1C127.4 71.5 127.0 69.1 126.6 66.5C126.2 63.9 125.8 60.9 126.0 58.6C126.1 56.3 126.7 54.3 127.4 52.7C128.2 51.1 129.0 49.9 130.4 48.9C131.7 47.9 133.8 47.3 135.6 46.9C137.5 46.4 139.6 46.2 141.2 46.3C142.8 46.3 144.0 46.7 145.0 47.2C146.0 47.7 146.1 49.2 147.4 49.2ZM141.5 50.7C143.2 50.6 144.7 51.0 146.5 51.9C148.3 52.7 150.5 54.1 152.3 55.7C154.2 57.3 156.3 59.7 157.3 61.5C158.3 63.3 158.4 63.7 158.2 66.5C158.0 69.3 157.1 74.7 156.2 78.2C155.2 81.8 153.7 84.3 152.3 87.9C151.0 91.5 148.9 96.9 147.9 99.6C147.0 102.3 147.0 104.5 146.5 104.0C146.0 103.5 145.8 99.0 145.0 96.7C144.2 94.3 142.7 92.2 141.5 89.9C140.3 87.6 139.0 85.4 137.7 82.9C136.4 80.5 134.9 78.2 133.9 75.3C132.9 72.4 132.1 68.5 131.8 65.3C131.6 62.2 131.7 58.7 132.4 56.5C133.2 54.3 134.7 53.1 136.2 52.1C137.7 51.2 139.8 50.7 141.5 50.7Z" filter="url(#edge)"></path>
          <path class="head" data-head d="M147.4 49.2C148.6 49.3 150.0 47.9 152.3 47.5C154.6 47.1 158.1 46.9 161.1 46.9C164.2 46.9 167.9 47.5 170.8 47.5C173.7 47.5 175.9 47.2 178.7 46.9C181.5 46.5 184.7 45.8 187.5 45.4C190.3 45.0 192.8 44.6 195.4 44.5C198.0 44.4 200.6 44.5 203.0 44.8C205.5 45.1 208.1 45.8 210.1 46.3C212.0 46.8 214.1 47.4 214.7 48.0C215.4 48.7 214.6 49.0 213.9 50.1C213.1 51.2 211.0 53.2 210.1 54.8C209.1 56.3 208.4 57.7 208.0 59.5C207.6 61.2 207.4 63.0 207.4 65.3C207.4 67.6 207.6 70.2 208.0 73.2C208.4 76.3 209.1 80.1 210.1 83.5C211.0 86.9 212.5 90.1 213.9 93.8C215.2 97.4 217.0 101.6 218.3 105.5C219.5 109.4 220.5 113.3 221.2 117.2C221.9 121.1 222.4 125.0 222.7 128.9C222.9 132.8 223.1 136.7 222.7 140.6C222.2 144.5 221.2 148.4 219.7 152.3C218.3 156.2 216.1 160.9 213.9 164.1C211.7 167.2 209.0 169.4 206.5 171.4C204.1 173.3 202.4 174.6 199.2 175.8C196.0 177.0 191.4 178.1 187.5 178.7C183.6 179.3 179.4 179.4 175.8 179.3C172.1 179.2 168.2 178.7 165.5 177.8C162.8 177.0 161.9 176.6 159.7 174.3C157.5 172.0 154.3 167.7 152.3 164.1C150.4 160.4 149.2 156.2 147.9 152.3C146.7 148.4 145.8 144.5 145.0 140.6C144.3 136.7 143.6 132.8 143.6 128.9C143.6 125.0 144.5 120.5 145.0 117.2C145.5 113.9 146.7 111.9 146.5 109.3C146.2 106.7 144.7 104.1 143.6 101.7C142.4 99.2 141.1 96.8 139.7 94.6C138.4 92.5 137.0 90.9 135.6 88.8C134.3 86.7 133.1 84.5 131.8 82.0C130.6 79.6 129.2 76.7 128.3 74.1C127.4 71.5 127.0 69.1 126.6 66.5C126.2 63.9 125.8 60.9 126.0 58.6C126.1 56.3 126.7 54.3 127.4 52.7C128.2 51.1 129.0 49.9 130.4 48.9C131.7 47.9 133.8 47.3 135.6 46.9C137.5 46.4 139.6 46.2 141.2 46.3C142.8 46.3 144.0 46.7 145.0 47.2C146.0 47.7 146.1 49.2 147.4 49.2ZM141.5 50.7C143.2 50.6 144.7 51.0 146.5 51.9C148.3 52.7 150.5 54.1 152.3 55.7C154.2 57.3 156.3 59.7 157.3 61.5C158.3 63.3 158.4 63.7 158.2 66.5C158.0 69.3 157.1 74.7 156.2 78.2C155.2 81.8 153.7 84.3 152.3 87.9C151.0 91.5 148.9 96.9 147.9 99.6C147.0 102.3 147.0 104.5 146.5 104.0C146.0 103.5 145.8 99.0 145.0 96.7C144.2 94.3 142.7 92.2 141.5 89.9C140.3 87.6 139.0 85.4 137.7 82.9C136.4 80.5 134.9 78.2 133.9 75.3C132.9 72.4 132.1 68.5 131.8 65.3C131.6 62.2 131.7 58.7 132.4 56.5C133.2 54.3 134.7 53.1 136.2 52.1C137.7 51.2 139.8 50.7 141.5 50.7Z"></path>
        </svg>
        <figcaption class="shot__cap">
          <span class="pill"><span class="roll"><span class="roll__in" data-size>2.4 MB</span></span></span>
        </figcaption>
      </figure>

      <div class="actions">
        <div class="cut-wrap" data-wrap>
          <button class="cut" type="button" data-btn aria-live="polite">
            <span class="cut__ring" aria-hidden="true"><span class="cut__spin" data-spin></span></span>
            <span class="cut__face" aria-hidden="true"></span>
            <span class="cut__rim" data-rim aria-hidden="true"></span>
            <span class="cut__label">
              <svg class="ic" viewBox="0 0 24 24" aria-hidden="true" data-icon>
                <g class="ic__cut" data-ic-cut><path d="M7 4H5a1 1 0 0 0-1 1v2M17 4h2a1 1 0 0 1 1 1v2M7 20H5a1 1 0 0 1-1-1v-2M17 20h2a1 1 0 0 0 1-1v-2"></path><path d="M12 7.5l1.2 3.3 3.3 1.2-3.3 1.2L12 16.5l-1.2-3.3L7.5 12l3.3-1.2z"></path></g>
                <path class="ic__ok" data-ic-ok d="M5 12.5l4.2 4.2L19 7"></path>
              </svg>
              <span class="roll"><span class="roll__in" data-word>Remove background</span></span>
            </span>
          </button>
        </div>
        <button class="undo" type="button" data-undo aria-label="Undo">
          <svg viewBox="0 0 24 24" aria-hidden="true"><path d="M9 7L4.5 11.5 9 16"></path><path d="M5 11.5h9a5 5 0 0 1 0 10h-2"></path></svg>
        </button>
      </div>

      <p class="editor__hint"><span class="roll"><span class="roll__in" data-hint>1 credit · transparent PNG</span></span></p>
    </section>

    <svg class="pointer" viewBox="0 0 24 24" aria-hidden="true" data-pointer><path d="M5 3l14 8.2-6.2 1.4 3.6 6.8-2.6 1.4-3.6-6.8L5 18.6z"></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.

20 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 “Remove background 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

In the middle of an almost black background sits the card of Cutwell, an invented app that removes the background from photos: at the top its name and the file, “jug-studio.jpg”; below, a real photo: a white ceramic jug with a sprig of fern, on a pale table in front of a window with curtains, and in a corner the file size, 2.4 MB. Under the photo, the dark Remove background pill with an icon of corners and a blue sparkle, and beside it the round Undo, still off. The drawn pointer comes up from below, glides over the button and the border catches the light right where it passes; then it presses: the pill squashes and springs back, a blue and white light starts running round its border, the sparkle turns a quarter and the label rolls to Finding the edge. Meanwhile a thread of light leaves the rim of the jug and runs round it along its outline, with a brighter head and a blue halo; as soon as the thread closes the jug lifts slightly, the label becomes Removing and the room is wiped away from the jug out to the edges of the photo, with a soft front and a ring of light riding on it. What is left is the real jug, cut out with its handle, on the checkerboard of transparency. The thread fades into a highlight on the jug’s edge, and the jug settles onto a new shadow with a small bounce; the light on the button stops, the label rolls to Background removed and the tick draws itself, the file becomes “jug-studio.png”, the size rolls to 640 KB and below it reads Saved as a transparent PNG. The round Undo lights up with a small bounce. After a couple of seconds the pointer presses it: the room comes back from the edges to the jug, the new shadow goes, and everything is as it was. Then it starts again.

How it works

The outline is the thread

There is only one photo, used twice in the same SVG. The jug’s outline is a path traced by hand over the photo (the outer edge plus the hole of the handle, with clip-rule evenodd): it is the clipPath of the second copy of the photo, which becomes the cut-out jug, and the same path without a fill makes the thread of light, drawn with getTotalLength and a falling stroke-dashoffset.

The brighter head

A second copy of the path has a single dash, 22 units long, and its dashoffset follows the thread’s: it is the head running in front, thicker and brighter, with a blurred copy behind for the halo. No dots: it is a piece of the same thread.

The room wiped away

The first copy of the photo, the room, sits in a group with a mask: a white rectangle and a blurred black circle in the middle of the jug. GSAP grows the circle’s radius and the room disappears from the centre to the edges; a circle with the same radius, stroke only and blurred, makes the ring of light on the front. Underneath, the transparency grid is a repeating-conic-gradient.

The button at work

Inside the pill sits a square with a conic gradient that turns, clipped by the pill’s corners, and over it the dark face one pixel in from the edge: what stays visible is a thread of light running round. The hover rim is a radial gradient masked to a one-pixel ring, centred where the pointer is.

Values to change

NameFileDefaultWhat it changes
BRANDscript.jsCutwellThe name of the invented app that removes photo backgrounds.
LIGHTscript.js#9fd8ffThe colour of the thread of light, the running border and the ring that wipes the background away.
TRACEscript.js1.6The seconds the thread of light takes to run round the jug.
WIPEscript.js1.3The seconds the background takes to be wiped away, from the jug to the edges.
PRESS_SCALEscript.js0.955How much the button squashes when pressed.
HOLDscript.js2.4The seconds the photo stays cut out before the autopilot presses Undo.
PAUSEscript.js1.2The seconds the autopilot waits between one round and the next.

Try them in the Playground

When to use it

For an AI action on a photo that takes a couple of seconds: removing the background, cutting out a product for an online shop, clipping a portrait. The thread of light shows where the AI found the edge before it touches the photo, and Undo stays within reach.

On phones

The same animation: the card takes almost the whole width, the photo and the button are measured on the screen height too, and the photo is cropped to the centre without squashing the jug.

With reduced motion

No running thread, no ring and no spring: the room fades away, the new shadow appears, the labels change without rolling and the tick is already drawn; the drawn pointer stays hidden.

Pitfalls

  • The two copies of the photo and the path must share the same coordinates: the viewBox has the photo’s proportions (300 by 200 like 1024 by 683) and both images have the same position and preserveAspectRatio, otherwise the cut-out slides a few pixels off the jug and a rim of the room shows around it.
  • The hole of the handle goes in the same path as the outer edge, with clip-rule evenodd: with a clipPath without a hole, a piece of the window would stay inside the handle even after the cut-out.
  • The thread’s length must be taken with getTotalLength in the viewBox units: with preserveAspectRatio slice the drawing scales up, but the path and its dasharray scale together, so there is no need to measure again on resize.
  • The mask’s circle must be blurred with a filter inside the mask itself, not with CSS: that way the edge of the room going away is soft in the recorded video too.
  • The button squashes with GSAP on the wrapper and the light turns inside the button: one element for the scale, one for the rotation, otherwise one transform wipes out the other.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

Compressed with gzip, the three demo files weigh 8.3 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