Skip to content
animorio
IT
Back to the library

Fill-in-the-blank sentence

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

An exercise from a Spanish course: a large sentence with two gaps and four words to choose from below. The chosen word jumps into the waiting gap, which opens to its width; the wrong one shakes its head and goes home, the right one lands and gains weight. Once the sentence is whole a wave runs through it and the translation arrives.

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>
<!--
  "Fill-in-the-blank sentence" 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>Fill-in-the-blank sentence of a language course with the words that jump into the gaps</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">
    <!-- an exercise of a language course: a sentence with two gaps and a bank of words; a chosen word jumps into
         the next gap, which opens to its width; a wrong one shakes and goes home, the right ones gain weight -->
    <section class="fill" data-fill aria-label="Complete the sentence">
      <header class="fill__head">
        <span class="fill__topic">Spanish, the past tense</span>
        <span class="fill__dashes" data-dashes aria-hidden="true"><i class="is-full"></i><i class="is-full"></i><i></i><i></i></span>
      </header>

      <p class="sent" data-sent lang="es"></p>
      <p class="tr"><span data-tr></span></p>

      <div class="bank" data-bank></div>
      <p class="sr" data-live aria-live="polite"></p>
    </section>

    <svg class="ghost" data-ghost viewBox="0 0 24 24" aria-hidden="true"><path d="M5 3.2 19.2 11l-6.3 1.6-3.3 5.9Z"></path></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.

14 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 “Fill-in-the-blank sentence” 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 black, a dark card: at the top the topic and four progress dashes, then the Spanish sentence set large with two underlined gaps (the waiting one has an orange line), below it the translation with its blanks, and at the bottom four chips with the words. Choosing a chip, the word comes off, draws an arc and grows to the sentence’s size while the gap widens to make room with a small bounce; its empty seat stays in the bank. If it is wrong it turns red, shakes its head, goes back along the same arc and the chip bounces. If it is right it turns green, sinks a pixel and the type goes from weight 520 to 720. With both gaps full a wave runs through the words, the translation rolls to the whole one and a dash fills.

How it works

The word in flight

A copy with position: fixed leaves the chip’s rectangle and reaches the gap’s: x goes straight with power2.inOut, y rises by 16 pixels and comes down in two halves, and together they draw an arc. The scale goes from the chip’s size to the sentence’s.

The gap that makes room

Before the flight the gap takes its final width for an instant (so the landing place is read correctly even if the line wraps), then goes back to 46 pixels and widens with back.out while the word arrives.

Right or wrong

The right one animates font-weight up to HEAVY on Mona Sans’s variable axis. The wrong one makes five jolts in x, waits 0.28 seconds and leaves for its seat; only then can you choose again.

Values to change

NameFileDefaultWhat it changes
ACCENTscript.js#ff8a5cThe colour of the waiting gap and of the progress.
RIGHTscript.js#58d6a0The colour of the right word.
WRONGscript.js#ff5d6cThe colour of the wrong word.
FLYscript.js0.55How many seconds the word’s jump lasts.
HEAVYscript.js720The font weight the right word reaches.
HOLDscript.js2.8Alone: how many seconds the finished sentence stays before starting over.
LOOPscript.jstrueLeft alone, a pointer does the exercise (with one mistake).

Try them in the Playground

When to use it

On the page of a language course or an online school, as a demo of the method in a landing page’s hero, in a learning app. The sentence, the answers and the word bank sit in three lines at the top of the script.

On phones

The same card, as wide as the screen; the sentence drops to 22 pixels and wraps onto two lines, the chips sit on one or two rows. You tap the chip: no dragging.

With reduced motion

The words do not fly: they appear in the gap already in place. The wrong one stays red for a moment and disappears, the right one is bold at once, the translation changes without rolling.

Pitfalls

  • With zoom in the CSS the measures of getBoundingClientRect are in screen pixels: the gap’s width must be divided by the zoom, the flying copy (which lives in the body) must not.
  • While a word is flying or going home the other chips do not answer: two words flying to the same gap would leave it with the wrong width.
  • The demo never focuses anything by itself; the chips are real buttons and the outcome is also said in a line for screen readers.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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