Skip to content
animorio
IT
Back to the library

Weekly meal plan

Hover, TransitionsGSAP, CSS onlyEasyCompressed weight: Demo 5.6 KBGSAP 28 KBFreeDownload the zip

A week’s meal plan on a white card: the seven days in a bar with a sliding pill, the chosen day’s breakfast, lunch and dinner, and the day’s calories on a bar towards the target. Hovering another day springs the pill onto it, the three meals slide off towards where the week is going and the new ones arrive from the other side, one after the other, while the calories count and the bar settles.

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>
<!--
  "Weekly meal plan" 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>Weekly meal plan</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 week's meal plan: the days to choose, the three meals sliding away while the next day's
         arrive, and the day's calories counting on the bar -->
    <article class="mp" data-mp aria-label="Weekly meal plan">
      <header class="mp__head"><strong>This week’s plan</strong><span class="mp__day"><span data-outday>Monday</span></span></header>
      <div class="mp__days" role="tablist" aria-label="Day" data-days>
        <i class="mp__pill" data-pill aria-hidden="true"></i>
        <button type="button" role="tab" data-d="0" aria-selected="true" aria-label="Monday"><b>Mon</b><i></i></button>
        <button type="button" role="tab" data-d="1" aria-selected="false" aria-label="Tuesday" tabindex="-1"><b>Tue</b><i></i></button>
        <button type="button" role="tab" data-d="2" aria-selected="false" aria-label="Wednesday" tabindex="-1"><b>Wed</b><i></i></button>
        <button type="button" role="tab" data-d="3" aria-selected="false" aria-label="Thursday" tabindex="-1"><b>Thu</b><i></i></button>
        <button type="button" role="tab" data-d="4" aria-selected="false" aria-label="Friday" tabindex="-1"><b>Fri</b><i></i></button>
        <button type="button" role="tab" data-d="5" aria-selected="false" aria-label="Saturday" tabindex="-1"><b>Sat</b><i></i></button>
        <button type="button" role="tab" data-d="6" aria-selected="false" aria-label="Sunday" tabindex="-1"><b>Sun</b><i></i></button>
      </div>
      <ul class="mp__meals">
        <li><span class="mp__slot">Breakfast</span><span class="mp__row" data-row><b data-outdish>Overnight oats, pear</b><em data-outkcal>420</em></span></li>
        <li><span class="mp__slot">Lunch</span><span class="mp__row" data-row><b data-outdish>Lentil and feta salad</b><em data-outkcal>610</em></span></li>
        <li><span class="mp__slot">Dinner</span><span class="mp__row" data-row><b data-outdish>Miso salmon, greens</b><em data-outkcal>780</em></span></li>
      </ul>
      <footer class="mp__foot">
        <div class="mp__nums"><strong data-outsum>1,810</strong><span data-outgoal>of 1,900 kcal</span><span class="mp__left"><span data-outleft>90 to spare</span></span></div>
        <div class="mp__track" aria-hidden="true"><i class="mp__fill" data-fill></i></div>
      </footer>
    </article>
    <span class="live" aria-live="polite" data-live></span>

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

31 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 “Weekly meal plan” 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 light warm ground, a rounded white card: “This week’s plan” and on the right, in orange, the chosen day. Below, the bar of the seven days, “Mon” to “Sun”, each with a small dash, and a white pill behind the chosen one. Then three rows: “Breakfast”, “Lunch”, “Dinner”, with the dish and its calories. At the bottom the day’s calories in large digits, “of 1,900 kcal”, how much is to spare and an orange bar. On entering the meals arrive from the right, the figure counts from zero and the bar fills. Hovering another day (or tapping it) springs the pill onto it, the day’s name rolls, the three dishes slide off one after the other to the left when moving forward in the week, to the right when going back, and the new ones arrive from the opposite side with a small settle; the calories count to the new total, the bar settles with a bounce and the text says how many are to spare.

How it works

The week as a list

Seven days, three meals each, every one with its name and calories: the rows, the day’s total and the bar’s fraction all come from it. Changing the plan means changing the list.

The direction

The new day is compared with the previous one: forward in the week the dishes leave to the left and enter from the right, backward the opposite. The same direction rolls the day’s name.

Out, swap, in

Every row leaves in a tenth of a second, takes the new dish while its text is hidden and comes back on a spring. Rows start staggered; if another day has been chosen in the meantime, the old swap is dropped.

The calories

The total counts on an animated number and the bar changes scaleX on an elastic spring, so a lighter day shows even before the figure is read.

Values to change

NameFileDefaultWhat it changes
ACCENTscript.js#e8552dThe colour of the chosen day and of the calorie bar.
TARGETscript.js1900The daily calories the plan aims for.
SLIDEscript.js18By how many pixels the meals slide when the day changes.
HOLDscript.js2How many seconds the demo’s pointer stays on each day.
LOOPscript.jstrueLeft alone, the demo’s pointer goes over the days of the week.

Try them in the Playground

When to use it

On the screen of a nutrition app, a recipe box service or a food blog offering the week’s menu; the same card with its days carries a training programme, a week of class times, shifts or a festival’s day-by-day schedule.

On phones

The card is at most 344 pixels wide and about 330 tall, and narrows with the screen: the seven days share the room and long dish names truncate with an ellipsis. With a finger the days are tapped; each day is 40 pixels tall.

With reduced motion

No slides and no springs: on a day change the three dishes are the new ones at once with a brief fade, the pill is already in place, the figure and the bar change without counting. The demo’s pointer does not start.

Pitfalls

  • The days are real tabs (a tablist) with the full name in aria-label: they change with the arrow keys, and an aria-live region reads the chosen day’s three dishes and calories.
  • Moving quickly over several days makes the swaps overlap: every swap has a number, and a row that finishes leaving writes the new dish only if its swap is still the latest.
  • Hover picks the day only with a mouse; with a finger a tap is what counts.
  • Dishes, calories and target are invented and are not dietary advice.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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