Skip to content
animorio
IT
Back to the library

Level up card

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

The level card of an app: the badge with the number, the rank and the points bar. Claim the points and a chip flies from the button to the bar, which fills, flashes and overflows into the next level: the number rolls from 7 to 8 with a sheen crossing it, the rank changes and a perk unlocks as its padlock opens. Over the bar you read how much is missing.

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>
<!--
  "Level up 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>Level up card</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 level card of an app: the claimed points fly into the bar, the bar overflows into the next level,
         the number rolls, the rank changes and a perk unlocks -->
    <section class="lv" data-lv aria-label="Your level">
      <header class="lv__head">
        <div class="lv__badge" data-badge>
          <svg class="lv__ring" viewBox="0 0 64 64" aria-hidden="true"><circle class="lv__track" cx="32" cy="32" r="29.500"></circle><circle data-ring pathLength="1" cx="32" cy="32" r="29.500" transform="rotate(-90 32 32)"></circle></svg>
          <div class="lv__core" data-core>
            <span class="lv__shine" data-shine aria-hidden="true"></span>
            <span class="lv__num"><b data-num>7</b></span>
          </div>
        </div>
        <div class="lv__who">
          <p class="lv__kicker">Level <span data-lvtext>7</span></p>
          <h2 class="lv__rank"><span data-rank>Explorer</span></h2>
        </div>
        <p class="lv__xp"><b data-xp>2,340</b><span data-of>/ 2,500 XP</span></p>
      </header>

      <div class="lv__bar" data-bar tabindex="0" role="progressbar" aria-label="Points towards the next level" aria-valuemin="0" aria-valuemax="2500" aria-valuenow="2340">
        <span class="lv__fill" data-fill></span>
        <span class="lv__flash" data-flash aria-hidden="true"></span>
      </div>

      <div class="lv__perk" data-perk>
        <div class="lv__perkin" data-perkin>
          <svg viewBox="0 0 20 20" aria-hidden="true"><rect x="4" y="9" width="12" height="8.500" rx="2.400"></rect><path data-shackle d="M6.800 9V6.700a3.200 3.200 0 0 1 6.400 0V9"></path></svg>
          <span><b>Unlocked</b> Custom themes</span>
        </div>
      </div>

      <button class="lv__btn" type="button" data-claim><span data-claimlabel>Claim 400 XP</span></button>
      <span class="lv__chip" data-chip aria-hidden="true"></span>
      <span class="lv__say" data-say aria-live="polite"></span>
    </section>

    <svg class="ghost" data-ghost viewBox="0 0 24 24" aria-hidden="true"><path d="M5 3.200 19.200 11l-6.300 1.600-3.300 5.900Z"></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.

20 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 “Level up card” 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 warm light ground, a white card: on the left an orange badge with the number 7 inside an almost full ring, beside it “Level 7” and the rank “Explorer”, on the right “2,340 / 2,500 XP”. Below, an orange bar nine tenths full and the black button “Claim 400 XP”. On opening the bar and the ring fill together while the points count. Press the button and a “+400 XP” chip pops out, flies to the tip of the bar and goes in; the bar reaches the end, flashes white and empties to start again from the new level. At the same moment the badge jumps, a sheen crosses it, the 7 rolls away and the 8 bounces in, the rank becomes “Pathfinder” and the points restart from 240 out of 3,000. Then the card grows: “Unlocked Custom themes” appears and the padlock’s shackle opens. The button becomes “Replay”. With the pointer on the bar it thickens and on the right the two lines roll into “2,760 XP to level 9”.

How it works

One object

Bar, ring and points number read the same object, a fraction and a number: every tween changes it and one function redraws everything.

The overflow

If the points pass the threshold the bar first goes to 1, then the fill fades, returns to 0 and climbs to what is left over, against the new level’s threshold.

The rolling number

The number leaves upwards and fades, changes its text and comes in from below on an elastic; meanwhile the badge comes down from a larger scale.

The padlock

The shackle turns 28 degrees round its right foot: an animated number written in the transform attribute, with the centre in the drawing’s coordinates.

Values to change

NameFileDefaultWhat it changes
ACCENTscript.js#ff6a3dThe colour of the badge, the bar and the unlocked perk.
GAINscript.js400How many points are claimed: above 160 the level goes up, below it the bar just rises.
FILL_TIMEscript.js0.5How many seconds the bar takes to fill to the end.
SPRINGscript.js1How much the badge and the number bounce on levelling up: 0.3 = a little, 2 = a lot.
LOOPscript.jstrueLeft alone, the demo’s pointer claims the points, looks at what is missing and starts again.

Try them in the Playground

When to use it

In the profile of a learning app, a loyalty programme, a workout app or a community: wherever points raise the level and a level unlocks something.

On phones

The same card, 316 pixels wide at most; when the perk unlocks it grows by 52 pixels and stays inside the screen. With a finger, the “how much is missing” is read by focusing the bar.

With reduced motion

No flying chip, flash or bounces: on tap level, rank, points and perk change at once; over the bar the two lines swap without rolling. The demo does not move by itself.

Pitfalls

  • Levels, ranks and points are made up: in a real app they come from the server, and the animation starts only after its answer.
  • The bar has role progressbar with aria-valuenow and aria-valuemax kept up to date, and an aria-live region says the level reached and what was unlocked.
  • The sheen on the badge moves with GSAP’s xPercent: if the CSS already has a translation the two add up and the band stays in view after its pass.
  • While the pointer is on the bar the points number is not rewritten by the fill: a variable says who is writing those two lines.
  • A GAIN larger than a whole level is not handled: the demo goes up one level only.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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