Skip to content
animorio
IT
All components

Lesson rating slider

Ratings, Physics, TransitionsGSAP, CSS onlyMediumCompressed weight: Demo 11 KBGSAP 28 KBFreeDownload the zip

The card that closes a lesson in Parlowe, an invented language learning app, like a Dribbble shot: «How clear was this lesson?» on a 1 to 10 slider. The thumb is dragged on a spring, the big number rolls on a drum, the track takes its colour from a measured gradient going from coral to amber to green and the light at the top of the card takes the same colour. Below, the follow-up question changes with the score: under 6 «What was confusing?», over 8 «What did you like most?», in between «What would make it a 10?», each with its own pills, and it passes from one to the next with a fade and a slide from the side the score is going. Send feedback gives under the finger and the card becomes a thank-you with a check that draws itself.

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>
<!--
  "Lesson rating slider" 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 lesson rating with the slider that changes the question</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 end of a lesson in Parlowe, an invented language app: a 1 to 10 slider asks how clear the lesson was. The
         number rolls on a drum, the track takes its colour from a measured gradient and the follow-up question below
         changes with the score: what was confusing, what would make it a 10, what you liked most -->
    <section class="rate" data-rate aria-labelledby="rate-title">
      <div class="rate__body" data-body>
        <header class="rate__head" data-rise>
          <span class="rate__app" aria-hidden="true">
            <svg viewBox="0 0 20 20"><path d="M4.5 4.5h11a2 2 0 0 1 2 2v5.2a2 2 0 0 1-2 2H9.6L6 16.6v-2.9H4.5a2 2 0 0 1-2-2V6.5a2 2 0 0 1 2-2z"/><path class="rate__app-wave" d="M6.6 9.2c.9-1.3 1.8-1.3 2.7 0s1.8 1.3 2.7 0 1.8-1.3 2.7 0"/></svg>
          </span>
          <span class="rate__meta">
            <span class="rate__course">Spanish · Lesson 12</span>
            <span class="rate__lesson">At the café</span>
          </span>
          <span class="rate__xp" data-xp>+40 XP</span>
        </header>

        <h1 class="rate__title" id="rate-title" data-rise>How clear was this lesson?</h1>

        <div class="rate__score" data-rise>
          <span class="rate__drum" aria-hidden="true">
            <span class="rate__col" data-col>
              <span>1</span><span>2</span><span>3</span><span>4</span><span>5</span><span>6</span><span>7</span><span>8</span><span>9</span><span>10</span>
            </span>
          </span>
          <span class="rate__of" aria-hidden="true">/ 10</span>
          <span class="rate__word" data-wordbox aria-hidden="true"><span class="rate__word-in" data-word>Clear enough</span></span>
        </div>

        <div class="rate__slider" data-slider role="slider" tabindex="0" aria-labelledby="rate-title"
             aria-valuemin="1" aria-valuemax="10" aria-valuenow="7" aria-valuetext="7 out of 10" data-rise>
          <span class="rate__track" aria-hidden="true">
            <span class="rate__fill" data-fill><span class="rate__fill-grad" data-grad></span><span class="rate__shine" data-shine></span></span>
          </span>
          <span class="rate__ticks" data-ticks aria-hidden="true"></span>
          <span class="rate__thumb" data-thumb aria-hidden="true">
            <span class="rate__halo" data-halo></span>
            <span class="rate__knob" data-knob><span class="rate__grip"></span></span>
          </span>
        </div>
        <div class="rate__ends" aria-hidden="true" data-rise><span>Not at all</span><span>Completely</span></div>

        <div class="rate__follow" data-follow data-rise>
        </div>

        <button class="rate__send" type="button" data-send data-rise>
          <span class="rate__send-face" data-sendface>
            <span class="rate__send-words">Send feedback</span>
            <svg class="rate__send-icon" viewBox="0 0 16 16" aria-hidden="true"><path d="M3 8h9M8.5 4.2L12.3 8 8.5 11.8"/></svg>
          </span>
        </button>
      </div>

      <div class="rate__thanks" data-thanks aria-hidden="true">
        <span class="rate__seal" data-seal>
          <svg viewBox="0 0 48 48" aria-hidden="true">
            <circle class="rate__seal-ring" data-ring cx="24" cy="24" r="21" pathLength="1"/>
            <path class="rate__seal-check" data-tick pathLength="1" d="M15.5 24.6l5.6 5.6 11.6-12"/>
          </svg>
        </span>
        <p class="rate__thanks-title" data-thx>Thanks, Maya</p>
        <p class="rate__thanks-line" data-thxline>Tomorrow’s lesson will adapt to your answer.</p>
        <span class="rate__bonus" data-bonus>+5 XP for your feedback</span>
      </div>
    </section>
    <p class="sr" aria-live="polite" data-live></p>
  </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.

