Skip to content
animorio
IT
Back to the library

Investment plan chart

ScrollGSAP, CSS onlyMediumCompressed weight: Demo 11 KBGSAP + ScrollTrigger 45 KBLenis 5.3 KBFreeDownload the zip

Scroll inside the preview

A scroll animation in the premium style of product pieces: the dark glass card with the monthly plan of a made-up investing app, Halden, 300 euros a month for twenty years. Scrolling down the years go by from 2026 to 2046: the mint line of the value grows over the dashed lilac line of the deposits, the space between them, the growth, fills with a gradient, the cursor walks with the year on a pill that rolls digit by digit, three milestones pop on the curve on a spring and the portfolio slowly moves from stocks to bonds. At the end the plan starts.

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>
<!--
  "Investment plan chart" 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>Halden monthly 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>
  <!-- the monthly plan of a made-up investing app, Halden, on a dark glass card. The stage sticks while you scroll and
       the scroll is the calendar of the plan: twenty years go by, the value line grows over the line of what you put
       in, the year rolls on a pill, the milestones pop on the curve, the mix of the portfolio slides from stocks to
       bonds as the goal gets near. At the end the plan starts. -->
  <main>
    <section class="years" data-years>
      <div class="stage" data-stage>
        <div class="light light--a" data-light-a aria-hidden="true"></div>
        <div class="light light--b" data-light-b aria-hidden="true"></div>
        <div class="grain" aria-hidden="true"></div>

        <div class="frame" data-frame>
          <article class="card" data-card>
            <span class="card__glow" aria-hidden="true"></span>
            <span class="card__rim" aria-hidden="true"></span>

            <header class="head">
              <span class="head__mark" aria-hidden="true">
                <svg viewBox="0 0 16 16"><path d="M3 12.5l3.4-4 2.6 2.4L13 4.5"/><path d="M9.6 4.5H13v3.4"/></svg>
              </span>
              <div class="head__text">
                <p class="head__title">Halden</p>
                <p class="muted">Monthly plan &middot; Balanced</p>
              </div>
              <span class="chip">&euro;300<span class="muted">&nbsp;/ month</span></span>
            </header>

            <div class="value">
              <p class="value__label muted">Projected value</p>
              <p class="value__num" data-value>&euro;1,000</p>
              <p class="value__split">
                <span class="split split--dep"><span class="muted">Deposits</span> <b data-dep>&euro;1,000</b></span>
                <span class="split split--grow"><span class="muted">Growth</span> <b data-grow>+&euro;0</b></span>
              </p>
            </div>

            <div class="chart" data-chart>
              <div class="chart__plot" data-plot>
                <span class="gl" data-gl style="--at:0.3333"><em>&euro;50k</em></span>
                <span class="gl" data-gl style="--at:0.6667"><em>&euro;100k</em></span>
                <span class="gl" data-gl style="--at:1"><em>&euro;150k</em></span>
                <span class="gl gl--base" data-gl style="--at:0"></span>

                <svg class="chart__svg" viewBox="0 0 400 160" preserveAspectRatio="none" aria-hidden="true">
                  <defs>
                    <linearGradient id="grow" x1="0" y1="0" x2="0" y2="1">
                      <stop offset="0" stop-color="var(--mint)" stop-opacity="0.42"/>
                      <stop offset="1" stop-color="var(--mint)" stop-opacity="0.04"/>
                    </linearGradient>
                    <linearGradient id="dep" x1="0" y1="0" x2="0" y2="1">
                      <stop offset="0" stop-color="var(--lilac)" stop-opacity="0.26"/>
                      <stop offset="1" stop-color="var(--lilac)" stop-opacity="0.03"/>
                    </linearGradient>
                  </defs>
                  <path class="area area--dep" data-area-dep d=""/>
                  <path class="area area--grow" data-area-grow d=""/>
                  <path class="ln ln--dep" data-ln-dep d=""/>
                  <path class="ln ln--val" data-ln-val d=""/>
                </svg>

                <span class="ms" data-ms="10000"><span class="ms__tick"></span><span class="ms__tag">First &euro;10k</span></span>
                <span class="ms" data-ms="50000"><span class="ms__tick"></span><span class="ms__tag">&euro;50k</span></span>
                <span class="ms ms--goal" data-ms="120000"><span class="ms__tick"></span><span class="ms__tag">
                  <svg viewBox="0 0 16 16" aria-hidden="true"><path d="M4 8.4l2.6 2.6L12 5.4"/></svg>Goal</span></span>

                <span class="cursor" data-cursor aria-hidden="true">
                  <span class="cursor__line"></span>
                  <span class="cursor__pt" data-pt></span>
                  <span class="pill" data-pill>
                    <span class="dg"><span class="dg__strip" data-dg><b>0</b><b>1</b><b>2</b><b>3</b><b>4</b><b>5</b><b>6</b><b>7</b><b>8</b><b>9</b></span></span><span class="dg"><span class="dg__strip" data-dg><b>0</b><b>1</b><b>2</b><b>3</b><b>4</b><b>5</b><b>6</b><b>7</b><b>8</b><b>9</b></span></span><span class="dg"><span class="dg__strip" data-dg><b>0</b><b>1</b><b>2</b><b>3</b><b>4</b><b>5</b><b>6</b><b>7</b><b>8</b><b>9</b></span></span><span class="dg"><span class="dg__strip" data-dg><b>0</b><b>1</b><b>2</b><b>3</b><b>4</b><b>5</b><b>6</b><b>7</b><b>8</b><b>9</b></span></span>
                  </span>
                </span>
              </div>
              <div class="axis muted" aria-hidden="true"><span>2026</span><span>2031</span><span>2036</span><span>2041</span><span>2046</span></div>
            </div>

            <div class="mix">
              <div class="mix__bar" aria-hidden="true">
                <span class="seg seg--a" data-seg="0"></span>
                <span class="seg seg--b" data-seg="1"></span>
                <span class="seg seg--c" data-seg="2"></span>
              </div>
              <p class="mix__legend">
                <span>Stocks <b data-pc="0">80%</b></span>
                <span>Bonds <b data-pc="1">15%</b></span>
                <span>Cash <b data-pc="2">5%</b></span>
              </p>
            </div>

            <footer class="foot">
              <div class="goal">
                <p class="goal__row"><span class="muted" data-goal-word>Goal</span><b>&euro;120,000</b></p>
                <span class="goal__track"><span class="goal__fill" data-goal-fill></span></span>
              </div>
              <button class="btn" type="button" data-btn aria-pressed="false">
                <span class="btn__fill" data-btn-fill aria-hidden="true"></span>
                <span class="btn__face">
                  <span class="btn__words" data-btn-words>Start plan</span>
                  <svg class="btn__icon" viewBox="0 0 16 16" aria-hidden="true">
                    <path data-arrow d="M3.5 8h8.6M8.6 4.4L12.2 8l-3.6 3.6"/>
                    <path class="btn__check" data-check pathLength="1" d="M3.4 8.4l3 3 6.2-6.6"/>
                  </svg>
                </span>
              </button>
            </footer>
          </article>
        </div>
      </div>
    </section>
    <p class="sr" aria-live="polite" data-live></p>
  </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.

