Skip to content
animorio
IT
Back to the library

Answer page transition

Transitions, HoverGSAP, CSS onlyMediumCompressed weight: Demo 12 KBGSAP 28 KBFreeDownload the zip

The page transition of a made-up AI search engine, Velin, on a warm paper ground: in the middle the white field with its soft shadow and a blue light behind it. The question is typed and Enter is pressed: the field rises and shrinks around the words, which grow into the title of the answer page, then the field’s shell dissolves. Below, the sources come in as four small cards that start from the middle and spread into a row on a staggered spring, each with its drawn favicon, domain and title; “Reading 4 sources” shimmers and the answer writes itself line by line. Every citation number pops into its line and a thin line hooks it to its card, which lights up and lifts by three pixels. Back plays the whole gesture in reverse.

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>
<!--
  "Answer page 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 question to answer page transition with the sources in a row</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>
    <!-- Velin, a made-up AI search engine. The question is typed in the field in the middle and sent with Enter:
         the field rises and shrinks into the title of the answer page, the sources come in as small cards that
         spread into a row on a staggered spring, and the answer writes itself line by line, each citation number
         hooking onto its card with a thin line. Back plays the whole gesture in reverse -->
    <span class="glow" data-glow aria-hidden="true"></span>

    <header class="brand" aria-label="Velin">
      <svg class="brand__mark" viewBox="0 0 20 20" aria-hidden="true">
        <path d="M3.2 4.5 10 16.2 16.8 4.5"/>
        <path class="brand__beam" d="M6.6 4.5 10 10.4 13.4 4.5"/>
      </svg>
      <span class="brand__name">Velin</span>
    </header>

    <section class="home" data-home>
      <h1 class="home__head" data-out>Ask anything. <span>See where it comes from.</span></h1>
      <div class="home__slot" data-slot-home></div>
      <p class="home__hint" data-out>Press <kbd data-kbd>Enter</kbd> to search 2.4 billion pages</p>
    </section>

    <section class="page" data-page aria-label="Answer">
      <div class="page__col" data-col>
        <button class="back" type="button" data-back>
          <svg viewBox="0 0 16 16" aria-hidden="true"><path d="M9.8 3.6 5.4 8l4.4 4.4"/></svg>
          <span>Back</span>
        </button>
        <div class="page__title-slot" data-slot-title></div>
        <p class="page__meta" data-meta>
          <span>Sources</span>
          <span class="page__meta-n">4 pages read in 0.8 s</span>
        </p>
        <ol class="sources" data-sources>
          <li class="source" data-source="1">
            <span class="source__top">
              <svg class="fav fav--a" viewBox="0 0 20 20" aria-hidden="true"><rect x="0.5" y="0.5" width="19" height="19" rx="5.5"/><path d="M6 7.2h8M6 10h8M7.5 12.8h5"/></svg>
              <span class="source__domain">kettleandbean.com</span>
              <span class="source__n">1</span>
            </span>
            <span class="source__title">Cold brew, measured: caffeine cup by cup</span>
          </li>
          <li class="source" data-source="2">
            <span class="source__top">
              <svg class="fav fav--b" viewBox="0 0 20 20" aria-hidden="true"><rect x="0.5" y="0.5" width="19" height="19" rx="5.5"/><circle cx="10" cy="10" r="4.2"/><path d="M10 5.8v8.4"/></svg>
              <span class="source__domain">baristahandbook.org</span>
              <span class="source__n">2</span>
            </span>
            <span class="source__title">Espresso ratios and what a shot holds</span>
          </li>
          <li class="source" data-source="3">
            <span class="source__top">
              <svg class="fav fav--c" viewBox="0 0 20 20" aria-hidden="true"><rect x="0.5" y="0.5" width="19" height="19" rx="5.5"/><path d="M5.6 13.6 10 6l4.4 7.6z"/></svg>
              <span class="source__domain">groundsquarterly.com</span>
              <span class="source__n">3</span>
            </span>
            <span class="source__title">Why the big cup is the strong one</span>
          </li>
          <li class="source" data-source="4">
            <span class="source__top">
              <svg class="fav fav--d" viewBox="0 0 20 20" aria-hidden="true"><rect x="0.5" y="0.5" width="19" height="19" rx="5.5"/><path d="M5.4 11.6c1.5-2.6 3-2.6 4.6 0s3.1 2.6 4.6 0"/><path d="M5.4 8.2c1.5-2.6 3-2.6 4.6 0s3.1 2.6 4.6 0"/></svg>
              <span class="source__domain">acidityreport.net</span>
              <span class="source__n">4</span>
            </span>
            <span class="source__title">Cold water and the acids it leaves behind</span>
          </li>
        </ol>
        <div class="status" data-status>
          <span class="status__reading" data-reading>Reading 4 sources</span>
          <span class="status__answer" data-answer-label>
            <svg viewBox="0 0 16 16" aria-hidden="true"><path d="M8 1.8c.5 3.3 2.9 5.7 6.2 6.2-3.3.5-5.7 2.9-6.2 6.2-.5-3.3-2.9-5.7-6.2-6.2 3.3-.5 5.7-2.9 6.2-6.2z"/></svg>
            Answer
          </span>
        </div>
        <p class="answer" data-answer>Shot for shot, espresso is stronger: about 63 mg of caffeine in a single 1 oz shot <b class="cite" data-cite="2">2</b>. A 16 oz cold brew carries 200 mg or more, so the whole cup usually wins <b class="cite" data-cite="1">1</b><b class="cite" data-cite="3">3</b>. It tastes milder because cold water pulls out fewer acids <b class="cite" data-cite="4">4</b>.</p>
        <p class="page__foot" data-foot>Answered in 1.2 s from 4 sources</p>
      </div>
    </section>

    <!-- the field that flies: its glass shell and the words, which become the title of the page -->
    <form class="ask" data-ask autocomplete="off">
      <div class="ask__shell" data-shell>
        <svg class="ask__lens" data-lens viewBox="0 0 16 16" aria-hidden="true"><circle cx="7" cy="7" r="4.4"/><path d="m10.3 10.3 3.2 3.2"/></svg>
        <input class="ask__input" data-input type="text" maxlength="48" aria-label="Ask Velin" spellcheck="false">
        <button class="ask__send" type="submit" data-send aria-label="Search">
          <span class="ask__send-face" data-send-face>
            <svg viewBox="0 0 16 16" aria-hidden="true"><path d="M8 12.6V3.6M4.2 7.2 8 3.4l3.8 3.8"/></svg>
          </span>
        </button>
      </div>
      <span class="ask__text" data-text aria-hidden="true"><span data-words></span><span class="ask__ph" data-ph>Ask anything</span><i class="ask__caret" data-caret></i></span>
    </form>
    <span class="measure" data-measure aria-hidden="true"></span>

    <svg class="hooks" data-hooks aria-hidden="true"></svg>

    <svg class="pointer" data-pointer viewBox="0 0 24 24" aria-hidden="true">
      <path d="M5.5 3.2v15.6l4.1-3.9 2.6 5.9 2.6-1.1-2.6-5.8h5.6z"/>
    </svg>
    <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.

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 “Answer page 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 warm paper ground with a light grain, at the top left the Velin mark, a V with a blue beam inside it. In the middle the heading “Ask anything. See where it comes from.”, below it the white pill field with the lens, the black button with the arrow and a blurred blue light behind, and the line “Press Enter” with a drawn key. The question “Is cold brew stronger than espresso?” types itself letter by letter with a blue caret; on Enter the button gives under the finger and comes back on an elastic, the Enter key dips by a pixel and the home heading rises into a blur. The field flies up: it shrinks until it hugs the question, the lens and the button withdraw, the words grow to the size of the page title and the shell dissolves; on arrival the title goes one pixel too far and settles. The light follows it and gets smaller. Meanwhile Back and the “Sources” line come in, and the four source cards start gathered towards the middle, small and lower, and spread into a row one after the other on a spring that passes its mark; the favicons pop in a moment later. “Reading 4 sources” shimmers, then makes room for “Answer” with its turning star, and the answer writes itself line by line, word by word out of a slight blur. Every citation number pops in with a small jump and from there a thin blue line draws itself to its card: the card’s number lights up blue, the card lifts three pixels and comes back on an elastic, the line fades. Hovering a number draws the line again and keeps it, and the card lights up; hovering a card lights its numbers. Back plays the gesture in reverse: the answer fades from the last word, the cards gather towards the middle and drop from the last one, the title flies back down and becomes the question in the field again. Left alone, the page types the question, sends it, reads, the pointer rests on a number and then presses Back.

