Skip to content
animorio
IT
Back to the library

Home solar dashboard

SVG, HoverGSAPMediumCompressed weight: Demo 12 KBGSAP 28 KBFreeDownload the zip

The Today card of a home solar panel app, dark with a warm light and grain: the bell curve of production draws itself from sunrise to sunset with a warm gradient under it, the dashed line of the house's consumption crosses it and the share sent to the grid lights up where production beats consumption. Above it, the arc of the sun: a small disc of light rides it at the hour under the pointer, a dot slides on the curve and the kW roll digit by digit. In the footer the day's total in kWh, the energy sent to the grid and the money saved.

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>
<!--
  "Home solar dashboard" 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 home solar production chart</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" data-stage>
    <!-- the Today card of Brightfold, an invented app for home solar: the day's production as a bell curve from
         sunrise to sunset, the house's consumption crossing it, the energy sent to the grid lit where production is
         higher, and over it all the arc of the sun, which follows the pointer along the day -->
    <article class="card" data-card>
      <header class="card__head">
        <span class="brand">
          <svg class="brand__mark" viewBox="0 0 20 20" aria-hidden="true">
            <path d="M3 14.5a7 7 0 0 1 14 0" />
            <circle cx="10" cy="14.5" r="2.6" />
            <path d="M2 17.5h16" />
          </svg>
          <span class="brand__name">Brightfold</span>
        </span>
        <span class="chip">
          <span class="chip__words">Today</span>
          <svg class="chip__chev" viewBox="0 0 10 10" aria-hidden="true"><path d="M2.5 4l2.5 2.5L7.5 4" /></svg>
        </span>
      </header>

      <section class="now" aria-label="Right now">
        <div class="now__main">
          <span class="label">Solar at <span class="now__time" data-time>1:10 PM</span></span>
          <p class="big"><span class="roll" data-roll="kw" data-dec="2" data-int="1"></span><span class="big__unit">kW</span></p>
        </div>
        <dl class="now__side">
          <div class="side">
            <dt class="side__label"><svg class="key key--home" viewBox="0 0 12 4" aria-hidden="true"><path d="M1 2h10" /></svg>Home</dt>
            <dd class="side__value"><span data-home>0.42</span> kW</dd>
          </div>
          <div class="side side--grid" data-grid-row>
            <dt class="side__label"><svg class="key key--grid" viewBox="0 0 12 4" aria-hidden="true"><path d="M1 2h10" /></svg><span data-grid-word>To grid</span></dt>
            <dd class="side__value"><span data-grid>4.20</span> kW</dd>
          </div>
        </dl>
      </section>

      <div class="chart" data-chart>
        <svg class="chart__svg" data-svg aria-hidden="true">
          <defs>
            <linearGradient id="sf-area" x1="0" y1="0" x2="0" y2="1">
              <stop offset="0" style="stop-color:var(--sun)" stop-opacity="0.34" />
              <stop offset="0.55" style="stop-color:var(--ember)" stop-opacity="0.12" />
              <stop offset="1" style="stop-color:var(--ember)" stop-opacity="0" />
            </linearGradient>
            <linearGradient id="sf-export" x1="0" y1="0" x2="0" y2="1">
              <stop offset="0" style="stop-color:var(--glow)" stop-opacity="0.78" />
              <stop offset="1" style="stop-color:var(--sun)" stop-opacity="0.22" />
            </linearGradient>
            <linearGradient id="sf-line" x1="0" y1="0" x2="1" y2="0">
              <stop offset="0" style="stop-color:var(--ember)" />
              <stop offset="0.5" style="stop-color:var(--glow)" />
              <stop offset="1" style="stop-color:var(--ember)" />
            </linearGradient>
            <radialGradient id="sf-disc">
              <stop offset="0" stop-color="#fffaf0" />
              <stop offset="0.38" style="stop-color:var(--glow)" />
              <stop offset="1" style="stop-color:var(--sun)" stop-opacity="0" />
            </radialGradient>
            <pattern id="sf-hatch" width="5" height="5" patternUnits="userSpaceOnUse" patternTransform="rotate(45)">
              <path d="M0 0v5" stroke="rgba(255,236,200,0.22)" stroke-width="1" />
            </pattern>
            <clipPath id="sf-clip-prod"><rect data-clip-prod x="0" y="-20" width="0" height="400" /></clipPath>
            <clipPath id="sf-clip-home"><rect data-clip-home x="0" y="-20" width="0" height="400" /></clipPath>
          </defs>

          <g class="grid" data-gridlines></g>
          <path class="arc" data-arc />
          <g clip-path="url(#sf-clip-prod)">
            <path class="area" data-area fill="url(#sf-area)" />
            <g class="export" data-export>
              <path class="export__fill" data-export-fill fill="url(#sf-export)" />
              <path class="export__hatch" data-export-hatch fill="url(#sf-hatch)" />
            </g>
            <path class="prod prod--soft" data-prod-soft />
            <path class="prod" data-prod stroke="url(#sf-line)" />
          </g>
          <path class="home" data-home-line clip-path="url(#sf-clip-home)" />
          <line class="base" data-base />
          <g class="ticks" data-ticks></g>

          <g class="scrub" data-scrub>
            <line class="scrub__hair" data-hair />
            <circle class="scrub__home" data-dot-home r="2.6" />
            <circle class="scrub__halo" data-dot-halo r="11" />
            <circle class="scrub__dot" data-dot r="3.4" />
          </g>
          <g class="sun" data-sun>
            <circle class="sun__glow" r="14" fill="url(#sf-disc)" />
            <circle class="sun__core" r="4.2" />
          </g>
        </svg>
        <span class="flag" data-flag><span data-flag-words>To grid</span></span>
      </div>

      <footer class="foot">
        <div class="stat">
          <span class="label">Produced</span>
          <p class="stat__value"><span class="roll" data-roll="total" data-dec="1" data-int="2"></span><span class="stat__unit">kWh</span></p>
        </div>
        <div class="stat">
          <span class="label">Sent to grid</span>
          <p class="stat__value"><span class="roll" data-roll="sent" data-dec="1" data-int="2"></span><span class="stat__unit">kWh</span></p>
        </div>
        <div class="stat stat--save">
          <span class="label">Saved</span>
          <p class="stat__value"><span class="stat__cur">&euro;</span><span class="roll" data-roll="saved" data-dec="2" data-int="1"></span></p>
        </div>
      </footer>
    </article>

    <svg class="pointer" data-pointer viewBox="0 0 20 24" aria-hidden="true">
      <path d="M3 2.2v17.2l4.4-4.1 2.9 6.4 2.7-1.2-2.9-6.3 6-.4z" />
    </svg>
    <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="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.

