
Speeding marquee
Scroll, Text, Hover
A dish’s nutrition label, redone as a dark card: changing the portions makes every figure count to its new value, the calories gain weight, and under each line a thin rule says how much of the day it covers, warmer when it passes it. Moving over a line lights its piece in the macronutrient bar.
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>
<!--
"Nutrition facts 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>Nutrition facts 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 nutrition facts of a dish: change the portions and every figure counts to its new value,
the calories gain weight, and the share of the day on each line grows towards its limit -->
<section class="nf" data-nf aria-label="Nutrition facts">
<header class="nf__head">
<span class="nf__title">Nutrition</span>
<div class="nf__qty" role="group" aria-label="Portions">
<button type="button" data-less aria-label="One portion less"><svg viewBox="0 0 16 16" aria-hidden="true"><path d="M3.500 8h9"></path></svg></button>
<span class="nf__n" aria-live="polite"><span data-n></span></span>
<button type="button" data-more aria-label="One portion more"><svg viewBox="0 0 16 16" aria-hidden="true"><path d="M3.500 8h9M8 3.500v9"></path></svg></button>
</div>
</header>
<p class="nf__read">
<b class="nf__kcal" data-kcal>0</b>
<span class="nf__unit">kcal<br><span data-day></span></span>
</p>
<div class="nf__bar" data-bar aria-hidden="true"></div>
<div class="nf__rows" data-rows></div>
</section>
<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.
18 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 “Nutrition facts card” from Animorio and fit it into my siteA single number is animated, the portions shown, and every figure on the label is that number times its value: calories, grams, percentages and rule lengths always stay consistent, even mid-count.
The calories’ wght axis follows the portions, from 670 to 900: more portions, more black. The scale gives a small bounce, the number does not.
The three pieces are flex items as wide as each macronutrient’s calories (4 per gram of carbohydrate and protein, 9 for fat): the proportion does not change with the portions, so the bar jolts but is not redrawn.
| Name | File | Default | What it changes |
|---|---|---|---|
ACCENT | script.js | #ffd43b | The colour of the share of the day and of the chosen piece. |
OVER | script.js | #ff7a59 | The colour of a line that passes the whole day. |
KCAL | script.js | 520 | The calories in one portion. |
CARBS | script.js | 62 | The carbohydrate in one portion, in grams. |
PROTEIN | script.js | 24 | The protein in one portion, in grams. |
FAT | script.js | 18 | The fat in one portion, in grams. |
SALT | script.js | 1.6 | The salt in one portion, in grams. |
COUNT | script.js | 0.6 | How many seconds the numbers take to reach the new value. |
HOLD | script.js | 1.5 | On its own: how many seconds it stops on each step. |
LOOP | script.js | true | Left alone, a pointer adds portions and looks at two lines. |
On a dish’s page in a food delivery or recipe app, in a food diary, on the site of something to eat; and wherever a table of numbers depends on a quantity: a project’s materials, a recipe’s amounts, a quote.
The same card: tapping a row lights its piece of the bar, tapping it again turns it off. The calories and the rows shrink with the window’s height.
No counting and no jolts: on changing the portions, numbers, weight and rules are already at the new value.
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 18 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.