Skip to content
animorio
IT
Back to the library

Home energy flow

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

The energy panel of a smart-home app: four nodes (solar panels, grid, battery, home) joined by thin lines with streaks of light running the way the power goes, faster when there is more of it. Below, three moments of the day: switching them changes who feeds whom, the numbers count, the battery fills or empties and the self-powered share rolls. Hovering a node keeps only its own lines lit.

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 energy flow" 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>Home energy flow with light running between solar, battery and grid</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 energy panel of a smart-home app: four nodes (solar, grid, battery, home) joined by thin lines; streaks of
         light run along the lines in the direction the power is going, faster when there is more of it; the three
         moments of the day below change who feeds whom, the numbers count, the battery fills or empties and the
         self-powered share rolls; hovering a node keeps only its own lines lit -->
    <section class="panel" data-panel aria-label="Home energy">
      <span class="panel__sky" aria-hidden="true"></span>
      <header class="top">
        <div>
          <p class="top__brand">Halo Home</p>
          <h1 class="top__title">Home energy</h1>
        </div>
        <p class="self"><span class="self__n"><span data-self>100</span>%</span><span class="self__l">self-powered</span></p>
      </header>

      <div class="plot">
        <svg data-plot viewBox="0 0 340 292" role="img" aria-label="Diagram of the power flowing between solar panels, the grid, the battery and the home">
          <defs>
            <filter id="soft" x="-50%" y="-50%" width="200%" height="200%"><feGaussianBlur stdDeviation="3.2"></feGaussianBlur></filter>
            <filter id="halo" x="-80%" y="-80%" width="260%" height="260%"><feGaussianBlur stdDeviation="9"></feGaussianBlur></filter>
          </defs>

          <g class="links">
            <g class="link link--solar" data-link="sh"><path class="link__base" d="M170 74V226"></path><path class="link__glow" d="M170 74V226"></path><path class="link__run" d="M170 74V226"></path></g>
            <g class="link link--solar" data-link="sg"><path class="link__base" d="M145 57C90 62 46 80 46 120"></path><path class="link__glow" d="M145 57C90 62 46 80 46 120"></path><path class="link__run" d="M145 57C90 62 46 80 46 120"></path></g>
            <g class="link link--solar" data-link="sb"><path class="link__base" d="M195 57C250 62 294 80 294 120"></path><path class="link__glow" d="M195 57C250 62 294 80 294 120"></path><path class="link__run" d="M195 57C250 62 294 80 294 120"></path></g>
            <g class="link link--grid" data-link="gh"><path class="link__base" d="M46 180C46 240 90 272 145 269"></path><path class="link__glow" d="M46 180C46 240 90 272 145 269"></path><path class="link__run" d="M46 180C46 240 90 272 145 269"></path></g>
            <g class="link link--battery" data-link="bh"><path class="link__base" d="M294 180C294 240 250 272 195 269"></path><path class="link__glow" d="M294 180C294 240 250 272 195 269"></path><path class="link__run" d="M294 180C294 240 250 272 195 269"></path></g>
          </g>

          <g class="node node--solar" data-node="solar" transform="translate(170 44)">
            <g data-in>
              <circle class="node__halo" r="24" filter="url(#halo)"></circle>
              <circle class="node__disc" r="28"></circle>
              <g class="node__icon">
                <circle cx="0" cy="-8" r="3.3"></circle>
                <g data-rays><path d="M0-14.4v-2.2M0-1.6v2.2M-6.4-8h-2.2M6.4-8h2.2M-4.5-12.5l-1.6-1.6M4.5-3.5l1.6 1.6M-4.5-3.5l-1.6 1.6M4.5-12.5l1.6-1.6"></path></g>
              </g>
              <text class="node__value" y="15"><tspan data-v="solar">4.2</tspan><tspan class="node__unit" dx="2">kW</tspan></text>
            </g>
            <text class="node__name" x="38" y="-14">Solar</text>
            <text class="node__sub" x="38" y="-1" data-sub="solar">Producing</text>
          </g>

          <g class="node node--grid" data-node="grid" transform="translate(46 150)">
            <g data-in>
              <circle class="node__halo" r="24" filter="url(#halo)"></circle>
              <circle class="node__disc" r="28"></circle>
              <g class="node__icon"><path d="M0-15.5-4.6-1.5M0-15.5 4.6-1.5M-3.3-5.6h6.6M-6.6-11.2h13.2M-1.8-11.2-3.3-5.6M1.8-11.2 3.3-5.6"></path></g>
              <text class="node__value" y="15"><tspan data-v="grid">0.7</tspan><tspan class="node__unit" dx="2">kW</tspan></text>
            </g>
            <text class="node__name" x="38" y="-1">Grid</text>
            <text class="node__sub" x="38" y="13" data-sub="grid">Exporting</text>
          </g>

          <g class="node node--battery" data-node="battery" transform="translate(294 150)">
            <g data-in>
              <circle class="node__halo" r="24" filter="url(#halo)"></circle>
              <circle class="node__disc" r="28"></circle>
              <g class="node__icon"><rect x="-8" y="-13" width="15" height="9" rx="2.6"></rect><path d="M9.2-10.2v3.4"></path><rect class="node__level" data-level x="-6" y="-11" width="11" height="5" rx="1.2"></rect></g>
              <text class="node__value" y="15"><tspan data-v="battery">1.9</tspan><tspan class="node__unit" dx="2">kW</tspan></text>
            </g>
            <text class="node__name node__name--end" x="-38" y="-1">Battery</text>
            <text class="node__sub node__name--end" x="-38" y="13" data-sub="battery">Charging, 62%</text>
          </g>

          <g class="node node--home" data-node="home" transform="translate(170 256)">
            <g data-in>
              <circle class="node__halo" r="24" filter="url(#halo)"></circle>
              <circle class="node__disc" r="28"></circle>
              <g class="node__icon"><path d="M-7.2-6.4 0-13.4 7.2-6.4V-0.6H-7.2Z"></path><rect class="node__window" x="-2" y="-7.2" width="4" height="4" rx="0.8"></rect></g>
              <text class="node__value" y="15"><tspan data-v="home">1.6</tspan><tspan class="node__unit" dx="2">kW</tspan></text>
            </g>
            <text class="node__name" x="38" y="-12">Home</text>
            <text class="node__sub" x="38" y="1" data-sub="home">Using</text>
          </g>
        </svg>
      </div>

      <div class="seg" data-seg role="group" aria-label="Moment of the day">
        <span class="seg__pill" data-pill aria-hidden="true"></span>
        <button type="button" data-scene="0" aria-pressed="true">Midday</button>
        <button type="button" data-scene="1" aria-pressed="false">Evening</button>
        <button type="button" data-scene="2" aria-pressed="false">Night</button>
      </div>
    </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.

