Skip to content
animorio
IT
Back to the library

Decision flowchart

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

A flowchart of yes-or-no questions that leads to the right plan, for a product’s pricing page. With each answer its branch draws in green to the next question, which wakes with a bounce, while the other branch dims. At the bottom the plan you reach lights up. Hover a plan and the route to it shows as a dashed line.

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>
<!--
  "Decision flowchart" 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>Decision flowchart</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">
    <!-- a yes-or-no flowchart that leads to the right plan: each answer draws its branch and wakes the next
         question, the other side dims; point at a plan and the route to it shows -->
    <section class="fc" data-fc aria-label="Which plan fits you">
      <div class="fc__map" data-map>
        <svg viewBox="0 0 320 250" aria-hidden="true" data-svg></svg>
      </div>
      <footer class="fc__foot">
        <span class="fc__roll fc__say"><span data-say aria-live="polite">Two questions to your plan</span></span>
        <button class="fc__reset" type="button" data-reset aria-disabled="true">
          <svg viewBox="0 0 16 16" aria-hidden="true"><path d="M6.500 3.500 3 7l3.500 3.500M3.500 7H10a3 3 0 0 1 0 6H8"></path></svg>
          Start over
        </button>
      </footer>
    </section>

    <svg class="ghost" data-ghost viewBox="0 0 24 24" aria-hidden="true"><path d="M5 3.200 19.200 11l-6.300 1.600-3.300 5.900Z"></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.

11 values to change

Works with Claude, Claude Code, ChatGPT, Cursor, VS Code, Windsurf, Codex, Gemini CLI

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 “Decision flowchart” 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 ground, a dark card with a tree: at the top the question “Team of more than 5?”, with two curved branches coming down from it and the “Yes” and “No” pills halfway along; below, two more questions still dim, and at the bottom four plans: Business, Team, Pro, Free. Answer, and the chosen pill turns green while its branch draws from top to bottom; when the line arrives the question below lights up with a bounce and its two answers become tappable, while the other branch and the other answer dim. On the second answer the line reaches a plan, which fills with green, and below appears “Team is the plan for you”. Hover another plan and its route is dashed in green over the tree. An answer already given can be changed: what was below withdraws. “Start over” takes it all back to the start.

How it works

The tree is an object

Each question says where yes and no lead. Everything is built from that: for each answer a Bézier curve from the bottom of the question to the top of the next node, with the pill at the curve’s midpoint.

Lines in the svg, real nodes on top

The branches live in an svg; questions, answers and plans are HTML elements placed in percentages on the same coordinates, so the answers are real buttons and the text stays crisp.

The chosen branch draws itself

Over every grey branch sits its green copy with pathLength 1: on an answer stroke-dashoffset goes from 1 to 0, and the node it reaches bounces after a delay worth nearly the whole draw.

The route in reverse

Every node knows its parent and the answer that leads to it: hovering a plan climbs back to the top and dashes the branches met on the way.

Values to change

NameFileDefaultWhat it changes
ACCENTscript.js#7fe0a2The colour of the chosen route and of the plan reached.
DRAWscript.js0.5How many seconds a branch takes to draw after the answer.
SPRINGscript.js1How much the waking question and the plan reached bounce: 0.3 = a little, 2 = a lot.
LOOPscript.jstrueLeft alone, the demo’s pointer answers, looks at another route and starts over.

Try them in the Playground

When to use it

On a product’s pricing page, above the plan table, for people who do not know which to pick; in a help centre that reaches the right answer in two questions; in a shop, to land on the right size or model.

On phones

The same card, as wide as the screen: the tree narrows in proportion, the answer pills stay 38 by 24 pixels with room around them, and the route to a plan shows once you have answered your way there.

With reduced motion

The chosen branch appears already drawn and the next question lights up with no bounce; the text changes at once. The demo does not move by itself.

Pitfalls

  • Questions and plans are made up: with real ones the tree should be written with someone who knows the product, and each plan reached must lead to its row in the pricing table.
  • The answers of questions not yet reached stay in the DOM: they carry aria-disabled and leave the Tab order, or you could answer a question that was never asked.
  • The nodes are placed with a transform to centre them: the scale animation goes on the element inside, or GSAP wipes out the centring.
  • Changing an answer higher up must clear the ones below, or two routes stay lit.
  • Hover on plans does not exist with a finger: the route to a plan must not be the only way to understand how to get there.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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