dynalgo 1.1.0

A tiny library designed to produce animated SVG images that can illustrate graph algorithms in action.
Documentation

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="cache-control" content="no-cache, must-revalidate">
    <meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Dynalgo - svg_node_move example</title>
    <style>
        html,
        body {
            margin: 0;
            padding: 0;
            overflow: hidden;
        }
        #svg_dynalgo {
            position: fixed;
            top: 0;
            bottom: 0;
            left: 0;
            right: 0;
            width: 100%;
            height: 100vh;
    }
    </style>
    <script>
        function pause(svg) {
            if (svg.animationsPaused()) {
                svg.unpauseAnimations();
            } else {
                svg.pauseAnimations();
            }
        }
    </script>
  </head>
  <body>
<svg id="svg_dynalgo" onclick="pause(this)" viewBox="-90 -40 80 80" preserveAspectRatio="xMidYMid meet">
<path id="β5" stroke-width="2" opacity="0" stroke="rgb(0,0,255)" d="M162 -115 L450 400 Z" />
<g id="libβ5" opacity="0">
  <text id="mβ5" x="306" y="142" dx="-5" dy="-5"  fill="rgb(0,0,0)">20</text>
</g>
<path id="α4" stroke-width="2" opacity="0" stroke="rgb(0,0,255)" d="M-50 0 L224 -224 Z" />
<g id="libα4" opacity="0">
  <text id="mα4" x="87" y="-112" dx="-5" dy="-5"  fill="rgb(0,0,0)">10</text>
</g>
<g id="A1" opacity="0">
  <circle id="cA1" cx="-50" cy="0" r="20" fill="rgb(255,255,255)" stroke="rgb(0,0,255)" stroke-width="2"></circle>
  <text id="coA1" x="-50" y="0" dx="-6" dy="6" fill="rgb(0,0,0)">A</text>
</g>
<animate xlink:href="#A1" attributeName="opacity" from="0" to="1" dur="1000ms" begin="0ms" fill="freeze"/>
<animate xlink:href="#cA1" attributeName="stroke" from="rgb(0,0,255)" to="rgb(128,139,150)" dur="1000ms" begin="1000ms" fill="freeze"/>
<g id="C2" opacity="0">
  <circle id="cC2" cx="450" cy="400" r="20" fill="rgb(255,255,255)" stroke="rgb(0,0,255)" stroke-width="2"></circle>
  <text id="coC2" x="450" y="400" dx="-6" dy="6" fill="rgb(0,0,0)">C</text>
</g>
<animate attributeName="viewBox" from="-90 -40 80 80" to="-90 -40 580 480" begin="2000ms" dur="1000ms" fill="freeze" />
<animate xlink:href="#C2" attributeName="opacity" from="0" to="1" dur="1000ms" begin="2000ms" fill="freeze"/>
<animate xlink:href="#cC2" attributeName="stroke" from="rgb(0,0,255)" to="rgb(128,139,150)" dur="1000ms" begin="3000ms" fill="freeze"/>
<g id="B3" opacity="0">
  <circle id="cB3" cx="0" cy="0" r="20" fill="rgb(255,255,255)" stroke="rgb(0,0,255)" stroke-width="2"></circle>
  <text id="coB3" x="0" y="0" dx="-6" dy="6" fill="rgb(0,0,0)">B</text>
</g>
<animate xlink:href="#B3" attributeName="opacity" from="0" to="1" dur="1000ms" begin="4000ms" fill="freeze"/>
<animate attributeName="viewBox" from="-90 -40 580 480" to="-90 -264 580 704" begin="5000ms" dur="1000ms" fill="freeze" />
<animateMotion xlink:href="#B3" begin="5000ms" dur="1000ms"
                    fill="freeze" path="m 0 0 l 224 -224" />
<animate xlink:href="#cB3" attributeName="stroke" from="rgb(0,0,255)" to="rgb(128,139,150)" dur="1000ms" begin="5000ms" fill="freeze"/>
<animate xlink:href="#α4" attributeName="opacity" from="0" to="1" dur="1000ms" begin="6000ms" fill="freeze"/>
<animate xlink:href="#libα4" attributeName="opacity" from="0" to="1" dur="1000ms" begin="6000ms" fill="freeze"/>
<animate xlink:href="#biα4" attributeName="opacity" from="0" to="1" dur="1000ms" begin="6000ms" fill="freeze"/>
<animate attributeName="viewBox" from="-90 -264 580 704" to="-90 -155 580 595" begin="7000ms" dur="1000ms" fill="freeze" />
<animate xlink:href="#α4" begin="7000ms" fill="freeze" attributeName="d" dur="1000ms" values="M-50 0 L224 -224 Z;M-50 0 L162 -115 Z" />
<animateMotion xlink:href="#libα4" begin="7000ms" dur="1000ms" fill="freeze" path="m 0 0 l -31 55" />
<animate xlink:href="#α4" attributeName="stroke" from="rgb(0,0,255)" to="rgb(128,139,150)" dur="1000ms" begin="7000ms" fill="freeze"/>
<animateMotion xlink:href="#B3" begin="7000ms" dur="1000ms"
                    fill="freeze" path="m 224 -224 l -62 109" />