40 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 energy flow” 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

In the middle, on black, a dark panel with soft corners and a warm light coming down from the top. At the head ‘Home energy’ and, on the right, the self-powered share. In the middle four round nodes: the sun at the top, the grid on the left, the battery on the right, the home at the bottom; each has its drawn icon, its kilowatts and a line saying what it is doing. Thin lines join them. At midday three amber streaks of light leave the sun: one goes straight down to the home, one curves to the battery, which charges, one to the grid, where the rest is sold; the more kilowatts pass, the faster the streak runs, and the sun’s rays turn slowly. Below, a control with three moments: Midday, Evening, Night. Tapping Evening the pill slides on a spring, the panel’s light turns orange, the numbers count to the new values, the nodes give a small elastic kick one after the other: the sun goes almost out, the green streak leaves the battery for the home and the blue one leaves the grid, the level in the battery drops and the self-powered share rolls to 75%. At night only the blue streak from the grid is left. Hovering a node, the lines that do not touch it dim, its own thicken and the node grows slightly. Left alone, a pointer goes through the day and stops on a node each time.

How it works

Lines and streaks

Each connection is the same SVG path three times: an almost invisible base line, the streak (a dash STREAK long with a gap of 58 units) and a wider blurred copy for the glow. The path is drawn in the direction of the power, so it is enough to bring stroke-dashoffset down.

One clock

A function on GSAP’s ticker moves all the streaks: at every frame a line’s offset advances by 26 plus 46 times its kilowatts, times FLOW. Each line also has an opacity that the changes of moment take to 0 or 1: a line with no power does not move and is not seen.

The three moments

SCENES keeps for each moment the values of the four nodes, the battery level, the self-powered share and the kilowatts of each line. go() animates a single object with the current numbers (the texts, the battery bar and the percentage are rewritten at every step), turns the lines on and off and gives each node a staggered elastic kick.

The control

The control’s pill is an absolute element: it takes the offsetLeft and offsetWidth of the chosen button and goes there with elastic.out. It is measured again on resize and when the fonts arrive.

The node under the pointer

ENDS says which two nodes each line joins. On a node, the lines that do not contain it drop to 22% and its streaks go from 2.2 to 3 in width; the other nodes stay full only if at that moment they exchange power with it.

Values to change

NameFileDefaultWhat it changes
STARTscript.js0Which moment it starts from: 0 midday, 1 evening, 2 night.
FLOWscript.js1How fast the light runs on the lines (1 = normal).
STREAKscript.js22How long each streak of light is, in drawing units.
COUNTscript.js0.9In how many seconds the numbers reach the new value.
SPRINGscript.js0.8How long the spring of the nodes and the control lasts, in seconds.
SOLARscript.js#ffc24aThe colour of the sun and its energy.
BATTERYscript.js#45d99aThe colour of the battery.
GRIDscript.js#8291ffThe colour of the grid.
PAUSEscript.js1.8By itself: how many seconds it stays on each moment.
LOOPscript.jstrueLeft alone, a pointer changes moment and hovers the nodes.

Try them in the Playground

When to use it

For the dashboard of a smart-home app, an energy supplier, a solar or battery installer, a charging station: the tile that shows at a glance where the power comes from and where it goes. With other nodes it suits any flow: money between accounts, data between services, goods between warehouses.

On phones

The same panel: its width is worked out from the screen height too, so the drawing, the head and the control always fit. No hover: a tap on a node keeps it lit, another tap lets it go.

With reduced motion

The streaks do not run: the lines carrying power stay lit and still, dashed. The numbers, the control’s pill and the battery go straight to the new value, the words change with a fade and the nodes give no kick.

Pitfalls

  • The nodes are positioned with the group’s transform attribute: GSAP’s scale sits on an inner group with svgOrigin 0 0, otherwise the node jumps to the corner.
  • The dash period is STREAK plus 58: the offset must be kept inside that period with the remainder of the division, or after a few minutes the number grows without end.
  • The panel’s width depends on 100vh: without that limit, in a short wide window the control ends up below the edge.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

Compressed with gzip, the three demo files weigh 7.4 KB; the libraries: GSAP 28 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