87 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 “Investment plan chart” 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 near black page, with two soft lights behind, lilac at the top left and mint at the bottom right, a dark glass card rises with layered shadows and an edge that catches the light at the top. At the top the Halden mark in a small mint square with a rising arrow, ‘Monthly plan · Balanced’ and the ‘€300 / month’ label; under it, the projected value in large type and, small, the deposits in lilac and the growth in mint. On arrival the rules of the chart draw one after the other and the portfolio bar stretches out piece by piece. Scrolling down the years go by: the mint line of the value moves on over the dashed lilac line of the deposits, the space between them fills with a mint gradient and a lilac veil stays below. A thin cursor walks with the months, its point riding the curve, and the year sits on a light pill under the chart, its digits rolling one by one and landing a hair past the mark; the years of the axis step aside as it passes. The value, the deposits and the growth count together. When the value reaches 10,000, 50,000 euros and the goal, a hairline rises on the curve and a glass tag pops on a spring with a blur that clears; the old ones dim softly, the goal is a mint pill with a checkmark. Meanwhile the portfolio moves from 80% stocks to 50%, bonds rise to 40%, and the goal bar fills up to ‘Goal reached’. In 2046 the ‘Start plan’ button gives under the finger and springs back, fills with mint from the left, the arrow leaves and a checkmark draws itself: ‘Plan started’. Scrolling back, everything comes apart again. With the pointer a soft light follows it on the card and the button can be pressed.

How it works

The month of the plan

The scroll drives a single GSAP timeline with ScrollTrigger and scrub: it carries a number from 0 to 240, the months from 2026 to 2046. The plan is worked out once at the start, month by month, with compound interest: on every update the month is read, even halfway, by interpolating between two.

Curves redrawn

The two lines and the two areas are SVG paths rebuilt on every update up to the current month, one point every two months: the growth area goes forward along the value line and back along the deposits line. The viewBox does not keep its proportions and the lines have vector-effect: non-scaling-stroke, so they stay thin at every size.

Cursor and milestones in percent

The cursor and its point sit at a fraction of the chart, width and height, so nothing needs recomputing on resize. Each milestone finds at the start the month the value reaches it and sits there; the scroll only decides when it is there, its entrance is a timed spring that can run backwards.

The rolling year

The year pill is made of four strips of digits: when the year changes, each column rolls on its own with back.out, the units a beat after the tens. Near the two edges the pill slides inwards so it never leaves the chart.

The sliding portfolio

The bar is three pieces in a flex row: their shares, from 80/15/5 to 50/40/10 on a soft curve, become each one's flex-grow, and the percentages below update with them.

Values to change

NameFileDefaultWhat it changes
RIDEscript.js1How much scroll the twenty years take: 2 is twice as long.
MONTHLYscript.js300The euros put in every month.
RATEscript.js6The plan's yearly return, in percent.
ROLLscript.js0.5The seconds the digits of the year take to roll.
POPscript.js2.2How far a milestone passes its size before it settles: 0 none.
GLOWscript.js1How strong the two lights behind the card are.

Try them in the Playground

When to use it

For the landing page of an investing app, an online bank, a pension fund or a savings plan: the section that tells, as you scroll, what a few euros a month become in twenty years and ends on the button to get started.

On phones

The same animation with adapted sizes: the value, the chart, the portfolio bar and the button are sized on the height too and the whole card fits in the box; under 360 pixels wide the deposits line goes away and the growth stays.

With reduced motion

No long scroll and no movement: the card fades in with the twenty years already drawn, the milestones in place, the goal reached and the portfolio at 50/40/10; the button changes with a fade.

Pitfalls

  • With preserveAspectRatio="none" the thickness of the lines would stretch along with the chart: vector-effect: non-scaling-stroke keeps them at a pixel and a half at every size.
  • The point on the curve does not live inside the SVG, which is stretched and would turn it oval: it is an HTML element placed at the same fraction of width and height.
  • The milestone tag already has its own transform in the CSS to centre on its hairline: GSAP moves the milestone's holder and the tag only for scale and blur, from the bottom centre.

Libraries

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

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

Testing

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