Skip to content
animorio
IT
Back to the library

Easing curve scroll

Scroll, SVGGSAPMediumCompressed weight: Demo 7.7 KBGSAP + ScrollTrigger 45 KBLenis 5.3 KBFreeDownload the zip

Scroll inside the preview

A minimal SVG scroll animation: the easing curve of a motion tool, on a square graph. Scrolling down, its two handles slide out of the corners on a spring and bend the straight line into an S, while the cubic-bezier value follows them digit by digit; then a thin playhead crosses the graph with the scroll, a small orange diamond rides the curve and a little square on the rail beside it moves slow, fast, slow, stretching with its speed. At the end the curve takes the accent and the square lands a pixel too far. The handles can be grabbed and pulled: let go, they spring back.

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>
<!--
  "Easing curve scroll" 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>The easing curve that bends as you scroll</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>
  <!-- an easing curve on a square graph, as in a motion tool. Scrolling down, its two handles slide out of the corners
       on a spring and bend the straight line into an S; then a thin playhead walks across the graph with the scroll,
       a small diamond rides the curve and a square on the rail beside it moves slow, fast, slow. When the playhead
       reaches the end the curve takes the accent, the diamond knocks once and the square lands a pixel too far.
       The handles can be grabbed and pulled: let go, they spring back -->
  <main class="pagina">
    <section class="corsa" data-corsa aria-label="Easing curve">
      <div class="palco">
        <div class="pezzo" data-pezzo>
          <header class="testa">
            <span class="testa__etichetta">Easing</span>
            <span class="testa__nome"><span data-nome>linear</span></span>
          </header>

          <svg class="grafico" data-grafico aria-hidden="true">
            <rect class="grafico__bordo" data-bordo></rect>
            <g data-tacche></g>
            <path class="grafico__lineare" data-lineare></path>
            <line class="grafico__testina" data-testina></line>
            <line class="grafico__guida" data-guida></line>
            <line class="grafico__braccio" data-braccio="1"></line>
            <line class="grafico__braccio" data-braccio="2"></line>
            <path class="grafico__curva" data-curva pathLength="1"></path>
            <rect class="grafico__capo" data-capo="0"></rect>
            <rect class="grafico__capo" data-capo="3"></rect>
            <line class="grafico__binario" data-binario></line>
            <rect class="grafico__oggetto" data-oggetto></rect>
            <rect class="grafico__rombo" data-rombo></rect>
            <g class="grafico__maniglia" data-maniglia="1"><rect class="grafico__presa" data-presa></rect><rect class="grafico__pomo" data-pomo></rect></g>
            <g class="grafico__maniglia" data-maniglia="2"><rect class="grafico__presa" data-presa></rect><rect class="grafico__pomo" data-pomo></rect></g>
          </svg>

          <p class="codice" aria-label="cubic-bezier value"><span class="codice__fn">cubic-bezier(</span><span class="codice__n" data-n>0.00</span><span class="codice__fn">, </span><span class="codice__n" data-n>0.00</span><span class="codice__fn">, </span><span class="codice__n" data-n>1.00</span><span class="codice__fn">, </span><span class="codice__n" data-n>1.00</span><span class="codice__fn">)</span></p>
        </div>

        <p class="scendi" data-scendi>Scroll</p>
      </div>
    </section>
  </main>

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

27 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 “Easing curve scroll” 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 empty warm white there is a square graph, barely marked: the word ‘Easing’ at the top left, the name of the curve on the right, the value in code underneath. On opening the frame appears, the diagonal draws itself from corner to corner and the two handles, small white squares with a black edge, pop up in the corners with a bounce. Scrolling down, the page holds still and the handles slide out of the corners along the edges, each on its own spring, a little behind and a pixel too far before they settle: the diagonal bends into an S and stays behind as a dotted trace, the name goes from ‘linear’ to ‘custom’ and then to ‘ease-in-out’, and the four numbers of cubic-bezier change with them. Then a thin vertical playhead crosses the graph from left to right with the scroll: where it meets the curve a small orange diamond rides along it, a dotted line ties it to the rail on the right, and there a little orange square rises slowly, then fast, then slowly again, stretching a little as it runs. The ticks on the bottom edge jump by a pixel as the playhead passes them. When the playhead reaches the end the curve turns orange, the diamond knocks once and the square lands a pixel past the top and comes back. With the pointer over a handle it grows; it can be grabbed and pulled anywhere, the curve and the numbers follow, and when it is let go it springs back to where the scroll wants it. Scrolling back up undoes everything.

How it works

Numbers, not styles

Scroll, handles, colour and knocks are numbers in an object; ScrollTrigger with scrub only carries the scroll, and one draw per frame, in GSAP’s ticker, writes the SVG attributes: the C path of the curve, the arms, the handles, the diamond and the square.

A spring per handle

The scroll says where each handle should be; the handle chases it on a spring (stiffness 230, damping from the bounce), integrated in steps of 1/120 of a second. So it arrives late and a pixel too far, and when it is dragged it follows the finger on the same spring.

The value at a moment

To place the diamond, the Bézier t that gives the playhead’s x is found by bisection (22 steps), and the y is read from that t. The handles’ x stays between 0 and 1, so every moment has only one value.

The running square

The square’s speed is the smoothed difference between one frame and the next; the faster it runs, the taller and narrower it gets, keeping the same area.

The arrival

When the playhead reaches the end a short timeline takes the curve’s colour to orange and gives two elastic knocks: to the diamond, which swells and comes back, and to the square, which rises a pixel and a half too far and settles. Scrolling back under 90% turns it black again.

Values to change

NameFileDefaultWhat it changes
X1script.js0.65The first handle of the final curve, across (0 to 1).
Y1script.js0The first handle, up: below 0 or above 1 the curve overshoots.
X2script.js0.35The second handle, across.
Y2script.js1The second handle, up.
NAMEscript.jsease-in-outThe name the curve gets once it is bent.
BOUNCEscript.js0.35How much the handles bounce on their spring.
SQUASHscript.js1How much the square stretches with its speed (0 = never).
LAGscript.js0.6How many seconds everything takes to catch up with the scroll.
SMOOTHscript.js1.1Seconds of the smooth scroll; 0 for the browser’s own.

Try them in the Playground

When to use it

For the page of a motion or design tool, a motion design course, the docs of a library or the portfolio of an interface designer: it explains what easing is without one more word.

On phones

The same animation with adapted sizes: the graph is as big as the screen allows, in width and height, and the handles can be grabbed with a finger on an area wider than they are.

With reduced motion

No movement: the curve is already bent and orange, with the diamond and the square at the top, and it appears in a fade.

Pitfalls

  • The curve draws itself on opening with pathLength="1" and a dash: once the entrance is over the dash must be removed, or the path that changes every frame stays cut.
  • With the handles’ x outside 0 and 1 the curve turns back and one x has several values: for the diamond the x is clamped between 0 and 1.

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 7.7 KB; the libraries: GSAP + ScrollTrigger 45 KB, Lenis 5.3 KB.

Testing

Tested on 31 October 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