Skip to content
animorio
IT
Back to the library

Typing speed test

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

The test screen of an app for learning to type, on black: the caret glides on a spring from letter to letter, right letters take ink and wrong ones turn red, words per minute count live with their curve and the run ends in a result. You can really type on it.

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>
<!--
  "Typing speed test" 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>Typing speed test</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">
    <!-- the test screen of a made-up typing app: the caret glides from letter to letter on a spring, right letters
         take ink and wrong ones turn red, words per minute count live with their curve, and the run ends in a result -->
    <section class="tt" data-tt aria-label="Typing speed test">
      <header class="tt__stats">
        <span class="tt__stat tt__stat--big"><b data-wpm>0</b><i>wpm</i></span>
        <span class="tt__stat"><b data-acc>100%</b><i>accuracy</i></span>
        <span class="tt__clock">
          <svg viewBox="0 0 40 40" aria-hidden="true"><circle class="tt__track" cx="20" cy="20" r="16"></circle><circle class="tt__arc" data-arc cx="20" cy="20" r="16" pathLength="1" transform="rotate(-90 20 20)"></circle></svg>
          <b data-secs></b>
        </span>
      </header>

      <div class="tt__pad" data-pad>
        <div class="tt__view" data-view>
          <p class="tt__text" data-text aria-hidden="true"></p>
          <i class="tt__caret" data-caret aria-hidden="true"></i>
        </div>
        <input class="tt__in" data-in type="text" aria-label="Type the text shown" autocapitalize="off" autocomplete="off" autocorrect="off" spellcheck="false">
        <div class="tt__result" data-result>
          <span class="tt__verdict" data-verdict></span>
          <span class="tt__detail" data-detail></span>
          <button class="tt__again" type="button" data-again>
            <svg viewBox="0 0 16 16" aria-hidden="true"><path d="M13 8a5 5 0 1 1-1.600-3.700M13 2.500v3h-3"></path></svg>
            Try again
          </button>
        </div>
      </div>

      <svg class="tt__curve" data-curve aria-hidden="true"><path class="tt__fill" data-fill></path><path class="tt__line" data-line></path></svg>
      <p class="tt__say" data-say aria-live="polite"></p>
    </section>
  </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.

17 values to change

Works with Claude, Claude Code, ChatGPT, Cursor, VS Code, Windsurf, Codex, Gemini CLI

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 “Typing speed test” 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, at the top the words per minute in large yellow type, digits growing heavier as the speed climbs, the accuracy and the thirty-second ring running down. Below, three lines of dimmed text and a yellow caret. On each key the caret does not jump: it glides to the next letter on a spring, leans the way it is going and stretches a little with its speed; a right letter takes colour and settles by a couple of pixels, a wrong one turns red with a small shake. Going back, the letter dims again. Past the second line the text steps up one. Underneath, the words-per-minute curve grows to the right, its last point always live. When the text (or the time) runs out the lines give way to the result: a two-word verdict, right keystrokes out of the total and “Try again”. Left alone the demo types with a human rhythm, hits a wrong letter, notices and fixes it; tap the text and you type for real, from a keyboard or a phone.

How it works

One letter, one span

Every letter is a span, grouped by word in a block that never breaks mid-word. The caret’s place is read from offsetLeft and offsetTop of the letter that comes next, and read again on resize and once the fonts are loaded.

The caret is a spring

Two stiff springs on GSAP’s ticker, one per axis, take it to its target with a hair of overshoot; the lean and the stretch come from its speed. Still for more than 0.7 seconds, it breathes on a cosine.

An invisible field over the text

A transparent input covers the lines: it takes focus on a tap, opens the keyboard on a phone and passes characters to the same type() the demo uses. Backspace comes both from keydown and from inputType, because phone keyboards send no key events.

Words per minute

Right characters divided by five, divided by the minutes elapsed (never less than 1.2 seconds, or the first key would give an absurd number). The curve instead follows the pace of the last two seconds, a sample every quarter second, and tightens as time goes by.

Values to change

NameFileDefaultWhat it changes
ACCENTscript.js#ffcf4aThe colour of the caret, the words per minute and the curve.
TEXTscript.jsthe quiet harbour wakes before the town and the first boats slip out past the wallThe text to type.
LIMITscript.js30The seconds allowed: the ring runs them down.
SPEEDscript.js96How many words per minute the demo types at by itself.
GLIDEscript.js1How springy the caret is: 0.4 = soft, 2 = snappy.
LOOPscript.jstrueLeft alone, the demo types the text, hits a wrong letter, fixes it and starts again.

Try them in the Playground

When to use it

In the app or site of a typing course, in a speed game, on the try-it page of a keyboard for sale. The sprung caret alone suits any text field that wants to feel cared for: an editor, a chat, a command line.

On phones

A tap on the text opens the phone’s keyboard and you type for real; the demo alone never opens it. The text shrinks looking at the window’s height too, so three lines, the numbers and the curve all fit together.

With reduced motion

The caret moves from letter to letter without gliding or leaning, letters change colour without settling or shaking, the text changes line at once and the result appears in place.

Pitfalls

  • The demo’s text and numbers are made up; the final verdict is a threshold in the script (60 words per minute, 97% accuracy), not a leaderboard.
  • The invisible input has a 16-pixel font: below that Safari on iPhone zooms the page when it takes focus.
  • Letter positions change when the real font arrives: the caret is re-placed on document.fonts.ready, or it stays where the fallback font put it.
  • The demo’s keys do not go through the input: they call type() directly, so the field never takes focus by itself and the phone keyboard stays shut.
  • The state also speaks to those who cannot see it: start and result go to an aria-live region, the coloured text is hidden from screen readers and the input has its own label.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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