Skip to content
animorio
IT
Back to the library

Prompt to chat transition

Transitions, TextGSAP, Canvas, CSS onlyAdvancedCompressed weight: Demo 13 KBGSAP 28 KBFreeDownload the zip

The home page transition of an AI assistant for developers, on a soft near black page with grain: in the middle the glass prompt field with its iridescent edge. Once the question is sent the field lifts off and glides down in a FLIP transition, where it becomes the input bar of a full page chat that opens out of the field itself; meanwhile a wave of light leaves the field and an iridescent aurora spreads until it fills the background, then quiets down. The question rises as the first message, ‘Thinking’ shimmers and the answer streams in word by word, with a paragraph, a short list and a code block. Home closes the chat back into the field.

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>
<!--
  "Prompt to chat transition" 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 prompt field to chat transition with the aurora</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>
  <main class="stage" data-stage>
    <!-- the light behind everything: a small canvas, blurred and blended, that the script draws around the prompt field -->
    <canvas class="aurora" data-aurora aria-hidden="true"></canvas>
    <span class="veil" aria-hidden="true"></span>

    <!-- the chat: a full page surface that opens out of the field (its clip follows the field while it flies) -->
    <section class="chat" data-chat aria-label="Chat with Nacre">
      <header class="chat__bar" data-bar>
        <button class="chat__back" type="button" data-back aria-label="Back to home">
          <svg viewBox="0 0 16 16" aria-hidden="true"><path d="M10 3.5L5.5 8l4.5 4.5"/></svg>
          <span>Home</span>
        </button>
        <p class="chat__title">Stale search results</p>
        <span class="chat__share">Share</span>
      </header>
      <div class="chat__view" data-view>
        <div class="chat__thread" data-thread>
          <div class="me" data-me><p class="me__text" data-me-text></p></div>
          <article class="ai" data-ai>
            <header class="ai__who">
              <span class="ai__mark" data-mark aria-hidden="true"><span class="ai__mark-face"></span></span>
              <span class="ai__name">Nacre</span>
              <span class="ai__think" data-think>Thinking</span>
            </header>
            <div class="answer" data-answer>
              <p data-block>The old request is still in flight when the query changes, so a slow response can land last and overwrite the fresh one. Give every request its own <code>AbortController</code> and cancel it when the effect cleans up.</p>
              <ul class="answer__list" data-block>
                <li><strong>Abort, don’t ignore.</strong> The browser drops the response, so nothing parses late.</li>
                <li><strong>Swallow the AbortError.</strong> It is expected, not a failure.</li>
                <li><strong>Keep the query in the deps,</strong> so each keystroke cleans up the last call.</li>
              </ul>
              <figure class="code" data-block>
                <figcaption class="code__head"><span>jsx</span><span class="code__copy"><svg viewBox="0 0 16 16" aria-hidden="true"><rect x="5.5" y="5.5" width="7" height="7" rx="1.6"/><path d="M10.5 3.5h-5a2 2 0 0 0-2 2v5"/></svg>Copy</span></figcaption>