41 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 “Home solar dashboard” 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 dark warm page, with a low light and grain, the card of Brightfold rises, an invented app for home solar panels: at the top the mark of the sun on the horizon and the ‘Today’ pill, then ‘Solar at 1:10 PM’ with the big value in kW, beside it the house's consumption (‘Home’) and what goes to the grid (‘To grid’, which turns into ‘From grid’ when the house draws from the grid). Below, the chart of the day from 5 AM to 9 PM: the dashed lines of 2 and 4 kW, the hours at the bottom and the dotted arc of the sun from sunrise to sunset. The production curve draws itself from left to right, its line fading from orange to gold with a soft glow, the area under it filling with a warm gradient and the little valley of a cloud in the afternoon; with it the dashed blue line of consumption, with the humps of breakfast, lunch and dinner. Where the panels make more than the house uses, the band between the two lines lights up gold with a thin drifting hatch, and the ‘To grid’ label comes out. As the curve grows, the three figures at the bottom (Produced in kWh, Sent to grid, Saved in euros) roll digit by digit up to the day's total. Then a drawn pointer comes in and walks along the day: a thin line drops from the arc, the sun's disc of light rides it at that hour, a dot slides on the production curve and a ring on the consumption line, all on a spring that passes the mark and settles; the kW value and the time roll. Around midday the pointer presses: the dot swells and comes back and the grid band lights up more. The card's edge catches the light where the pointer goes. The real pointer does the same, and pressing on the chart lights up the band.

How it works

The day as numbers

Production is a sine between sunrise and sunset raised to 1.55 (a bell narrower at the top), times the peak and the valley of a cloud, a Gaussian in the afternoon. Consumption is a fixed base plus four Gaussians: breakfast, lunch, tea and dinner. The day is sampled in 320 steps and the totals are added up once, keeping the partials at each step so the figures can count while it draws.

An SVG measured in pixels

The viewBox is as big as the chart: x and y are real pixels, so the lines stay 1 px and the labels don't stretch. On resize (even halfway) a ResizeObserver rebuilds the lines, the curves, the arc and the grid band.

Drawing with a clipPath

Curve, area and grid band sit inside a clipping rectangle that widens with the drawn hour: everything advances together without measuring path lengths, and the consumption line has its own clip.

The band sent to the grid

The stretches where production beats consumption are found, with the exact crossing interpolated between two samples; the path goes forward along production and back along consumption. Two layers: the gold gradient and a hatch in a pattern that drifts slowly, faster while the pointer is inside it.

The sun on its arc and the rolling digits

The sun's disc sits at the hour's x and at the height of the ellipse that runs from sunrise to sunset; the hour follows the pointer on a spring. Each digit is a column from 0 to 9 plus a 0: the column eases to its digit every frame and, when it is shorter, goes from 9 round to 0.

Values to change

NameFileDefaultWhat it changes
PEAKscript.js4.6The panels' best output at midday, in kW.
CLOUDscript.js0.3How deep the dip of the afternoon cloud is (0 = clear sky).
SUNRISEscript.js6.2Sunrise, in hours (6.2 = 6:12).
SUNSETscript.js20.1Sunset, in hours.
DRAWscript.js3.2How long the curve takes to draw, in seconds.
PRICEscript.js0.31What a kWh from the grid costs, in euros (energy used from the panels saves this).
FEEDscript.js0.09What a kWh sent to the grid earns, in euros.
STIFFNESSscript.js190The spring that pulls the sun and the dot to the pointer: higher is quicker.
DAMPINGscript.js19Lower lets them pass the mark and come back.
SPEEDscript.js12 = the walk on its own twice as fast, 0.5 = half.
LOOPscript.jstrueDraws the day and walks along it again and again.

Try them in the Playground

When to use it

In the dashboard of a home energy app, a solar system, a home battery, an EV charger or an electricity supplier, and on the landing page of a solar panel seller: wherever you want to show at a glance how much energy was made and how much went to the grid. The colours are --sun, --ember, --glow and --home in the CSS, the data are prod() and home() in the script.

On phones

The same animations at adapted sizes: the card takes the full width minus the margins, the chart is measured on the height (36vh, between 130 and 200 px) and redrawn in pixels, the big figure and the totals with min(vw, vh). With a finger you slide over the chart and the sun follows.

With reduced motion

The chart fades in already drawn; there is no drawn pointer and the sun, the dot and the figures jump to four hours of the day without sliding. With the real pointer they move at once, without the spring.

Pitfalls

  • Digits that roll with a continuous position sit halfway between two numbers and read badly: each column has to go to a whole digit and stop there.
  • An SVG gradient with stop-color="var(--sun)" as an attribute does not read CSS variables: it goes in the stop's style.
  • A grid band built only on the samples leaves a step where the two lines cross: the crossing has to be interpolated between the sample before and the one after.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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