Skip to content
animorio
IT
Back to the library

Chat to document

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

An AI assistant’s page transition, in the style of product components on black: the chat answer holds a draft card; click it and the chat slides left and narrows into a column, the card grows into the document page, the headline writes itself letter by letter, sections, table and chart come in staggered and a border of light runs around it once. Back to chat makes the trip the other way.

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>
<!--
  "Chat to document" 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>Velloro, chat to document</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>
  <!-- the chat page of an invented AI assistant: the draft card in the answer opens into the document page, the chat
       slides left and narrows into a column; Back to chat makes the trip home -->
  <main class="palco">
    <section class="finestra" data-finestra aria-label="Velloro">

      <div class="chat" data-chat>
        <header class="chat-testa">
          <span class="globo" aria-hidden="true"></span>
          <div class="chat-nome">
            <strong>Velloro</strong>
            <span>Planning assistant</span>
          </div>
        </header>

        <div class="messaggi" data-messaggi>
          <p class="bolla bolla--io" data-msg>Can you turn last week’s notes into a launch plan for the Q4 release?</p>
          <div class="risposta" data-msg>
            <p class="risposta-testo">Here’s a first draft. I grouped the work into three phases and took the dates from your calendar.</p>
            <button class="scheda" type="button" data-scheda aria-label="Open the draft: Q4 launch plan">
              <span class="scheda-testa">
                <span class="icona-doc" aria-hidden="true">
                  <svg viewBox="0 0 20 20"><path d="M5.5 2.75h6.2l3.55 3.55v10.95H5.5z" /><path d="M11.5 2.9v3.6h3.6" /><path d="M8 10.25h5M8 13h3.6" /></svg>
                </span>
                <span class="scheda-titolo">
                  <strong>Draft: Q4 launch plan</strong>
                  <span>Doc · 3 sections · 2 min read</span>
                </span>
                <span class="apri" aria-hidden="true">
                  <span>Open</span>
                  <svg viewBox="0 0 16 16"><path d="M5.5 10.5 10.5 5.5M6.5 5.5h4v4" /></svg>
                </span>
              </span>
              <span class="scheda-righe">
                <span>Goal: 2,000 new teams by December 15.</span>
                <span>Beta for every workspace on November 3.</span>
                <span>Pricing page and emails ship together.</span>
              </span>
            </button>
            <p class="risposta-piede">Want me to add owners for each task?</p>
          </div>
        </div>

        <div class="scrivi" data-scrivi>
          <span class="scrivi-testo">Ask Velloro anything</span>
          <span class="invia" aria-hidden="true">
            <svg viewBox="0 0 16 16"><path d="M8 12.5v-9M4.5 7 8 3.5 11.5 7" /></svg>
          </span>
        </div>
      </div>

      <article class="doc" data-doc aria-hidden="true">
        <div class="doc-fondo" data-doc-fondo></div>
        <div class="raggio" data-raggio aria-hidden="true"></div>
        <div class="doc-corpo">
          <header class="doc-barra" data-entra>
            <button class="indietro" type="button" data-indietro>
              <svg viewBox="0 0 16 16" aria-hidden="true"><path d="M10 3.5 5.5 8l4.5 4.5" /></svg>
              <span>Back to chat</span>
            </button>
            <span class="bozza">Draft</span>
          </header>
          <h2 class="doc-titolo" data-titolo>Q4 launch plan</h2>
          <p class="doc-meta" data-entra>Edited just now by Velloro · 2 min read</p>

          <section class="sezione" data-entra>
            <h3>Goal</h3>
            <p>Bring 2,000 new teams onto the paid plan by December 15, without a discount.</p>
          </section>

          <section class="sezione" data-entra>
            <h3>Timeline</h3>
            <table class="tabella">
              <thead><tr><th>Phase</th><th>Owner</th><th>Date</th></tr></thead>
              <tbody>
                <tr data-fila><td>Private beta</td><td>Ines</td><td class="num">Oct 27</td></tr>
                <tr data-fila><td>Beta for all</td><td>Theo</td><td class="num">Nov 3</td></tr>
                <tr data-fila><td>Launch</td><td>Maya</td><td class="num">Nov 18</td></tr>
              </tbody>
            </table>
          </section>

          <section class="sezione sezione--grafico" data-entra>
            <h3>Forecast <span>new teams a week</span></h3>
            <div class="grafico" data-grafico></div>
          </section>
        </div>
      </article>

      <div class="volo" data-volo aria-hidden="true">
        <span class="volo-titolo">Draft: Q4 launch plan</span>
      </div>
    </section>

    <svg class="puntatore" data-puntatore viewBox="0 0 24 24" aria-hidden="true">
      <path d="M5 3.5v15.2l4.1-3.9 2.7 6.2 2.6-1.1-2.7-6.1 5.7-.3z" />
    </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.