How it works

Two empty slots and a flying field

The home has an empty slot as big as the field, the answer page an empty slot as tall as the title. The real field (shell and words) sits above everything, absolutely positioned, and on every frame it reads both slots with getBoundingClientRect and places itself between them by one number, fly, from 0 to 1: it lands right even if the window changes size mid flight.

The words are already the title

The question is written once, at the title’s size, and scaled down in the field: so the flight is just translate and scale, with no text reflow. Both sizes are measured on a hidden span at 100 px, and both shrink if the question does not fit on one line (on a phone the title stays on a single line).

The shell that shrinks and dissolves

The white shell goes from the field’s rectangle to the words’ rectangle plus a margin, so it hugs the question as it rises; the lens and the button withdraw in the first third of the flight, the shell fades in the last half. On arrival a 1.2 px tween and an elastic give the extra pixel and the settle.

Cards that open from the middle

Each card starts moved towards the middle of the row by half its distance (worked out with offsetLeft, which ignores transforms), lower and at 90%, and reaches its place with back.out and a 0.08 s stagger. Back does the same in reverse, from the last one, with power2.in.

The answer in real lines

The answer is split into words (the numbers stay whole) and the words are grouped by offsetTop: each group is a line as it really is at that width, and the lines come in one after the other. Every number has its own moment in the timeline.

