Skip to content
animorio
IT
Back to the library

Live translation card

Text, HoverGSAP, CSS onlyMediumCompressed weight: Demo 8.9 KBGSAP + Flip 37 KBFreeDownload the zip

The live translation card of Velino, a made-up travel translator, white on a warm page: the English sentence lights up word by word as it is heard, underneath the Italian first arrives in the English order, every grey word turning into its Italian one, then the words that sit elsewhere in Italian swap places on two small arcs. Thin threads join every word to its match: they cross where the order changes. Hovering a word lights it, its partner, the thread and a note on why it moved.

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>
<!--
  "Live translation card" 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 live translation card with the words that swap places</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 live translation card of Velino, a made-up travel translator. The English sentence lights up word by
         word as it is heard; underneath its Italian comes in first in the English order, every word turning into its
         translation, then the words that sit differently in Italian swap places on two small arcs. Thin threads join
         every word to its match; hovering a word lights its pair, its thread and a short note on why it moved -->
    <article class="tr" data-card>
      <span class="tr__sheen" aria-hidden="true" data-sheen></span>
      <header class="tr__head">
        <span class="tr__brand">
          <svg class="tr__mark" viewBox="0 0 20 20" aria-hidden="true">
            <path d="M3.5 5.5c2.2 0 3.4 1.2 4.2 3.4l2.3 6.6 2.3-6.6c.8-2.2 2-3.4 4.2-3.4"/>
            <path class="tr__mark-tick" d="M10 3.2v2.1"/>
          </svg>
          Velino
        </span>
        <span class="tr__pair">
          <span class="tr__lang" data-from>English</span>
          <button class="tr__swap" type="button" aria-label="Swap languages" data-swap>
            <svg viewBox="0 0 16 16" aria-hidden="true" data-swap-icon>
              <path d="M2.8 5.6h9.6M9.6 2.8l2.8 2.8-2.8 2.8"/>
              <path d="M13.2 10.4H3.6M6.4 7.6l-2.8 2.8 2.8 2.8"/>
            </svg>
          </button>
          <span class="tr__lang" data-to>Italian</span>
        </span>
      </header>

      <section class="tr__pane tr__pane--src">
        <span class="tr__label">
          <span data-state>Listening</span>
          <span class="tr__wave" aria-hidden="true" data-wave><i></i><i></i><i></i><i></i><i></i></span>
        </span>
        <p class="tr__line tr__line--src" data-src></p>
      </section>

      <div class="tr__seam" aria-hidden="true"></div>

      <section class="tr__pane tr__pane--out">
        <span class="tr__label">Italian</span>
        <p class="tr__line tr__line--out" data-out></p>
        <p class="tr__note" data-note aria-live="polite"></p>
      </section>

      <footer class="tr__foot">
        <span class="tr__conf">
          <span class="tr__meter" aria-hidden="true"><span class="tr__meter-fill" data-meter></span></span>
          <span class="tr__conf-num"><span data-conf>0</span>% match</span>
        </span>
        <span class="tr__tools">
          <button class="tr__tool" type="button" aria-label="Play the Italian" data-play>
            <svg viewBox="0 0 16 16" aria-hidden="true">
              <path d="M2.8 6.2h2.4L8.6 3.4v9.2L5.2 9.8H2.8z"/>
              <path class="tr__ray" d="M10.8 6.1c.7.6.7 3.2 0 3.8"/>
              <path class="tr__ray" d="M12.6 4.6c1.5 1.4 1.5 5.4 0 6.8"/>
            </svg>
          </button>
          <button class="tr__tool tr__tool--copy" type="button" aria-label="Copy the translation" data-copy>
            <svg viewBox="0 0 16 16" aria-hidden="true">
              <g data-copy-icon><rect x="5.2" y="5.2" width="7.6" height="7.6" rx="1.8"/><path d="M10.6 3.4H4.8a1.4 1.4 0 0 0-1.4 1.4v5.8"/></g>
              <path class="tr__tick" data-tick pathLength="1" d="M4.2 8.4l2.6 2.6 5-5.4"/>
            </svg>
          </button>
        </span>
      </footer>
      <svg class="tr__threads" aria-hidden="true" data-threads></svg>
    </article>
  </main>

  <script src="https://cdn.jsdelivr.net/npm/gsap@3.15.0/dist/gsap.min.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/gsap@3.15.0/dist/Flip.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.