<pre class="code__body"><span class="k">useEffect</span>(() =&gt; {
  <span class="k">const</span> ctrl = <span class="k">new</span> <span class="f">AbortController</span>();
  <span class="f">fetch</span>(<span class="f">url</span>(query), { signal: ctrl.signal })
    .<span class="f">then</span>((r) =&gt; r.<span class="f">json</span>())
    .<span class="f">then</span>(setResults)
    .<span class="f">catch</span>(() =&gt; {});
  <span class="k">return</span> () =&gt; ctrl.<span class="f">abort</span>();
}, [query]);</pre>
              </figure>
              <p data-block>The same pattern works for any effect that loads data.</p>
            </div>
            <div class="ai__tools" data-tools aria-hidden="true">
              <span class="tool"><svg viewBox="0 0 16 16"><rect x="5.5" y="5.5" width="7" height="7" rx="1.6"/><path d="M10.5 3.5h-5a2 2 0 0 0-2 2v5"/></svg></span>
              <span class="tool"><svg viewBox="0 0 16 16"><path d="M12.8 6.2A5 5 0 1 0 13 9.6"/><path d="M13.2 3.2v3.2H10"/></svg></span>
              <span class="tool"><svg viewBox="0 0 16 16"><path d="M5 7.2V13H3.4V7.2zM5 7.2l2.6-4.1c.9 0 1.5.7 1.3 1.6L8.5 6.6h3.4c.8 0 1.4.8 1.2 1.6l-1 3.8c-.2.6-.7 1-1.3 1H5"/></svg></span>
              <span class="ai__meta">2.1 s, 112 tokens</span>
            </div>
          </article>
        </div>
      </div>
      <div class="chat__dock" data-dock aria-hidden="true"></div>
      <p class="chat__fine">Nacre can make mistakes. Check code before you ship it.</p>
    </section>

    <!-- the home of Nacre, a made-up AI assistant for developers -->
    <section class="home" data-home>
      <nav class="nav" data-out>
        <span class="nav__brand"><span class="nav__mark" aria-hidden="true"><span class="ai__mark-face"></span></span>Nacre</span>
        <span class="nav__links"><span>Research</span><span>Pricing</span><span>Docs</span></span>
        <span class="nav__in">Sign in</span>
      </nav>
      <div class="hero">
        <p class="hero__tag" data-out>Nacre 2 now runs your code</p>
        <h1 class="hero__title" data-out>What should we<br>figure out today?</h1>
        <div class="hero__slot" data-slot aria-hidden="true"></div>
        <div class="chips" data-out>
          <button class="chip" type="button" data-chip>Explain a stack trace</button>
          <button class="chip" type="button" data-chip>Draft a SQL query</button>
          <button class="chip chip--wide" type="button" data-chip>Review my hook</button>
        </div>
      </div>
    </section>

    <!-- the prompt field: one element, placed by the script between the slot in the hero and the dock of the chat -->
    <form class="prompt" data-prompt autocomplete="off">
      <div class="prompt__glass" data-glass>
        <span class="prompt__rim" data-rim aria-hidden="true"></span>
        <div class="prompt__field">
          <p class="prompt__mirror" aria-hidden="true"><span data-mirror></span><span class="prompt__caret" data-caret></span></p>
          <span class="prompt__ph" data-ph aria-hidden="true">Ask Nacre anything</span>
          <textarea class="prompt__input" data-input rows="2" aria-label="Ask Nacre anything" spellcheck="false"></textarea>
        </div>
        <div class="prompt__tools">
          <span class="prompt__icon" aria-hidden="true"><svg viewBox="0 0 16 16"><path d="M10.6 5.2L6 9.8a1.3 1.3 0 0 0 1.8 1.8l5-5a2.6 2.6 0 0 0-3.7-3.7L4 8a3.9 3.9 0 0 0 5.5 5.5L13 10"/></svg></span>
          <span class="prompt__model" aria-hidden="true">Nacre 2<svg viewBox="0 0 16 16"><path d="M4.5 6.5L8 10l3.5-3.5"/></svg></span>
          <span class="prompt__search" aria-hidden="true"><svg viewBox="0 0 16 16"><circle cx="8" cy="8" r="5.5"/><path d="M2.5 8h11M8 2.5c1.6 1.6 2.3 3.5 2.3 5.5S9.6 11.9 8 13.5M8 2.5C6.4 4.1 5.7 6 5.7 8s.7 3.9 2.3 5.5"/></svg>Search</span>
          <button class="prompt__send" type="submit" data-send aria-label="Send">
            <span class="prompt__send-face" data-send-face><svg viewBox="0 0 16 16" aria-hidden="true"><path d="M8 12.5v-9M4.2 7.2L8 3.4l3.8 3.8"/></svg></span>
          </button>
        </div>
      </div>
    </form>

    <span class="grain" aria-hidden="true"></span>
    <p class="sr" aria-live="polite" data-live></p>
  </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.

78 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 “Prompt to chat transition” 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 near black page, with a faint light falling from the top, a soft vignette and grain, the home of Nacre opens, an invented AI assistant for developers: at the top the mark, a mother of pearl ring that turns slowly, ‘Research’, ‘Pricing’, ‘Docs’ and ‘Sign in’; in the middle the ‘Nacre 2 now runs your code’ pill, the heading ‘What should we figure out today?’ and the prompt field, in frosted glass, with a highlight on its top edge, a layered shadow and a one pixel iridescent edge (violet, cyan, amber, rose) that turns slowly. Inside: ‘Ask Nacre anything’, the paperclip, the ‘Nacre 2’ model pill, ‘Search’ and the round send button; below, three suggestions. Behind the field a halo of light sleeps. The caret blinks and the question ‘Why does my React search show stale results?’ types itself letter by letter; the send button turns white with a violet glow. Sent: the button gives and comes back with a bounce, the edge lights up, the words rise away blurring, the heading and the suggestions step back upwards into the haze. The field lifts off the page (it rises a few pixels, grows a touch) and flies down on a curve that is slow at the start and at the end, to its place as the chat bar; the full page chat opens out of the field itself, as if the field's rectangle widened to the edges. Meanwhile a wave of light with turning colour leaves the field and the aurora spreads: six clouds of violet, cyan, rose and amber light swell and drift apart until they fill the whole background, then they quiet down and keep moving slowly behind the text. The question rises as the first message in a glass bubble, with a small bounce; below it Nacre appears, its ring starts spinning fast and ‘Thinking’ shimmers with a band of light. Then the answer streams in word by word, each word settling out of a small blur: a paragraph about the problem, a list of three points with bold openings and a thin line on the left, a dark JSX code block with the ‘jsx’ and ‘Copy’ header, function names in cyan and keywords in violet, which comes in twice as fast, and a closing line. The chat scrolls itself to keep the last line in view. At the end copy, regenerate, the thumb and ‘2.1 s, 112 tokens’ appear. After a while Home is pressed: the thread fades upwards, the chat closes back into the field, the field returns to the middle with a small flash on its edge as it lands, the aurora withdraws into the halo and the home comes back. Then the loop starts again. It also works by hand: type into the field and press Enter, pick a suggestion, ask a follow up in the chat or go back Home.

