Skip to content
animorio
IT
Back to the library

Answer with sources

Text, HoverGSAP, CSS onlyMediumCompressed weight: Demo 8.5 KBGSAP 28 KBFreeDownload the zip

The answer panel of a made-up AI research assistant, Quarry, on a near black page. While it searches, a beam of light runs round the panel's edge and the status pill says ‘Searching 4 sources’ with a shimmer; then the answer writes itself word by word, each new word arriving white, blurred and with a blue glow that cools into the ink, so the edge of the text carries a wave of light. Each citation number pops into the text on a short spring and lights up and lifts the card of its source below. Hovering a number marks the sentence it backs and widens its source while the others step back.

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 with sources" 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 assistant answer that writes itself with the sources lighting up</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>
    <!-- the answer panel of a made-up research assistant, Quarry. The answer writes itself word by word with a wave of
         light on the edge of the newest words; each citation pill lights up and lifts its source card below. Hovering a
         pill marks the sentence it backs and widens its source -->
    <section class="panel" data-panel aria-label="Quarry answer">
      <span class="panel__beam" data-beam aria-hidden="true"></span>
      <span class="panel__sheen" aria-hidden="true"></span>

      <header class="panel__head">
        <span class="brand">
          <svg class="brand__mark" viewBox="0 0 20 20" aria-hidden="true">
            <path d="M10 2.2l6.8 3.9v7.8L10 17.8l-6.8-3.9V6.1z" />
            <path class="brand__cut" d="M10 2.2v7.8l6.8 3.9" />
          </svg>
          <span class="brand__name">Quarry</span>
        </span>
        <span class="status" data-status>
          <svg class="status__icon" viewBox="0 0 16 16" aria-hidden="true">
            <circle class="status__track" cx="8" cy="8" r="6" />
            <circle class="status__arc" data-arc cx="8" cy="8" r="6" pathLength="1" />
            <path class="status__check" data-check pathLength="1" d="M4.8 8.3l2.2 2.2 4.3-4.6" />
          </svg>
          <span class="status__words">
            <span class="status__word status__word--search" data-search>Searching 4 sources</span>
            <span class="status__word status__word--ready" data-ready>Answer ready</span>
          </span>
          <span class="status__time" data-time>3.8s</span>
        </span>
      </header>

      <h1 class="query" data-query>Do houseplants really clean the air at home?</h1>

      <p class="answer" data-answer>
        <span class="sent" data-sent="1">Only a little. The well known 1989 tests sealed single plants in small chambers, a result that does not scale to a real room.</span><button class="cite" type="button" data-cite="1" aria-label="Source 1, fernstudy.org">1</button>
        <span class="sent" data-sent="2">A 2019 review worked out you would need 10 to 1,000 plants per square metre to match ordinary ventilation.</span><button class="cite" type="button" data-cite="2" aria-label="Source 2, atriumreview.net">2</button>
        <span class="sent" data-sent="3">Plants do lift humidity and mood,</span><button class="cite" type="button" data-cite="3" aria-label="Source 3, leafandmood.com">3</button>
        <span class="sent" data-sent="4">but an open window or a HEPA purifier cleans far more air.</span><button class="cite" type="button" data-cite="4" aria-label="Source 4, ventwell.guide">4</button>
      </p>

      <ul class="sources" data-sources aria-label="Sources">
        <li class="src" data-src="1" style="--tile: #4f8a68">
          <span class="src__lift" data-lift>
            <span class="src__glow" aria-hidden="true"></span>
            <span class="src__tile" aria-hidden="true">F</span>
            <span class="src__text">
              <span class="src__site">fernstudy.org</span>
              <span class="src__title">What the 1989 chamber tests measured</span>
            </span>
            <span class="src__num">1</span>
          </span>
        </li>
        <li class="src" data-src="2" style="--tile: #a9804a">
          <span class="src__lift" data-lift>
            <span class="src__glow" aria-hidden="true"></span>
            <span class="src__tile" aria-hidden="true">A</span>
            <span class="src__text">
              <span class="src__site">atriumreview.net</span>
              <span class="src__title">Plants against air exchange, a review</span>
            </span>
            <span class="src__num">2</span>
          </span>
        </li>
        <li class="src" data-src="3" style="--tile: #8c66b8">
          <span class="src__lift" data-lift>
            <span class="src__glow" aria-hidden="true"></span>
            <span class="src__tile" aria-hidden="true">L</span>
            <span class="src__text">
              <span class="src__site">leafandmood.com</span>
              <span class="src__title">Humidity, light and how a room feels</span>
            </span>
            <span class="src__num">3</span>
          </span>
        </li>
        <li class="src" data-src="4" style="--tile: #4b78b0">
          <span class="src__lift" data-lift>
            <span class="src__glow" aria-hidden="true"></span>
            <span class="src__tile" aria-hidden="true">V</span>
            <span class="src__text">
              <span class="src__site">ventwell.guide</span>
              <span class="src__title">Windows and purifiers, measured</span>
            </span>
            <span class="src__num">4</span>
          </span>
        </li>
      </ul>
    </section>

    <svg class="pointer" data-pointer viewBox="0 0 20 20" aria-hidden="true">
      <path d="M4.5 2.8l10.6 8.1-4.6.6 2.6 5.1-2.1 1-2.6-5.1-3.4 3.2z" />
    </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.

