Skip to content
animorio
IT
Back to the library

Form to thank-you

TransitionsGSAP, CSS onlyMediumCompressed weight: Demo 6.7 KBGSAP 28 KBFreeDownload the zip

The contact form of Fieldwork, a made-up studio: on «Send message» the message lines get shorter, the fields gather into one another from the bottom up, the last sheet folds in half into a small envelope drawn in hairlines that leaves on an arc with a one-pixel trail, and the thank-you page rises in its place with the name taken from the form. Minimal style, a single blue accent.

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>
<!--
  "Form to thank-you" 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>Form to thank-you</title>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/mona-sans@5.3.0/wdth.css">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/jetbrains-mono@5.3.0/index.css">
  <link rel="stylesheet" href="style.css">
</head>
<body>
  <!-- the contact form of an invented studio, Fieldwork. On «Send message» the fields gather into one another from the
       bottom up, the last sheet folds in half into a small envelope drawn in hairlines, the envelope leaves on an arc with
       a one-pixel trail, and the thank-you page rises in its place with the name taken from the form -->
  <main class="stage" data-stage>
    <span class="grain" aria-hidden="true"></span>

    <form class="card" data-card novalidate>
      <header class="card__head" data-head>
        <p class="eyebrow">Fieldwork Studio</p>
        <h1 class="card__title">Tell us about your project</h1>
      </header>

      <div class="field" data-field>
        <span class="field__label">Name</span>
        <span class="field__value" data-name data-value>Ada Moreno</span>
      </div>
      <div class="field" data-field>
        <span class="field__label">Email</span>
        <span class="field__value" data-value>ada@moreno.studio</span>
      </div>
      <div class="field field--message" data-field>
        <span class="field__label">Message</span>
        <span class="field__lines" data-lines>
          <span class="line" data-line>We are opening a small bakery in March</span>
          <span class="line" data-line>and need a site with the menu, the hours</span>
          <span class="line" data-line>and a way to order cakes ahead.</span>
        </span>
      </div>

      <button class="pill" type="submit" data-send><span class="pill__bg" aria-hidden="true"></span><span class="pill__label" data-label>Send message</span><span class="pill__work" aria-hidden="true" data-work></span></button>

      <span class="fold" aria-hidden="true" data-fold></span>
    </form>

    <svg class="envelope" data-envelope viewBox="0 0 132 88" aria-hidden="true">
      <rect class="envelope__body" x="0.75" y="0.75" width="130.5" height="86.5" rx="5" />
      <path class="envelope__flap" data-flap d="M2 3 L66 50 L130 3" pathLength="1" />
      <path class="envelope__fold" data-foldline d="M2 85 L52 40 M130 85 L80 40" pathLength="1" />
    </svg>

    <svg class="trail" data-trail aria-hidden="true"><path data-trail-path d="" pathLength="1" /></svg>

    <section class="thanks" data-thanks aria-live="polite">
      <p class="eyebrow" data-t>Message sent</p>
      <h2 class="thanks__title" data-t>Thanks, <span data-thanks-name>Ada</span>.</h2>
      <p class="thanks__lede" data-t>We’ll reply within a day.</p>
      <span class="thanks__rule" data-rule></span>
      <a class="back" href="#form" data-back data-t>Back to the site
        <svg viewBox="0 0 16 16" aria-hidden="true"><path d="M3 8h9M8.5 4.2 12.3 8l-3.8 3.8" /></svg></a>
    </section>
  </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.

33 values to change

Works with Claude, Claude Code, ChatGPT, Cursor, VS Code, Windsurf, Codex, Gemini CLI

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 “Form to thank-you” 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 warm paper, the contact form of a studio: the name, the email and three lines of message already written, and the blue «Send message» button. Pressed, the button gives and springs back, the label becomes «Sending» and a thin line runs under it. The message lines get shorter, the last one first; then the fields squeeze into a hairline and slide into one another, from the button up to the headline. The empty sheet shrinks to the size of an envelope, folds in half with a shadow crossing it and closes into an envelope drawn in hairlines, which leaves on an arc, turning a little and getting smaller, with a one-pixel blue trail behind. In its place «Thanks, Ada.» rises with the name taken from the field, «We’ll reply within a day», a blue rule draws itself and «Back to the site» brings the form back.

How it works

The form

A sheet with the headline, three fields and the button pill; the message is made of separate lines, so each can get shorter with a clipPath.

The gathering

From the button up to the headline, each piece fades its text, squeezes into a 2-pixel line in GATHER seconds and then goes to zero with a negative margin equal to the gap between fields: that is how it slides into the one above. GATHER_STAGGER seconds pass between pieces.

The fold

The empty sheet goes to the size of the envelope, 132 by 88, with back.out; then scaleY to 0.5 from the top while a shading crosses it. In its place the SVG envelope grows from the middle and the flap and fold lines draw themselves with strokeDashoffset.

The flight and the trail

A number p from 0 to 1 in FLIGHT seconds with power2.in moves the envelope on a quadratic curve measured on the page every frame, so it stays right after a resize. The trail is the same path in a full-page SVG, with a TRAIL-long dash following it.

The thanks

The words rise 18 pixels staggered with power3.out, the blue rule draws from the centre; the name comes from the first name typed in the field. «Back to the site» clears every style GSAP wrote and brings the form back.

Values to change

NameFileDefaultWhat it changes
GATHERscript.js0.32Seconds to squeeze each field into a line.
GATHER_STAGGERscript.js0.16Seconds between one field and the one above.
FLIGHTscript.js1.1Seconds of the envelope’s flight.
ARCscript.js0.7How high the envelope climbs, as a share of the page height.
TILTscript.js-16Degrees the envelope turns in flight.
TRAILscript.js0.14Length of the trail, as a share of the flight.
TYPE_SPEEDscript.js34Letters per second when the form fills itself in.
AUTO_PILOTscript.js1.2Seconds of stillness before the idle loop starts (0 never).

Try them in the Playground

When to use it

After sending a contact form, a quote request, a booking or a sign-up: on a portfolio, an agency, a landing page, a shop or a venue, instead of the usual «Sent» message.

On phones

The sheet is sized on the width and the type on the height, so the whole form fits the screen; the flight is computed on the real page, so the envelope always leaves through the top right.

With reduced motion

No gathering, fold or flight: the form fades out and the thanks fades in, with the rule already drawn.

Pitfalls

  • To slide a field into the one above you need a negative margin equal to the gap between fields, read from the CSS (rowGap): height zero alone leaves a hole.
  • Before shrinking the sheet to the envelope size its height must be fixed in pixels: GSAP will not tween from height auto to a number inside a timeline built in advance.
  • Going back to the form you must clear every style GSAP wrote (clearProps), or the fields stay 0 high.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0, JetBrains Mono (font variabile) 5.3.0.

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

Testing

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