Skip to content
animorio
IT
Back to the library

Espresso recipe curve

Scroll, SVGGSAP, CSS onlyMediumCompressed weight: Demo 6.9 KBGSAP + ScrollTrigger 45 KBLenis 5.3 KBFreeDownload the zip

Scroll inside the preview

The recipe section of Halde Coffee, a made-up coffee bar: a sticky stage with the espresso card (Ethiopia Guji, 18 grams) and, as you scroll, the 28 seconds of the shot. The grams-in-the-cup line and the dashed pressure line draw themselves on the chart over their faint traces, a playhead rides the curve, each phase leaves its tick and its label (pre-infusion, first drops, full pressure, stop) and the numbers count up. At the end the status turns to Pulled, the tasting notes spring in and the 1 : 2.2 ratio is stamped. Premium style, a real interface piece.

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>
<!--
  "Espresso recipe curve" 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>Halde Coffee, the espresso recipe</title>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/mona-sans@5.3.0/wdth.css">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/jetbrains-mono@5.3.0/index.css">
  <link rel="stylesheet" href="style.css">
</head>
<body>
  <!-- the recipe section of a made-up coffee bar, Halde Coffee. A sticky stage with the espresso recipe card: scrolling
       runs the 28 seconds of the shot. The weight in the cup and the pump pressure draw themselves on the chart, a
       playhead rides the curve, the phases light up as the shot passes them (pre-infusion, first drops, extraction,
       stop), the numbers count up. At the end the tasting notes settle in and the ratio is stamped -->
  <section class="corsa" data-corsa>
    <div class="palco">
      <p class="occhiello">
        <svg viewBox="0 0 16 16" aria-hidden="true"><path d="M3.2 6.2h8.2v3.4a3.4 3.4 0 0 1-3.4 3.4H6.6a3.4 3.4 0 0 1-3.4-3.4z"/><path d="M11.4 7.2h.9a1.5 1.5 0 0 1 0 3h-1.1"/><path d="M5.6 2.6c-.5.7.5 1.3 0 2M8.2 2.6c-.5.7.5 1.3 0 2"/></svg>
        Halde Coffee · espresso recipe
      </p>
      <h2 class="titolo">Twenty-eight seconds,<br><span class="titolo__spento">one curve.</span></h2>

      <figure class="carta">
        <div class="carta__testa">
          <div class="chicco">
            <span class="chicco__nome">Ethiopia Guji</span>
            <span class="chicco__info">Washed · roasted 6 Nov</span>
          </div>
          <span class="stato" data-stato><span class="stato__testo" data-stato-testo>Ready</span></span>
        </div>

        <dl class="numeri">
          <div class="numero"><dt>Dose</dt><dd><span data-dose>18.0</span><small>g</small></dd></div>
          <div class="numero"><dt>In the cup</dt><dd><span data-resa>0.0</span><small>g</small></dd></div>
          <div class="numero"><dt>Time</dt><dd><span data-tempo>0</span><small>s</small></dd></div>
          <div class="numero"><dt>Pressure</dt><dd><span data-pressione>0.0</span><small>bar</small></dd></div>
        </dl>

        <div class="grafico" data-grafico>
          <div class="griglia" aria-hidden="true">
            <span style="--y:0%"></span><span style="--y:25%"></span><span style="--y:50%"></span><span style="--y:75%"></span><span style="--y:100%"></span>
          </div>
          <svg class="linee" viewBox="0 0 600 300" preserveAspectRatio="none" aria-hidden="true">
            <defs>
              <clipPath id="taglio"><rect data-taglio x="0" y="-10" width="0" height="320"/></clipPath>
              <linearGradient id="sotto" x1="0" y1="0" x2="0" y2="1">
                <stop offset="0" style="stop-color:var(--accento);stop-opacity:0.16"/>
                <stop offset="1" style="stop-color:var(--accento);stop-opacity:0"/>
              </linearGradient>
            </defs>
            <path class="fantasma fantasma--g" data-fantasma-g d=""/>
            <path class="fantasma fantasma--p" data-fantasma-p d=""/>
            <g clip-path="url(#taglio)">
              <path class="area" data-area d=""/>
              <path class="linea linea--p" data-linea-p d=""/>
              <path class="linea linea--g" data-linea-g d=""/>
            </g>
          </svg>
          <div class="fasi" data-fasi aria-hidden="true">
            <span class="fase" data-fase="0" style="--x:0%"><i></i><b>Pre-infusion</b></span>
            <span class="fase" data-fase="1" style="--x:23.2%"><i></i><b>First drops</b></span>
            <span class="fase" data-fase="2" style="--x:33.9%"><i></i><b>Full pressure</b></span>
            <span class="fase fase--fine" data-fase="3" style="--x:100%"><i></i><b>Stop</b></span>
          </div>
          <div class="testina" data-testina aria-hidden="true"><span class="testina__filo"></span><span class="testina__punto" data-punto></span></div>
          <div class="assi" aria-hidden="true"><span>0 s</span><span>10</span><span>20</span><span>28 s</span></div>
          <div class="legenda" aria-hidden="true">
            <span class="legenda__voce"><i class="legenda__g"></i>Weight in the cup</span>
            <span class="legenda__voce"><i class="legenda__p"></i>Pressure</span>
          </div>
        </div>

        <div class="fondo-carta">
          <ul class="note" data-note>
            <li class="nota" data-nota>Bergamot</li>
            <li class="nota" data-nota>White peach</li>
            <li class="nota" data-nota>Black tea</li>
          </ul>
          <span class="rapporto" data-rapporto>1 : <b>2.2</b></span>
        </div>
      </figure>
    </div>
  </section>
  <footer class="piede">Halde Coffee is a made-up coffee bar.</footer>

  <script src="https://cdn.jsdelivr.net/npm/gsap@3.15.0/dist/gsap.min.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/gsap@3.15.0/dist/ScrollTrigger.min.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/lenis@1.3.26/dist/lenis.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.