How it works

One field, between two empty places

The prompt field is a single element, on top of everything. In the home there is an empty place as big as it is (the hero slot), at the bottom of the chat another one (the dock). On every frame the script reads the two rectangles and places the field between the first and the last by a number from 0 to 1 that GSAP moves with expo.inOut: it is a FLIP measured again and again, so the field lands in the right place even if the window changes size mid flight.

The chat opens out of the field

The chat is a full page surface with an inset clip-path: its four margins start from the field's own, read in the same frame while it flies, and fall to zero, with the corner radius going from 22 to 0. So the field's rectangle seems to widen to the edges, and the bar at the bottom seems to have been the field all along.

The aurora on a small canvas

The light is a 2D canvas five times smaller than the page, blurred by the CSS and blended in screen: six radial gradients stretched sideways, in lighter blending, turn around the centre of the field. Two numbers drive them: burst (how far they drift and how big they grow, from a tight halo to the whole page) and energy (how bright they are). Sending takes energy to 1.2 and burst to 1 with expo.out, then lets them fall back to 0.5 and 0.62: that is the aurora quieting down. The wave is a rounded rectangle that widens with a conic gradient.

Word by word

At start the script cuts the answer into words, each in a span: in the code the spaces and line breaks stay real. A counter goes from zero to the number of words at a constant speed (code words count as half, so the code runs twice as fast) and each word it reaches settles out of a 4 pixel blur. Each block starts hidden and appears when its first word arrives, and the thread scrolls itself towards the last line on a soft spring.

The edge and the details

The iridescent edge is a conic gradient inside a one pixel mask, turned by the --a variable; when sending and when landing it lights up with flare. The field's text is a mirror over a transparent textarea, with a drawn caret; ‘Thinking’ is text with a moving gradient background. The automatic walk is a single GSAP timeline that starts from the load event; as soon as someone touches the field, a suggestion or Home, the walk stops and the page stays in their hands.

Values to change

NameFileDefaultWhat it changes
TYPE_SPEEDscript.js24How many letters per second while the question is typed.
WORD_SPEEDscript.js24How many words per second the answer streams.
FLIGHTscript.js1.15How long the field's flight between the middle and the bottom lasts, in seconds.
AURORAscript.js1How bright the aurora is.
SPREADscript.js1How far the aurora spreads when the question is sent.
SHIFTscript.js1How fast the colours of the aurora and of the edge drift.
READscript.js2.8How many seconds the finished answer stays before going Home on its own.
GRAINscript.js0.07How strong the grain is.
SPEEDscript.js12 = the walk on its own twice as fast, 0.5 = half.
LOOPscript.jstrueRepeats the walk: type, send, read and go back Home.

Try them in the Playground

When to use it

For the home or the landing page of an AI product (an assistant, a coding copilot, a search engine that answers, a help centre that talks back): wherever the first screen already is the question field and the conversation has to grow out of it without a page jump. The colours are --violet, --cyan, --rose, --amber and --page in the CSS; the answer is plain HTML in the file and the script cuts it up by itself.

On phones

The same transition at adapted sizes: the field is as wide as the window minus the margins and as tall as the height allows, the heading, the answer and the code are measured on width and height, and the code is written short so it fits; on narrow screens the menu links, the third suggestion, ‘Search’ and ‘Share’ go, on short ones the pill at the top and the line at the bottom. The chat scrolls itself to keep the last line in view. With a finger you tap the field, type and send.

With reduced motion

No movement: the field fades out in the middle and back in at the bottom, the chat fades in without opening out of the field, the aurora brightens without spreading and without the wave, the question, the words of the answer and the home come and go only by fading, without blur; the caret does not blink and the colours stay still.

Pitfalls

  • With a classic FLIP (measure before, measure after, animate the difference) the window only has to change height mid flight for the field to land out of place: here the two places are read again on every frame and the field is put between them, so the landing is always right.
  • Words hidden with opacity already take up their space: if the thread scrolled over the whole answer an empty hole would show at the bottom. So every block starts hidden and shows when its first word arrives, and the scroll follows the real height.
  • A full page canvas with big gradients is expensive on every frame: drawn five times smaller and blurred by the CSS it gives the same soft aurora for much less.
  • In a repeating timeline, a fromTo for the way back built after the one for the way there writes its start values immediately and the field jumps to the bottom before it ever leaves: the way back uses plain to tweens, and the wave has immediateRender: false.

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 13 KB; the libraries: GSAP 28 KB.

Testing

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