Skip to content
animorio
IT
Back to the library

Revision flashcards

Hover, SVGGSAP, CSS onlyMediumCompressed weight: Demo 6.0 KBGSAP 28 KBFreeDownload the zip

A revision session with flashcards: the card shows the question, a tap draws a line and brings up the answer. “Got it” sends it away to the right, “Again” to the left, tilted, and the pile that takes it counts with a bounce; underneath, the deck’s sheets get thinner and at the end the card says how it went.

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>
<!--
  "Revision flashcards" 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>Revision flashcards with the card that slides away and the two piles that count</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">
    <!-- a revision session with flashcards: the card shows the question, a tap reveals the answer under a line that
         draws itself; "Got it" sends it right, "Again" left, and the two piles count while the deck gets thinner -->
    <section class="fc" data-fc aria-label="Flashcards">
      <header class="fc__head">
        <div><span>Spanish basics</span><h1>Revision</h1></div>
        <p class="fc__left"><strong data-left>6</strong> cards left</p>
      </header>

      <div class="deck" data-deck>
        <span class="deck__under deck__under--b" data-under-b aria-hidden="true"></span>
        <span class="deck__under" data-under-a aria-hidden="true"></span>
        <button class="card" type="button" data-card aria-live="polite">
          <span class="card__tag" data-tag>Question</span>
          <span class="card__q" data-q></span>
          <svg class="card__rule" viewBox="0 0 100 2" preserveAspectRatio="none" aria-hidden="true"><path data-rule pathLength="1" d="M0 1h100"></path></svg>
          <span class="card__a" data-a></span>
          <span class="card__hint" data-hint>Tap to see the answer</span>
        </button>
      </div>

      <div class="piles">
        <button class="pile pile--again" type="button" data-again><svg viewBox="0 0 16 16" aria-hidden="true"><path d="M3.500 8a4.500 4.500 0 1 0 1.500-3.400M5 2v2.800h2.800"></path></svg><span>Again</span><b><i data-n-again>0</i></b></button>
        <button class="pile pile--got" type="button" data-got><svg viewBox="0 0 16 16" aria-hidden="true"><path d="M3.200 8.400 6.500 11.500 12.800 4.800"></path></svg><span>Got it</span><b><i data-n-got>0</i></b></button>
      </div>
    </section>
    <p class="sr" data-live aria-live="polite"></p>

    <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.

32 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 “Revision flashcards” 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 cream background, at the top “Spanish basics”, “Revision” and on the right how many cards are left. In the middle a white card with two sheets peeking out below: an orange “Question” tag, the big word (“la ventana”) and at the bottom “Tap to see the answer”. Touching it an orange line draws itself under the word, the answer comes up from below on a small spring and the tag becomes “Answer”, green. Below there are two buttons with their counters: “Again” and “Got it”. Pressing “Got it” the card slides right while tilting and vanishes, the green counter goes up with a bounce, the sheet underneath comes forward and becomes the new card; “Again” does the same to the left. The card can also be dragged sideways. When the cards are over, the last one says “4 of 6” and how many to see again tomorrow.

How it works

One card only

On the page there is one card and two empty sheets below: when the card is out its text is changed and it comes back in from where the first sheet was (y 8, scale 0.955) with back.out. The sheets vanish when fewer than two cards are left.

The answer

The line is a path with pathLength 1 drawn in 0.45 seconds; the answer rises 8 pixels with back.out 0.14 seconds later, and the question hops 3 pixels.

The exit

x goes to 60% of the window, rotation to TILT degrees, y drops 30 with power1.in: three tweens together making a parabola. The pile’s counter rolls at 70% of the exit. When dragged, past a third of its width the card leaves to that side, otherwise it comes back with elastic.out.

Values to change

NameFileDefaultWhat it changes
CARDSscript.js[["la ventana", "the window"], ["el desayuno", "breakfast"], ["despacio", "slowly"], ["la lluvia", "the rain"], ["a menudo", "often"], ["el billete", "the ticket"]]The cards: question and answer.
THROWscript.js0.5How many seconds the card takes to leave.
TILTscript.js14By how many degrees it tilts while leaving.
ACCENTscript.js#e8590cThe colour of the line and the tag.
GOTscript.js#12915cThe colour of the “Got it” pile.
LOOPscript.jstrueLeft alone, a pointer turns the cards and sends them to the two piles, then starts again.

Try them in the Playground

When to use it

For a language app or course, an online school, a site selling courses that wants to let people try the method on the page; also for a product quiz or an app’s onboarding, by changing the cards.

On phones

The same card, at most 46% of the screen high; you tap to turn it and drag it sideways with a finger, or use the two buttons below.

With reduced motion

The answer appears without rising, the card does not fly away: it changes text in place and the counters change figure without rolling.

Pitfalls

  • After a drag the browser also sends a click: it must be stopped, otherwise the card coming back to the centre turns by itself.
  • The card has touch-action pan-y: a finger drags it sideways but the page still scrolls vertically.
  • The line at rest has opacity 0: a zero-length stroke with round caps would leave a dot under the question.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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