51 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 “Espresso recipe curve” 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 cream ground sits the recipe section of Halde Coffee: a pill with a drawn coffee cup, the headline «Twenty-eight seconds, one curve.» and below it the white espresso card. At the top the coffee, a washed Ethiopia Guji, and the Ready status; then four numbers (dose, grams in the cup, time, pressure) and the chart with its thin grid, the two faint dotted traces and the phase ticks still closed. As you scroll, the page holds still and the shot starts: the copper line of the grams in the cup and the dashed slate line of the pressure draw themselves from the left, with a soft fill under the first; a thin playhead with a small ring rides the curve. When the time passes a phase, its dashed tick drops and its label rises; the one you are in turns copper. Grams, seconds and bar count up with the scroll and the status turns to Pulling. At the end of the 28 seconds the status turns to Pulled on black, the numbers settle by a pixel, the tasting notes (Bergamot, White peach, Black tea) spring in one after the other and the 1 : 2.2 ratio is stamped slightly askew in a dashed box. Scrolling back runs the shot backwards.

How it works

Two models, not two drawings

The grams curve and the pressure curve are two small functions of time (first drops at 6.5 seconds, pressure rising from 3 to 9 bar and easing off at the end): the same functions draw the SVG lines and write the numbers, so the chart and the figures always agree.

One timeline tied to the scroll

A paused GSAP timeline carries a single value, the second of the shot, and ScrollTrigger scrubs it while the stage holds still with position: sticky. On every update a clipping rectangle widens to that second and uncovers the lines, and the playhead sits on the curve.

Phases with classes

The phase ticks and labels are CSS, with spring transitions: the script switches a class on or off when the time passes their threshold, so they work backwards too.

A timed ending

When the second reaches 28 a small timed animation starts, not tied to the scroll: the numbers settle, the notes spring in and the ratio is stamped; scrolling back switches them off.

Values to change

NameFileDefaultWhat it changes
RIDEscript.js1How much scroll the whole shot takes: 2 is twice as long.
SCRUBscript.js0.6How far the shot lags behind the scroll, in seconds.
SHOTscript.js28Seconds of the shot shown on the chart.
YIELDscript.js40Grams in the cup at the end.
DOSEscript.js18Grams of ground coffee in the basket.
FIRST_DROPSscript.js6.5The second when the first drops fall.
PEAKscript.js9Bar of pressure at full extraction.

Try them in the Playground

When to use it

For the page of a coffee bar or a roastery selling beans that wants to show the care behind a cup: the coffee of the month recipe, a bean’s page in the online shop, the «how we make it» section. It also suits a recipe app or a barista tools app.

On phones

The same animation with adapted measures: the four numbers wrap onto two rows, the legend and the third note are hidden, the card and the chart are sized on the height too and fit the stage.

With reduced motion

No motion: the shot is already done, with the full lines, the phases lit, the notes and the ratio, and it appears with a fade.

Pitfalls

  • The SVG lines sit in a stretched viewBox (preserveAspectRatio none): with vector-effect: non-scaling-stroke they stay thin, and the playhead and labels are HTML in percentages, so they do not stretch.
  • The gradient stop colours go in style, not in attributes: CSS variables do not work inside stop-color.
  • The phases use classes and CSS transitions, not scroll-tied tweens: so scrolling back closes them by itself.

Libraries

GSAP 3.15.0, ScrollTrigger 3.15.0, Lenis 1.3.26, Mona Sans (font variabile) 5.3.0, JetBrains Mono (font variabile) 5.3.0.

Compressed with gzip, the three demo files weigh 6.9 KB; the libraries: GSAP + ScrollTrigger 45 KB, Lenis 5.3 KB.

Testing

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