51 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 “Chat to document” 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 an almost black background sits the window of Velloro, a planning assistant: at the top its name with a small orb of light, below the question in a bubble («Can you turn last week’s notes into a launch plan for the Q4 release?») and the answer, holding the card «Draft: Q4 launch plan»: a document icon, «Doc · 3 sections · 2 min read», three preview lines and the Open pill. At the bottom, the field to write in. On hover the card lightens and the Open arrow moves by a pixel. Click it and the card lifts off and flies, growing until it fills the right side of the window, while the chat slides left and narrows into a column a third wide. Once there, the card becomes the document page: the headline «Q4 launch plan» writes itself letter by letter with a small bounce, then come in one after the other the line saying who wrote it, the goal, the table of phases with rows sliding in from the left and the forecast chart with bars growing from the bottom, the last two lit in purple and teal; meanwhile a border of light runs once all around the document and fades. Back to chat makes the trip the other way: the document empties, the page becomes the card again and settles in the answer, the chat widens. A fake pointer opens the draft, hovers a table row and goes back to the chat.

How it works

Measure before and after

On click we measure where the card sits in the answer and where the document page will sit, with getBoundingClientRect relative to the window. That is FLIP: First, Last, Invert, Play.

A piece that flies

The card is not scaled: a separate div with the same background and border starts at its position and size, and GSAP animates its x, y, width, height and radius to the document’s, on expo.inOut. That way the border stays one pixel and nothing stretches. Once there, the document’s real background takes its place.

The chat that narrows

At the same time the chat goes from the window’s width to COLONNA, and the messages wrap by themselves. On the phone the chat slides away completely and the document takes the whole window.

The document that writes itself

The headline is split into letters that come in 26 milliseconds apart with back.out; the sections come in staggered by SFALSA seconds, the table rows slide in from the left, the chart bars grow with scaleY from their bottom origin.

The border of light

It is a conic-gradient cut to one pixel with a mask (mask-composite: exclude): GSAP takes the --angolo variable the gradient starts from from 0 to 360 degrees in LUCE seconds, and the border fades at the end of the turn.

The way back

To know where the card will land, the chat is made wide for an instant, the card is measured and the chat is set narrow again, before anything is drawn: that way the flight back lands exactly in its place in the answer.

Values to change

NameFileDefaultWhat it changes
VOLOscript.js0.8How long the card’s trip to the document page lasts, in seconds.
RITORNOscript.js0.66How long the trip back lasts, in seconds.
COLONNAscript.js0.34How wide the chat stays with the document open (0.34 is a third of the window).
SFALSAscript.js0.07The delay between one part and the next of the incoming document, in seconds.
LUCEscript.js1.5How long the border of light takes to go around the document, in seconds.
SOSTAscript.js3.2How long the document stays open in the automatic tour, in seconds.

Try them in the Playground

When to use it

For an AI app that writes things you open: an assistant that drafts documents, plans, emails, code or tables. The transition keeps the conversation beside the result, so the reader never loses the thread between what they asked and what they got.

On phones

The same transition with sizes fitted to the box: the chat slides away completely and the document takes the whole window; on short screens the third table row and the byline hide, and the chart gets shorter. A tap opens the card like a click.

With reduced motion

No flight and no movement: the chat fades and comes back narrow, the document fades in already written, without the border of light; Back to chat does the same the other way.

Pitfalls

  • Scaling the card with a transform would also stretch the border and the text: better a separate piece animating width and height.
  • The card’s landing position changes with the chat’s width: it must be measured with the chat already wide, or the flight lands where the card sat in the narrow column.
  • The border of light needs mask-composite: exclude (and -webkit-mask-composite: xor for Safari), otherwise the gradient fills the whole document.

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 25 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