50 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 with sources” 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 blue haze at the top sits a dark panel with 20 pixel corners, a one pixel edge that catches the light on top and a wide soft shadow. At the top the Quarry mark (a hexagon with a blue cut) and a status pill with a spinning arc: ‘Searching 4 sources’, with a shimmer running through the words. Below, the question, ‘Do houseplants really clean the air at home?’. While Quarry searches, a blue and violet beam runs along the whole edge of the panel and the four source cards come in at the bottom one after the other, still dim: a coloured tile with an initial, the made-up domain and the title (fernstudy.org, atriumreview.net, leafandmood.com, ventwell.guide). Then the answer writes itself word by word, one every 55 thousandths and a little longer after commas and full stops: each word arrives white, blurred by 5 pixels, three pixels low, with a blue glow, and in eight tenths it settles and cools into the light grey of the ink, so the newest words make a wave of light on the edge of the text. After each sentence a citation number comes in as a small pill on a short spring, and meanwhile the card of its source lights up blue, rises six pixels and comes back to one pixel above its place with an elastic. The last word and its number never part at the end of a line. At the end the beam goes out, the arc becomes a drawn check, the words roll to ‘Answer ready’ and the time appears next to them. Hovering a number (or tapping it) marks the sentence it backs from the left with a soft blue band and turns it white, the number fills with blue, its card widens to three times the others showing its whole title and lifts, the others step back showing only their initial. Hovering a card does the same in reverse. Left alone, a pointer shows it by itself and then the answer is written again.

How it works

One word, one span

Each sentence is split into words, each in an inline-block span with the spaces kept as text, so lines wrap as before. The last word of each sentence and its number go into a span with white-space: nowrap: the number is never left alone at the start of a line. All the words are already in place, transparent: the panel doesn't change height while it writes.

The light wave

Each word has two tweens starting together: opacity, y and blur in 0.38 s, and colour and text-shadow from white with a blue glow to the ink in WAVE seconds, with power1.in. Since words start every WORD_GAP seconds, the last ten or fifteen are still warm: that overlap makes the wave, no mask.

The number and its source

The number comes in with scale from 0.3 to 1 and back.out(2.6); at the same moment the timeline calls light(n): the card's glow rises, the card goes up LIFT + 2 pixels with power3.out and comes back to one pixel above its place with elastic.out(1, 0.55), staying lit at 70 %.

Marking a citation

mark(n) does it all with overwriting tweens: the sentence background goes from background-size 0% to 100% (with box-decoration-break: clone the band follows the lines), the number fills, the marked card takes flex-grow to WIDEN and the others drop to 42 %. A container query hides the words of cards that are too narrow: the initial and the number stay.

The beam on the edge

A conic-gradient with the light in a single slice, masked with two linear-gradients and mask-composite: exclude to leave only a one pixel ring. GSAP turns the --a variable from 0 to 360 degrees in BEAM_TURN seconds, always; only its opacity changes while Quarry works.

Values to change

NameFileDefaultWhat it changes
WORD_GAPscript.js0.055Seconds between one word and the next.
WAVEscript.js0.8How long a new word keeps its light before it cools: higher, longer wave.
BLURscript.js5How blurred a word is when it arrives, in pixels.
SEARCH_FORscript.js1.7Seconds of searching before the first word.
LIFTscript.js4How many pixels a cited source card rises.
WIDENscript.js3How much wider the marked source grows than the others.
BEAM_TURNscript.js2.2Seconds for one run of the beam round the edge.
LOOPscript.jstrueLeft alone, it shows itself and writes the answer again.

Try them in the Playground

When to use it

For the answer of an AI assistant, an internal search, a help centre or a docs tool: wherever a generated answer must show where each sentence comes from, and the reader should be able to check a source without leaving the text.

On phones

The same animation with adapted sizes: the panel takes almost the whole width, question and answer scale with the screen's height, the source cards show initial and number when they are narrow. You tap the number with your finger: tap again, or outside, to clear the mark.

With reduced motion

No beam, no blur and no movement: the answer fades in all at once, the numbers and sources light up with a fade, the status turns to ‘Answer ready’. The sentence mark on hover stays, with no widening cards and no pointer.

Pitfalls

  • Writing the answer by adding text to the DOM makes the panel grow at every line: put all the words in at once, transparent, and only light them.
  • A number after a full stop wraps on its own and sits at the start of the next line: the last word and the number go in a span that doesn't break.
  • A sentence background spanning several lines with background-size draws one single band without box-decoration-break: clone.
  • Part of a text with background-clip: text inside a child span doesn't get the gradient: the shimmer goes on a single text element.
  • The pilot must not count as a user: the check is on event.isTrusted, and when a real pointer shows up the pilot stops and starts again only after five quiet seconds.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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