Skip to content
animorio
IT
Back to the library

Coffee roast card

SVG, HoverGSAP, CSS onlyMediumCompressed weight: Demo 5.8 KBGSAP 28 KBFreeDownload the zip

The card of a coffee in a roastery’s shop, on an espresso-coloured card with a copper light: a three-place selector (light, medium, dark) and below it the flavour profile, a six-sided chart. Changing roast the shape stretches towards the new one corner after the other, like elastic, the six numbers count, the bean darkens and the temperature and tasting notes roll.

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>
<!--
  "Coffee roast 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>Coffee card with the roast to choose and the flavour profile that redraws itself</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 card of a coffee in a roastery's shop: choosing the roast, the six-sided flavour profile stretches to
         its new shape one corner after the other, the numbers count, the bean darkens and the tasting notes roll -->
    <section class="cof" data-cof aria-label="Coffee flavour profile">
      <header class="cof__head">
        <svg class="bean" viewBox="0 0 34 34" aria-hidden="true"><g transform="rotate(-32 17 17)"><ellipse data-bean cx="17" cy="17" rx="9.5" ry="13.2"></ellipse><path class="bean__cut" d="M17 4.6c-3.6 4.4 3.600 8 0 12.400s3.600 8 0 12.400"></path><path class="bean__shine" d="M11.200 10.400c-1.400 2.600-1.800 5.400-1.400 8"></path></g></svg>
        <div class="cof__title"><span>Tostino Roasters</span><h1>Quiet Hill blend</h1></div>
        <p class="cof__temp roll"><span data-temp>214°C, 11 min</span></p>
      </header>

      <div class="roasts" role="radiogroup" aria-label="Roast" data-roasts><span class="roasts__thumb" data-thumb aria-hidden="true"></span></div>

      <div class="radar">
        <svg viewBox="0 0 240 190" data-svg role="img" aria-label="Flavour profile">
          <defs><radialGradient id="cofFill" cx="50%" cy="50%" r="60%"><stop offset="0" stop-color="var(--accent)" stop-opacity="0.5"></stop><stop offset="1" stop-color="var(--accent)" stop-opacity="0.16"></stop></radialGradient></defs>
          <g class="radar__grid" data-grid></g>
          <polygon class="radar__shape" data-shape fill="url(#cofFill)" points=""></polygon>
          <g class="radar__labels" data-labels></g>
        </svg>
      </div>

      <p class="notes"><span class="roll"><span data-notes>Caramel, hazelnut, milk chocolate</span></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>

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.

16 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 “Coffee roast 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 nearly black, coffee-coloured background with a copper light from above, a dark card: at the top a drawn coffee bean, the roastery’s and the blend’s names, and on the right the roast’s temperature and minutes. Below, a selector with three places (Light, Medium, Dark) and a copper thumb. In the middle the flavour profile: a hexagon of three thin rings with six names around it (acidity, fruit, sweetness, body, roast, bitterness), each with its score, and inside a filled copper shape with a glowing edge. Choosing another roast the thumb slides while stretching, the shape’s six corners leave one after the other towards the new value and pass it slightly before settling, the scores count, the bean goes from hazel to dark brown and the temperature and notes lines roll to the new text.

How it works

Six numbers, one shape

The profile is an SVG polygon whose points are rewritten on every frame from six values (0 to 10): for each, a fixed angle and a distance from the centre proportional to the value. The same six values, rounded, are the scores next to the names.

The staggered spring

Each value has its own tween towards the new roast’s, with the elastic.out ease and a delay of STAGGER seconds from the previous one; the order follows the direction of the change (clockwise towards a darker roast, anticlockwise towards a lighter one).

The rest

The selector’s thumb moves with xPercent (100 per place) and stretches on the way; the bean’s colour is a tween of its fill; temperature and notes roll from below only if the text changes.

Values to change

NameFileDefaultWhat it changes
PICKscript.js2The roast chosen at the start: 1 light, 2 medium, 3 dark.
MORPHscript.js1.1How many seconds the profile takes to reach its new shape.
STAGGERscript.js0.05The delay between one corner and the next.
BOUNCEscript.js0.55How elastic the profile is (lower is springier).
ACCENTscript.js#e89a4cThe colour of the profile and of the thumb.
PAUSEscript.js2On its own: how many seconds it stays on a roast.
LOOPscript.jstrueLeft alone, a pointer tries the three roasts.

Try them in the Playground

When to use it

For a roastery’s online shop or a café’s menu: the buyer sees how the coffee changes with the roast. The same profile suits a tea, a wine, an oil, a beer, a perfume, or comparing a product’s variants on six qualities.

On phones

The same card, as wide as the screen minus the margins, with the chart measured on the height too; the roast is chosen with a tap.

With reduced motion

No stretching shape or sliding thumb: profile, scores, bean and lines are at their state at once.

Pitfalls

  • With the spring a value can pass zero or ten for a moment: the distance from the centre has a minimum and the written score is kept between 0 and 10, otherwise an 11 would show.
  • There are no dots on the corners: the shape reads from its glowing edge and the score next to each name.
  • The chart has a label for screen readers and at each change a line says the roast and its notes: the shape alone cannot be read.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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