Skip to content
animorio
IT
Back to the library

Contract signature

SVG, TextGSAP, CSS onlyMediumCompressed weight: Demo 8.1 KBGSAP 28 KBFreeDownload the zip

A contract to sign online, in the clean style of today’s apps: a blue flag leads from field to field, the pen writes the initials and the cursive signature stroke by stroke, with its pauses and the ink pooling at the end of each stroke, the date types itself, the count goes up and Finish closes the agreement with a check.

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>
<!--
  "Contract signature" 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 signature that writes itself on the contract</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>
    <!-- a contract to sign online: a Sign flag leads from field to field (initials, signature, date), each field fills
         itself in, the counter rolls, and Finish closes the agreement -->
    <div class="fit" data-fit>
      <header class="top">
        <span class="brand"><span class="brand__mark" aria-hidden="true">F</span><span data-brand>Fenmoor Studio</span></span>
        <span class="count" aria-live="polite"><span class="count__win"><span class="count__num" data-count>0</span></span> of 3 signed</span>
      </header>

      <article class="paper" data-paper aria-label="Design services agreement">
        <h1 class="paper__title">Design Services Agreement</h1>
        <p class="paper__meta">Between Fenmoor Studio and <span data-client>Ada Harrowby</span></p>
        <div class="lines" aria-hidden="true">
          <span style="width:96%"></span><span style="width:88%"></span><span style="width:92%"></span><span style="width:54%"></span>
        </div>
        <div class="clause">
          <div class="lines lines--short" aria-hidden="true">
            <span style="width:94%"></span><span style="width:80%"></span><span style="width:62%"></span>
          </div>
          <button class="field field--initials" type="button" data-field="initials" aria-label="Initial here">
            <span class="field__label">Initials</span>
            <svg class="ink ink--initials" viewBox="0 0 48 36" aria-hidden="true" data-ink="initials">
              <path d="M5 31 C9 20, 13 9, 16 5 C18 14, 20 23, 22 31"/>
              <path d="M9 21 C15 18, 22 18, 27 19"/>
              <path d="M29 5 C28 14, 27 23, 26 31"/>
              <path d="M27 19 C32 17, 37 16, 41 15 C40 21, 39 26, 38 31"/>
            </svg>
          </button>
        </div>
        <div class="lines" aria-hidden="true">
          <span style="width:90%"></span><span style="width:70%"></span>
        </div>

        <div class="signrow">
          <button class="field field--sign" type="button" data-field="sign" aria-label="Sign here">
            <svg class="ink ink--sign" viewBox="0 0 300 80" aria-hidden="true" data-ink="sign">
              <path d="M16 63 C25 41, 34 19, 42 11 C46 30, 50 48, 56 63"/>
              <path d="M30 44 C44 40, 58 42, 66 46 C60 40, 54 50, 62 54 C70 56, 72 44, 76 30 C74 46, 74 56, 82 54 C86 52, 88 46, 92 44 C86 44, 84 54, 92 55 C98 56, 100 48, 104 46"/>
              <path d="M122 16 C120 34, 118 50, 116 64"/>
              <path d="M136 14 C134 34, 132 50, 130 64"/>
              <path d="M110 42 C124 39, 140 40, 150 42 C156 44, 152 54, 158 54 C164 54, 166 44, 168 42 C168 50, 170 56, 174 50 C178 44, 182 42, 186 44 C184 50, 186 56, 192 50 C196 44, 200 42, 204 44 C198 46, 198 56, 206 55 C214 54, 214 44, 208 44 C216 44, 220 50, 222 54 C226 46, 228 42, 232 44 C234 50, 236 54, 240 50 C244 30, 248 16, 252 12 C250 30, 248 46, 250 56 C254 60, 262 52, 258 46 C262 50, 266 56, 272 52 C274 46, 276 42, 278 44 C276 54, 272 66, 266 74 C262 78, 258 74, 264 66 C272 58, 282 52, 292 50"/>
              <path d="M58 71 C120 65, 200 63, 288 67"/>
              <path class="dot" d="M286 30 L286.4 30.3"/>
            </svg>
            <span class="field__rule" aria-hidden="true"><span class="field__glow" data-glow="sign"></span></span>
            <span class="field__label">Signature</span>
          </button>
          <button class="field field--date" type="button" data-field="date" aria-label="Add the date">
            <span class="date" data-date></span><span class="caret" data-caret aria-hidden="true"></span>
            <span class="field__rule" aria-hidden="true"><span class="field__glow" data-glow="date"></span></span>
            <span class="field__label">Date</span>
          </button>
        </div>

        <svg class="pen" viewBox="0 0 40 40" aria-hidden="true" data-pen>
          <path class="pen__body" d="M6 34 L9 25 L29 5 C31 3 34 3 36 5 C38 7 38 10 36 12 L16 32 Z"/>
          <path class="pen__nib" d="M6 34 L9 25 L16 32 Z"/>
          <path class="pen__shine" d="M13 23 L30 6"/>
        </svg>
      </article>

      <div class="flag" data-flag aria-hidden="true">
        <span class="flag__word" data-flag-word>Sign</span>
        <svg viewBox="0 0 16 16"><path d="M5 3l5 5-5 5"/></svg>
      </div>

      <footer class="foot">
        <button class="finish" type="button" data-finish disabled>
          <span class="finish__fill" data-finish-fill></span>
          <span class="finish__a" data-finish-a>Finish</span>
          <span class="finish__b" data-finish-b>
            <svg viewBox="0 0 16 16" aria-hidden="true"><path data-check d="M3.5 8.4l3 3 6-6.6"/></svg>
            <span>Signed · 18:04</span>
          </span>
        </button>
        <button class="replay" type="button" data-replay>
          <svg viewBox="0 0 16 16" aria-hidden="true"><path d="M3.2 8a4.8 4.8 0 1 0 1.5-3.5M3 2.8v2.6h2.6"/></svg>
          Replay
        </button>
      </footer>
    </div>

    <svg class="cursor" data-cursor viewBox="0 0 24 24" aria-hidden="true"><path d="M5 2.8v16.4l4.2-4 2.8 6.2 2.9-1.3-2.8-6.1h5.9Z"/></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.