The hook

An SVG as big as the page, under the text: from the number to the card a vertical Bézier curve is built, measured with getTotalLength and drawn with stroke-dashoffset. At the end the card takes the class that lights its number and jumps three pixels on an elastic; the line fades. Hovering uses the same function but keeps the line.

Values to change

NameFileDefaultWhat it changes
TYPE_SPEEDscript.js22Letters per second while the question types itself.
FLIGHTscript.js0.95Seconds of the field’s flight up into the title.
CARD_STAGGERscript.js0.08Seconds between one source card and the next.
CARD_SPRINGscript.js1.5How far the cards pass their place before they settle (0 = none).
LINE_STAGGERscript.js0.34Seconds between one line of the answer and the next.
HOOK_TIMEscript.js0.42Seconds the thin line takes to hook a number to its card.
READscript.js2.2Seconds the finished answer stays still before the walk on its own goes on.
SPEEDscript.js12 = the walk on its own twice as fast, 0.5 = half.
LOOPscript.jstrueTypes, sends and goes back again and again.

Try them in the Playground

When to use it

For an AI search engine or assistant that answers with its sources, a knowledge base, a product’s help centre, a search across a team’s documents. When the question should not vanish but become the title of the answer, and it should be clear at once where each sentence comes from.

On phones

The same gesture with adapted sizes: the title shrinks to stay on one line, the cards in the row show favicon, number and domain (the source title hides under 520 px), text sizes and gaps follow the height too. A tap on a number draws the hook and lights the card for a second and a half.

With reduced motion

No flight and no movement: the field fades and the question reappears already in place as the title, cards, lines and numbers fade in, the hooks are not drawn but the cards still light up. Back is the same fade in reverse.

Pitfalls

  • Animating font-size to grow the words reflows the text on every frame and the letters jitter: the words are set once at the title’s size and scaled down.
  • Moving the cards towards the middle needs their position without transforms: getBoundingClientRect counts the offset left over from the previous round, offsetLeft does not (and the row must be position: relative so offsetLeft starts from it).
  • The lines must be measured with the page laid out: with visibility: hidden the layout is there, with display: none every word would have offsetTop 0.
  • GSAP with an empty list (hooks already gone) warns “target not found”: check the length first.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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