Skip to content
animorio
IT
All components

Puzzle captcha

Sliders, Hover, SVGGSAP, CSS onlyMediumCompressed weight: Demo 6.9 KBGSAP 28 KBFreeDownload the zip

The captcha with a piece to fit: drag the handle, the piece lifts and slides over the picture; let go over its notch and it clicks in on a spring, a sheen crosses the picture and the track turns green. Dropped off target, it shakes its head and goes back.

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>
<!--
  "Puzzle captcha" 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>Puzzle captcha</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">
    <!-- a puzzle captcha: slide the handle, the loose piece travels over the picture; let go over its notch and it
         clicks in, a sheen crosses the picture and the track turns green. Miss, and it shakes its head and goes back -->
    <section class="cp" data-cp aria-label="Human check">
      <header class="cp__head">
        <span class="cp__title">Quick check</span>
        <button class="cp__new" type="button" data-new aria-label="New puzzle">
          <svg viewBox="0 0 20 20" aria-hidden="true"><path d="M15.600 10a5.600 5.600 0 1 1-1.700-4"></path><path d="M14.400 3v3.200h-3.200"></path></svg>
        </button>
      </header>

      <div class="cp__art">
        <svg viewBox="0 0 288 132" data-art aria-hidden="true">
          <defs>
            <clipPath id="cp-clip"><path d="M0 8h13a7.600 7.600 0 1 1 14 0h13v13a7.600 7.600 0 1 1 0 14v13h-40Z"></path></clipPath>
            <filter id="cp-blur" x="-40%" y="-40%" width="180%" height="180%"><feGaussianBlur stdDeviation="17"></feGaussianBlur></filter>
            <filter id="cp-shadow" x="-50%" y="-50%" width="200%" height="200%"><feDropShadow dx="0" dy="3" stdDeviation="3.200" flood-color="#000000" flood-opacity="0.5" data-drop></feDropShadow></filter>
            <g id="cp-bg">
              <rect width="288" height="132" data-c0></rect>
              <g filter="url(#cp-blur)">
                <circle cx="52" cy="24" r="52" data-c1></circle>
                <circle cx="168" cy="120" r="58" data-c2></circle>
                <circle cx="262" cy="30" r="48" data-c3></circle>
                <circle cx="104" cy="92" r="30" data-c1 opacity="0.6"></circle>
              </g>
              <g class="cp__lines">
                <path d="M-10 96C40 60 90 120 150 84s96-64 150-28"></path>
                <path d="M-10 112C44 78 92 136 152 100s96-62 148-26"></path>
                <path d="M-10 80C38 44 88 104 148 68s98-66 152-30"></path>
                <path d="M-10 64C36 28 86 88 146 52s100-68 154-32"></path>
              </g>
            </g>
          </defs>
          <use href="#cp-bg"></use>
          <g data-hole>
            <path class="cp__hole" d="M0 8h13a7.600 7.600 0 1 1 14 0h13v13a7.600 7.600 0 1 1 0 14v13h-40Z"></path>
          </g>
          <g data-piece filter="url(#cp-shadow)">
            <g clip-path="url(#cp-clip)"><g data-inner><use href="#cp-bg"></use></g></g>
            <path class="cp__edge" data-edge d="M0 8h13a7.600 7.600 0 1 1 14 0h13v13a7.600 7.600 0 1 1 0 14v13h-40Z"></path>
          </g>
        </svg>
        <span class="cp__sheen" data-sheen aria-hidden="true"></span>
      </div>

      <div class="cp__track" data-track>
        <span class="cp__fill" data-fill aria-hidden="true"></span>
        <span class="cp__hint" aria-live="polite"><span data-hint>Slide to fit the piece</span></span>
        <span class="cp__knob" data-knob aria-hidden="true">
          <svg viewBox="0 0 20 20"><path class="cp__chev" data-chev d="M5.400 6 9.400 10l-4 4M10.600 6l4 4-4 4"></path><path class="cp__tick" data-tick pathLength="1" d="M5 10.400 8.600 14l6.600-7.800"></path></svg>
        </span>
        <input class="cp__range" type="range" min="0" max="1000" value="0" data-range aria-label="Slide the piece into place">
      </div>
      <p class="cp__foot">Protected by Gatekeep</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.

14 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 “Puzzle captcha” 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, a light card: at the top “Quick check” and the round button for another puzzle, in the middle an abstract picture (a dark ground, three blurred lights and four contour lines) with a notch shaped like a jigsaw piece and, on the left, the loose piece with its shadow; below, the track with the handle and the words “Slide to fit the piece”. Taking the handle, the piece lifts (it grows slightly and its shadow lengthens) and slides along with it, while the track fills and the words fade. Let go within a few pixels of the notch and it clicks into place on a spring, its edge disappears and the picture’s lines meet, a sheen crosses the picture, track and handle turn green, the arrows become a tick being drawn and the words roll to “Verified” with the time taken. Dropped off target, piece and handle shake their heads and go back to the start with “Not quite, try again”. The round button at the top spins and brings a new puzzle, with other colours and the notch elsewhere.

How it works

The piece is the picture, clipped

The picture lives in an SVG group used twice: once as the background, once inside the piece, clipped with a piece-shaped clipPath and shifted back by the notch’s distance. So with the piece in place the lines meet by themselves.

A real input underneath

The handle is an invisible range input from 0 to 1000: its value becomes a fraction that moves handle, fill and piece. Held, the piece rises to 1.06 and its shadow (feDropShadow) lengthens.

The click or the refusal

On release the position is compared with the notch’s: within TOLERANCE pixels the piece gets there with elastic.out in SNAP seconds and the --ok variable takes everything to green; otherwise four shakes of a few pixels and the way back with back.out.

Values to change

NameFileDefaultWhat it changes
ACCENTscript.js#17b26aThe colour of a passed check.
TARGETscript.js0.68Where the first puzzle’s notch sits, from 0.3 (left) to 1 (right).
TOLERANCEscript.js6How many pixels off you can be and still pass.
SNAPscript.js0.55How many seconds the piece’s click into the notch lasts.
HOLDscript.js2.6On its own: how many seconds it stays verified before the next puzzle.
LOOPscript.jstrueLeft alone, a pointer misses once and then gets it.

Try them in the Playground

When to use it

In front of a sign-in, a sign-up or a form submission, when bots must be stopped without making people read crooked letters: one gesture, by finger or mouse.

On phones

The same component: the picture scales with the width and never exceeds 40% of the height, the track is 46 pixels tall and is dragged by thumb without scrolling the page sideways.

With reduced motion

No lifting piece, spring, shakes or sheen: piece and handle follow the finger and the outcome changes at once.

Pitfalls

  • It is only the interface: a real captcha checks on the server, with a notch position the browser does not know and the trace of the drag. Here the notch lives in the script.
  • From the keyboard there is no “letting go”: with the arrows the check passes as soon as the piece is over the notch, and is never refused halfway.
  • A picture captcha shuts out people who cannot see: an alternative (an emailed code, a question) is always needed next to it.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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