28 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 “Contract signature” 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 warm white background there is the contract of Fenmoor Studio, a made-up design studio: at the top the mark and the count «0 of 3 signed», then the white sheet with the title Design Services Agreement, the client’s name, Ada Harrowby, and the grey lines of the text. A blue flag with an arrow sticks out of the sheet’s left edge, pointing at the field to fill. The first is the dashed initials box, which lights up blue: tapped, a drawn pen comes down, writes the initials stroke by stroke and lifts again; at the end of each stroke the ink leaves a small darker drop, where the pen stops. The count rolls to 1 and the flag springs down to the signature line, which lights up with a blue line: the pen writes the cursive signature, fast on the long strokes and pausing a moment between letters, then the flourish underneath and the dot. The flag moves to the date, which types itself letter by letter with a thin caret, and finally drops to Finish, which turns from grey to black. Pressed, the button sinks, fills with blue from the left and becomes «Signed · 18:04» with the check drawing itself, the sheet gives a little hop and Replay appears. A drawn pointer does it all by itself and after a pause the contract goes blank and starts again; you can also really sign it, tapping the fields in order.

How it works

The hidden stroke

Every stroke of the signature and the initials is an SVG path whose stroke-dasharray is as long as the path and whose stroke-dashoffset equals its length, read with getTotalLength: so it starts invisible. A tween on a number from 0 to the length lowers the offset and reveals the stroke.

The pen on the tip

On every update getPointAtLength gives the point reached, getScreenCTM turns it into screen pixels and the container’s scale brings it back into the sheet’s pixels: the tip of the drawn pen goes there. Between strokes the pen lifts four pixels, flies to the start of the next one and comes down again.

The speed of the hand

Each stroke lasts its length divided by SPEED, with power1.inOut: long strokes run, short ones are brief, and each slows down at the start and at the end. Between strokes there is a pause of PAUSE seconds, and at the end of each stroke a small dark circle grows with back.out: the ink pooling where the pen slows down.

The guiding flag

The flag is a single element: GSAP carries it to the height of the next field, read with getBoundingClientRect and divided by the scale, with back.out; meanwhile it tucks in eight pixels, changes word and comes back out with an elastic. The active field lights up: the initials box with a blue border, the signature line with a line growing with scaleX.

Finish

Once the three fields are filled Finish wakes up. Pressed, it sinks and comes back with an elastic, a blue fill grows from the left with scaleX, Finish rises away, «Signed · 18:04» comes in from below with back.out and the check draws itself with the same trick as the strokes.

Values to change

NameFileDefaultWhat it changes
CLIENTscript.js'Ada Harrowby'The made-up client’s name, written under the contract’s title.
ACCENTscript.js'#2f55e4'The colour of the flag, the active field and the signed button.
SPEEDscript.js230How fast the pen runs, in drawing points per second.
PAUSEscript.js0.16The seconds the pen rests between one stroke and the next.
TYPEscript.js0.07The seconds per letter as the date types itself.
HOLDscript.js2.6The seconds the contract stays signed before it starts again.

Try them in the Playground

When to use it

For an e-signature app, for a quote page to accept or for the last step of a subscription: the flag says where to sign, and the signature writing itself makes a digital gesture feel human.

On phones

The same animation: the contract is drawn in its own pixels and the wrapper scales it to the box’s width and height, so the sheet, the flag and the button stay whole; the fields are tapped with a finger.

With reduced motion

No pen, no flight of the flag and no rolling: the contract appears already signed with a fade, with the initials, the signature, the date and the «Signed · 18:04» button.

Pitfalls

  • The wrapper is scaled to fit the box: the points from getPointAtLength and getBoundingClientRect are in screen pixels and must be divided by the scale, or the pen and the flag end up in the wrong place.
  • The dasharray is «length length+2» rather than just the length: with round caps, a dash equal to the stroke sometimes left a speck at the start of the stroke after the reset.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

Tested on 27 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 animations