41 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 “Lesson rating slider” 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 white page sits a white card with soft corners, a one pixel edge, a layered shadow and at the top a soft light in the colour of the score, plus a hair of light on the top edge. At the head the app's dark icon with a speech bubble and a coloured wave, Spanish · Lesson 12, At the café, and on the right the golden +40 XP pill. Below, the title How clear was this lesson?, a big number on a drum with / 10 beside it and on the right the word for the score in a coloured pill, from Lost to Crystal clear. Then the slider: a grey track with ten ticks, the fill that is a window on a gradient from coral to amber to green and a white thumb with a ring and a core in the colour of the score, with a halo that lights up when it is taken. On its own the pilot drags the thumb down to 3: the thumb swells, stretches with the speed and settles, the number rolls, the word leaves blurred and Unclear comes in, the card's light turns coral and the question below, What would make it a 10?, slides away to the side blurred while What was confusing? arrives with the pills Grammar, New words, Audio speed, Too long. Two taps: the pills squash and bounce, widen and draw their check. Then the thumb climbs to 9, every tick it reaches jumps and takes its colour, and What did you like most? arrives with Dialogues, Pronunciation, Pace and Mini quiz; two are picked. Send feedback gives and springs back, the lines of the card rise away blurred and in their place a green seal opens with its circle and check drawing themselves, Thanks, Maya, a line saying what will change in the next lesson after the pill picked and +5 XP for your feedback. Then the card comes back and the loop starts again. Touched, the card is yours: drag or tap the track, the arrow keys change the score, the pills switch on and off and each question remembers its picks.

How it works

A true spring under the thumb

The score is a continuous number v from 1 to 10 pulled towards its target by a damped spring written by hand (STIFFNESS, DAMPING), integrated in GSAP's ticker in two half steps with the step capped at 1/30 of a second, and still once it has settled. While dragging the target follows the finger continuously; on release it snaps to the nearest whole score. The thumb stretches sideways with its speed (SQUASH) and swells by 12% while held, with the change damped every frame.

The measured gradient

The fill is a window with overflow: hidden; inside it the gradient is as wide as the whole track (measured on resize), so the colour under the thumb is always the colour of the score and never squeezes as the fill grows. The script reads the same three colours from :root and blends them with gsap.utils.interpolate: the result goes into the --tint variable, which colours the thumb's ring and core, the word, the ticks already passed, the wave in the icon and the light at the top of the card.

The drum and the word

The number is a column from 1 to 10 inside a window one line tall with a soft mask above and below: it changes by sliding in yPercent with a back.out. The word leaves blurred on one side and comes in from the other following the direction of the score, with a timeline killed at every change, so a fast drag never piles up; the tick reached jumps with an elastic and reaching 10 a glint runs along the track.

The question that changes

Three bands (under LOW_BELOW, over HIGH_ABOVE, in between) with their own question and pills. When the band changes the new question is built next to the old one: the old one leaves by 14 pixels, blurred, towards the side the score is moving away from, the new one comes from the other side with its pills staggered on a back.out. The space below is two rows of pills tall, so the card never jumps. The picks of each band stay in a Set and going back they are found switched on.

Pills, send and thanks

Each pill is a button with aria-pressed: it squashes and comes back on an elastic, Mona Sans' wdth axis widens the word and an SVG check opens in width and draws itself with pathLength=1. Send feedback gives, the lines rise away blurred and the thank-you arrives with its circle and check drawn and a line chosen after the first pill switched on. A pilot made of a GSAP timeline moves the same pieces as the hand; it stops at the first touch and starts again after nine quiet seconds.

Values to change

NameFileDefaultWhat it changes
STIFFNESSscript.js260The spring that pulls the thumb to the finger: higher is quicker.
DAMPINGscript.js23Lower lets the thumb pass the mark and come back.
LOW_BELOWscript.js6Under this score the question asks what was confusing.
HIGH_ABOVEscript.js8Over this score the question asks what you liked most.
STARTscript.js7The score the slider starts on.
SQUASHscript.js1How much the thumb stretches with its speed (0 never).
HOLDscript.js2.6Seconds the thank-you stays before the card comes back.
SPEEDscript.js12 = the pilot twice as fast, 0.5 = half.
LOOPscript.jstrueThe pilot plays the story again and again.

Try them in the Playground

When to use it

At the end of a lesson in a language learning app, an online course, a webinar or a tutorial: it asks for a score with one gesture and then just one question that fits that score, instead of a long form that is the same for everyone. It also works for feedback after an order, a delivery, a support call or a new tool in a dashboard, and as a 1 to 10 NPS with its follow-up question.

On phones

The same animation with adapted sizes: the card is 92% of the screen wide, the title, the number and the spacing are sized on the height too, so everything fits the phone's box. A finger drags like the mouse without scrolling the page (touch-action: none on the track) and a tap on the track takes the thumb there.

With reduced motion

Nothing moves: the thumb goes straight to the score with no spring, the number changes in place with a fade, the word and the follow-up question swap with a fade, the checks appear already drawn and the thank-you fades in with its circle and check already in place.

Pitfalls

  • A first question written in the html and the one the script built at start ended up on top of each other: the question's space starts empty and the script builds every question, the first one too.
  • Bringing the card back after the thank-you, the band was worked out from the start score while the thumb was still at 9: the new question is chosen from the number shown and changes by itself, with its transition, as the spring takes the thumb back to 7.
  • Switching off the pills when the pilot came back after emptying the picks turned each pill on again: they are switched off first, then the Sets are emptied.
  • The pill's check at zero width still left the space of the gap: the gap is zero and the space is the check's right margin, animated together with its width.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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