24 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 “Live translation card” 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 paper coloured page a white card rises, round corners, a one pixel edge and three soft shadows. At the top the Velino mark and a small pill with English, the button that swaps the languages, Italian. Under the word Listening, with a wave of five blue bars beside it following the voice, the English sentence ‘I booked a quiet room’ lights up word by word: each word goes from grey to black, a touch wider, and settles. In the pane below, for each word heard, the same English word arrives in grey, and a thin thread runs down from each one to its copy. With Translating the grey words rise, narrowing and blurring away, and from below their Italian ones come in, widening and settling with a pixel of bounce: ‘Ho prenotato una tranquilla camera’, still in the English order, while the match counter climbs to 98%. Then ‘tranquilla’ and ‘camera’ swap places, one passing over and the other under, with a blue wash that fades as they land, and their two threads cross. The pair lights up in blue, the other words dim and underneath the note appears: tranquilla goes after camera, because adjectives follow the noun. Then the sentence leaves and ‘Your black coffee is ready’ arrives, with the button that speaks the Italian and the words lighting up one at a time, and ‘Tomorrow the green line is closed’, with the copy button turning into a checkmark. Hovering any word, above or below, lights it, its partner and their thread, with the note; the walk pauses while the pointer stays on the card, and the soft light under the card follows it.

How it works

Every sentence is a list of pairs

A sentence is a list of chunks [English, Italian] (a chunk can be two words, ‘is ready’ and ‘è pronto’), the Italian order as a list of indexes and the chunk to light with its note. Each chunk gets a word above, a word below and an SVG thread: all three share the same number.

Hearing and turning

The heard word goes from grey to black through the width of the variable typeface (wdth 86 to 100) and a back.out return. The word below leaves upwards narrowing to 72 and blurring, changes its text and comes back in from below from 125 to 100: at the change the outer box tweens from the old width to the new one, so the neighbours slide instead of jumping.

Swapping places

Flip.getState of every word, then appendChild in the Italian order, then Flip.from: the outer box slides to its new place. The inner child, which Flip leaves alone, makes the arc with GSAP keyframes: the one going right rises, the one going left dips, with a 1.05 scale halfway.

The threads, every frame

In the GSAP ticker every thread is redrawn as a Bézier curve from the bottom of the word above to the top of its partner below, measured with getBoundingClientRect and divided by the card's scale, so they follow the words while they move and cross by themselves where the order changes. pathLength 1 lets them draw in with stroke-dashoffset.

The pointer passing

Every word, above and below, on entering lights everything with its number (the two words, the thread, the two dots) and puts the is-focus class on the card, which dims the rest. Entering the card pauses the timeline, leaving it starts again after 0.9 s.

Values to change

NameFileDefaultWhat it changes
HEAR_STAGGERscript.js0.24Seconds between one English word heard and the next.
MORPH_TIMEscript.js0.5Seconds each word takes to turn Italian.
SWAP_TIMEscript.js0.95Seconds of the swap.
ARCscript.js0.55How high and low the arcs of the swap go, in lines of text.
HOLDscript.js1.9Seconds the lit pair and its note stay on.
THREADSscript.jstrueThe thin threads joining every word to its match.
SPEEDscript.js12 = the whole loop twice as fast, 0.5 = half.
LOOPscript.jstrueGoes on to the next sentence, again and again.

Try them in the Playground

When to use it

For a translation or language app, an AI service that translates live, the page of a language course, the section of a landing page that has to show at a glance what the product does.

On phones

The same animation with adapted sizes: the card is as wide as the box, text and gaps are sized on the height too, sentences wrap and the threads follow the words onto the second line; a finger taps a word to light its pair.

With reduced motion

Nothing moves: heard and translated words change with a fade, the Italian takes its order without sliding, the threads and the lit pair fade in.

Pitfalls

  • Flip and the arc keyframes must not sit on the same element: Flip's transform would wipe the arc's. Flip moves the outer box, the arc the child.
  • Changing a word's text makes the neighbours jump, and several Flips on the same words overlap: for the change a tween of the box width is enough, Flip only for the swap.
  • The thread measures must be divided by the card's scale: when the viewer shrinks the demo, getBoundingClientRect gives already scaled sizes and the threads would miss the words.

Libraries

GSAP 3.15.0, GSAP Flip 3.15.0, Mona Sans (font variabile) 5.3.0.

Compressed with gzip, the three demo files weigh 8.9 KB; the libraries: GSAP + Flip 37 KB.

Testing

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