<animate xlink:href="#β5" attributeName="opacity" from="0" to="1" dur="1000ms" begin="8000ms" fill="freeze"/>
<animate xlink:href="#libβ5" attributeName="opacity" from="0" to="1" dur="1000ms" begin="8000ms" fill="freeze"/>
<animate xlink:href="#biβ5" attributeName="opacity" from="0" to="1" dur="1000ms" begin="8000ms" fill="freeze"/>
<animate attributeName="viewBox" from="-90 -155 580 595" to="-90 -40 580 480" begin="9000ms" dur="1000ms" fill="freeze" />
<animate xlink:href="#α4" begin="9000ms" fill="freeze" attributeName="d" dur="1000ms" values="M-50 0 L162 -115 Z;M-50 0 L207 186 Z" />
<animateMotion xlink:href="#libα4" begin="9000ms" dur="1000ms" fill="freeze" path="m -31 55 l 22 150" />
<animate xlink:href="#β5" begin="9000ms" fill="freeze" attributeName="d" dur="1000ms" values="M162 -115 L450 400 Z;M207 186 L450 400 Z" />
<animateMotion xlink:href="#libβ5" begin="9000ms" dur="1000ms" fill="freeze" path="m 0 0 l 22 151" />
<animate xlink:href="#β5" attributeName="stroke" from="rgb(0,0,255)" to="rgb(128,139,150)" dur="1000ms" begin="9000ms" fill="freeze"/>
<animateMotion xlink:href="#B3" begin="9000ms" dur="1000ms"
                    fill="freeze" path="m 162 -115 l 45 301" />
<animate xlink:href="#α4" begin="10000ms" fill="freeze" attributeName="d" dur="1000ms" values="M-50 0 L207 186 Z;M-50 0 L0 0 Z" />
<animateMotion xlink:href="#libα4" begin="10000ms" dur="1000ms" fill="freeze" path="m -9 205 l -103 -93" />
<animate xlink:href="#β5" begin="10000ms" fill="freeze" attributeName="d" dur="1000ms" values="M207 186 L450 400 Z;M0 0 L450 400 Z" />
<animateMotion xlink:href="#libβ5" begin="10000ms" dur="1000ms" fill="freeze" path="m 22 151 l -103 -93" />
<animateMotion xlink:href="#B3" begin="10000ms" dur="1000ms"
                    fill="freeze" path="m 207 186 l -207 -186" />
<animate xlink:href="#α4" begin="11000ms" fill="freeze" attributeName="d" dur="1000ms" values="M-50 0 L0 0 Z;M-50 0 L0 400 Z" />
<animateMotion xlink:href="#libα4" begin="11000ms" dur="1000ms" fill="freeze" path="m -112 112 l 0 200" />
<animate xlink:href="#β5" begin="11000ms" fill="freeze" attributeName="d" dur="1000ms" values="M0 0 L450 400 Z;M0 400 L450 400 Z" />
<animateMotion xlink:href="#libβ5" begin="11000ms" dur="1000ms" fill="freeze" path="m -81 58 l 0 200" />
<animateMotion xlink:href="#B3" begin="11000ms" dur="1000ms"
                    fill="freeze" path="m 0 0 l 0 400" />
<animate xlink:href="#α4" begin="12000ms" fill="freeze" attributeName="d" dur="1000ms" values="M-50 0 L0 400 Z;M-50 0 L400 400 Z" />
<animateMotion xlink:href="#libα4" begin="12000ms" dur="1000ms" fill="freeze" path="m -112 312 l 200 0" />
<animate xlink:href="#β5" begin="12000ms" fill="freeze" attributeName="d" dur="1000ms" values="M0 400 L450 400 Z;M400 400 L450 400 Z" />
<animateMotion xlink:href="#libβ5" begin="12000ms" dur="1000ms" fill="freeze" path="m -81 258 l 200 0" />
<animateMotion xlink:href="#B3" begin="12000ms" dur="1000ms"
                    fill="freeze" path="m 0 400 l 400 0" />
<animate xlink:href="#α4" begin="13000ms" fill="freeze" attributeName="d" dur="1000ms" values="M-50 0 L400 400 Z;M-50 0 L400 0 Z" />
<animateMotion xlink:href="#libα4" begin="13000ms" dur="1000ms" fill="freeze" path="m 88 312 l 0 -200" />
<animate xlink:href="#β5" begin="13000ms" fill="freeze" attributeName="d" dur="1000ms" values="M400 400 L450 400 Z;M400 0 L450 400 Z" />
<animateMotion xlink:href="#libβ5" begin="13000ms" dur="1000ms" fill="freeze" path="m 119 258 l 0 -200" />
<animateMotion xlink:href="#B3" begin="13000ms" dur="1000ms"
                    fill="freeze" path="m 400 400 l 0 -400" />
<animate xlink:href="#α4" begin="14000ms" fill="freeze" attributeName="d" dur="1000ms" values="M-50 0 L400 0 Z;M-50 0 L0 0 Z" />
<animateMotion xlink:href="#libα4" begin="14000ms" dur="1000ms" fill="freeze" path="m 88 112 l -200 0" />
<animate xlink:href="#β5" begin="14000ms" fill="freeze" attributeName="d" dur="1000ms" values="M400 0 L450 400 Z;M0 0 L450 400 Z" />
<animateMotion xlink:href="#libβ5" begin="14000ms" dur="1000ms" fill="freeze" path="m 119 58 l -200 0" />
<animateMotion xlink:href="#B3" begin="14000ms" dur="1000ms"
                    fill="freeze" path="m 400 0 l -400 0" />
</svg>
  </body>
</html>