
The star rating
Ratings, SVG, Hover
One question of a quiz with four answers. Choosing one, the right one lights up green with its tick; if you were wrong, yours shakes and turns red with a cross. Every answer fills with the share of people who picked it, the streak of right answers goes up or back to zero and a line explains why.
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>
<!--
"Quiz question 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>Quiz question with the answer that reveals itself and the streak that climbs</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">
<!-- one question of a quiz: four answers; choosing one reveals the right one in green with its tick, a wrong
choice shakes and turns red, every answer fills with the share of people who picked it, the streak rolls up
or falls back to zero and a line explains the answer -->
<section class="quiz" data-quiz aria-label="Quiz question">
<header class="top">
<div class="steps" aria-hidden="true"><i class="is-done"></i><i class="is-done"></i><i data-step></i><i></i><i></i></div>
<p class="streak" data-streak-box><svg viewBox="0 0 16 16" aria-hidden="true"><path d="M8.6 1.4 3.4 9h3.8l-.8 5.6L11.6 7H7.8Z"></path></svg><span class="streak__n"><span data-streak>2</span></span><span class="streak__l">in a row</span></p>
</header>
<h1 class="ask">Which planet has the longest day?</h1>
<div class="answers" role="group" aria-label="Answers">
<button class="answer" type="button" data-answer data-share="0.18"><span class="answer__bar" data-bar></span><span class="answer__name">Mars</span><span class="answer__mark"><svg viewBox="0 0 24 24" aria-hidden="true"><path data-mark pathLength="1" d="M7 7l10 10M17 7 7 17"></path></svg></span><span class="answer__pct" data-pct>18%</span></button>
<button class="answer" type="button" data-answer data-share="0.41" data-right><span class="answer__bar" data-bar></span><span class="answer__name">Venus</span><span class="answer__mark"><svg viewBox="0 0 24 24" aria-hidden="true"><path data-mark pathLength="1" d="M6.4 12.6 10.4 16.6 17.8 8"></path></svg></span><span class="answer__pct" data-pct>41%</span></button>
<button class="answer" type="button" data-answer data-share="0.29"><span class="answer__bar" data-bar></span><span class="answer__name">Jupiter</span><span class="answer__mark"><svg viewBox="0 0 24 24" aria-hidden="true"><path data-mark pathLength="1" d="M7 7l10 10M17 7 7 17"></path></svg></span><span class="answer__pct" data-pct>29%</span></button>
<button class="answer" type="button" data-answer data-share="0.12"><span class="answer__bar" data-bar></span><span class="answer__name">Mercury</span><span class="answer__mark"><svg viewBox="0 0 24 24" aria-hidden="true"><path data-mark pathLength="1" d="M7 7l10 10M17 7 7 17"></path></svg></span><span class="answer__pct" data-pct>12%</span></button>
</div>
<p class="why"><span data-why>Pick an answer</span></p>
</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>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.
26 values to change
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 “Quiz question card” from Animorio and fit it into my siteEach answer is a button with data-share (the share of people who chose it) and, on the right one, data-right. After the choice the buttons are disabled and the card takes the is-over class.
choose puts is-right on the right answer and, if needed, is-wrong on the chosen one: colours and edges are in the CSS. The tick and the cross are SVG paths drawn with stroke-dashoffset; the cross at once, the right answer’s tick three tenths later.
Inside every answer a bar scales horizontally to its share with elastic.out, one after the other, and the percentage appears: after answering you see what the others chose.
The wrong answer moves SHAKE pixels left, right, half left and returns on a spring: four steps in half a second.
The streak number rolls up if it rises and down if it drops to zero; this question’s dash fills through a CSS variable, violet or red.
| Name | File | Default | What it changes |
|---|---|---|---|
STREAK | script.js | 2 | The right answers in a row before this question. |
RIGHT | script.js | A day on Venus lasts 243 Earth days, longer than its year. | The explanation after the right answer. |
WRONG | script.js | It is Venus: one day there lasts 243 Earth days. | The explanation after a wrong answer. |
SPRING | script.js | 0.8 | How long the spring of the percentage bars lasts, in seconds. |
STAGGER | script.js | 0.06 | The delay between one answer and the next, in seconds. |
SHAKE | script.js | 6 | By how many pixels the wrong answer shakes. |
HOLD | script.js | 2.8 | By itself: how many seconds the revealed answer stays. |
LOOP | script.js | true | Left alone, a pointer answers: once right, once wrong. |
For a learning app, an online course, the quiz of a blog or a newsletter, a prize game for an event or a shop. With a single question it also suits a landing page, to let people try the product before signing up.
The same card, as wide as the screen: the answers are 44 pixels tall, comfortable for a finger, and on a short screen they tighten slightly.
No shake and no springs: the colours change with a fade, the bars and marks appear at once and the numbers change with a fade.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 5.4 KB; the libraries: GSAP 28 KB.
Tested on 14 November 2026
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.
Support Animorio
Animorio stays free thanks to the people who support it. If you like, buy us a coffee: it helps us make the next animations.
You asked for
We made it for you: it’s in the library, with the preview, the Playground and the code to copy.
An animation you can’t find, or a site to take apart in the journal: tell us which. We pick the next ones from here.
With your account’s email and password.
or with your email
You’re signed in as .
With your account, you can download the zip of every animation and every pack, for free.