dynalgo 1.0.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 - nodes_exchange 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="-40 -40 80 80" preserveAspectRatio="xMidYMid meet">
<path id="β9" stroke-width="2" opacity="0" stroke="rgb(0,0,255)" d="M124 135 L79 -100 Z" />
<g id="libβ9" opacity="0">
  <text id="coβ9" x="101" y="17" dx="-5" dy="-3" fill="rgb(0,0,0)">β</text>
</g>
<path id="γ8" stroke-width="2" opacity="0" stroke="rgb(0,0,255)" d="M79 -100 L-103 59 Z" />
<g id="libγ8" opacity="0">
  <text id="coγ8" x="-12" y="-20" dx="-5" dy="-3" fill="rgb(0,0,0)">γ</text>
</g>
<path id="α7" stroke-width="2" opacity="0" stroke="rgb(0,0,255)" d="M-103 59 L124 135 Z" />
<g id="libα7" opacity="0">
  <text id="coα7" x="10" y="97" dx="-5" dy="-3" fill="rgb(0,0,0)">α</text>
</g>
<path id="γ6" stroke-width="2" opacity="0" stroke="rgb(0,0,255)" d="M-139 64 L139 -64 Z" />
<g id="libγ6" opacity="0">
  <text id="coγ6" x="0" y="0" dx="-5" dy="-3" fill="rgb(0,0,0)">γ</text>
</g>
<path id="β5" stroke-width="2" opacity="0" stroke="rgb(0,0,255)" d="M-76 -152 L76 152 Z" />
<g id="libβ5" opacity="0">
  <text id="coβ5" x="0" y="0" dx="-5" dy="-3" fill="rgb(0,0,0)">β</text>
</g>
<path id="α4" stroke-width="2" opacity="0" stroke="rgb(0,0,255)" d="M-114 -114 L-114 114 Z" />
<g id="libα4" opacity="0">
  <text id="coα4" x="-114" y="0" dx="-5" dy="-3" fill="rgb(0,0,0)">α</text>
</g>
<g id="A1" opacity="0">
  <circle id="cA1" cx="0" cy="0" r="20" fill="rgb(255,255,255)" stroke="rgb(0,0,255)" stroke-width="2"></circle>
  <text id="coA1" x="0" y="0" dx="-5" dy="5" 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 attributeName="viewBox" from="-40 -40 80 80" to="-40 -30 80 80" begin="1000ms" dur="1000ms" fill="freeze" />
<animateMotion xlink:href="#A1" begin="1000ms" dur="1000ms"
                    fill="freeze" path="m 0 0 l 0 10" />
<animate xlink:href="#cA1" attributeName="stroke" from="rgb(0,0,255)" to="rgb(128,139,150)" dur="1000ms" begin="1000ms" fill="freeze"/>
<g id="B2" opacity="0">
  <circle id="cB2" cx="0" cy="0" r="20" fill="rgb(255,255,255)" stroke="rgb(0,0,255)" stroke-width="2"></circle>
  <text id="coB2" x="0" y="0" dx="-5" dy="5" fill="rgb(0,0,0)">B</text>
</g>
<animate attributeName="viewBox" from="-40 -30 80 80" to="-40 -40 80 90" begin="2000ms" dur="1000ms" fill="freeze" />
<animate xlink:href="#B2" attributeName="opacity" from="0" to="1" dur="1000ms" begin="2000ms" fill="freeze"/>
<animate attributeName="viewBox" from="-40 -40 80 90" to="-40 -121 80 242" begin="3000ms" dur="1000ms" fill="freeze" />
<animateMotion xlink:href="#B2" begin="3000ms" dur="1000ms"
                    fill="freeze" path="m 0 0 l 0 81" />
<animate xlink:href="#cB2" attributeName="stroke" from="rgb(0,0,255)" to="rgb(128,139,150)" dur="1000ms" begin="3000ms" fill="freeze"/>
<animateMotion xlink:href="#A1" begin="3000ms" dur="1000ms"
                    fill="freeze" path="m 0 10 l 0 -91" />
<g id="C3" opacity="0">
  <circle id="cC3" cx="0" cy="0" r="20" fill="rgb(255,255,255)" stroke="rgb(0,0,255)" stroke-width="2"></circle>
  <text id="coC3" x="0" y="0" dx="-5" dy="5" fill="rgb(0,0,0)">C</text>
</g>
<animate xlink:href="#C3" attributeName="opacity" from="0" to="1" dur="1000ms" begin="4000ms" fill="freeze"/>
<animate attributeName="viewBox" from="-40 -121 80 242" to="-154 -154 308 308" begin="5000ms" dur="1000ms" fill="freeze" />
<animateMotion xlink:href="#B2" begin="5000ms" dur="1000ms"
                    fill="freeze" path="m 0 81 l -114 33" />
<animateMotion xlink:href="#A1" begin="5000ms" dur="1000ms"
                    fill="freeze" path="m 0 -81 l -114 -33" />
<animateMotion xlink:href="#C3" begin="5000ms" dur="1000ms"
                    fill="freeze" path="m 0 0 l 114 114" />
<animate xlink:href="#cC3" 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="-154 -154 308 308" to="-116 -192 232 384" begin="7000ms" dur="1000ms" fill="freeze" />
<animate xlink:href="#α4" begin="7000ms" fill="freeze" attributeName="d" dur="1000ms" values="M-114 -114 L-114 114 Z;M76 -152 L-76 -152 Z" />
<animateMotion xlink:href="#libα4" begin="7000ms" dur="1000ms" fill="freeze" path="m 0 0 l 114 -152" />
<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="#B2" begin="7000ms" dur="1000ms"
                    fill="freeze" path="m -114 114 l 38 -266" />
<animateMotion xlink:href="#A1" begin="7000ms" dur="1000ms"
                    fill="freeze" path="m -114 -114 l 190 -38" />
<animateMotion xlink:href="#C3" begin="7000ms" dur="1000ms"
                    fill="freeze" path="m 114 114 l -38 38" />
<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="-116 -192 232 384" to="-179 -104 358 208" begin="9000ms" dur="1000ms" fill="freeze" />
<animate xlink:href="#β5" begin="9000ms" fill="freeze" attributeName="d" dur="1000ms" values="M-76 -152 L76 152 Z;M53 64 L-139 64 Z" />
<animateMotion xlink:href="#libβ5" begin="9000ms" dur="1000ms" fill="freeze" path="m 0 0 l -43 64" />
<animate xlink:href="#β5" attributeName="stroke" from="rgb(0,0,255)" to="rgb(128,139,150)" dur="1000ms" begin="9000ms" fill="freeze"/>
<animate xlink:href="#α4" begin="9000ms" fill="freeze" attributeName="d" dur="1000ms" values="M76 -152 L-76 -152 Z;M139 -64 L53 64 Z" />
<animateMotion xlink:href="#libα4" begin="9000ms" dur="1000ms" fill="freeze" path="m 114 -152 l 96 152" />
<animateMotion xlink:href="#B2" begin="9000ms" dur="1000ms"
                    fill="freeze" path="m -76 -152 l 129 216" />
<animateMotion xlink:href="#A1" begin="9000ms" dur="1000ms"
                    fill="freeze" path="m 76 -152 l 63 88" />
<animateMotion xlink:href="#C3" begin="9000ms" dur="1000ms"
                    fill="freeze" path="m 76 152 l -215 -88" />
<animate xlink:href="#γ6" attributeName="opacity" from="0" to="1" dur="1000ms" begin="10000ms" fill="freeze"/>
<animate xlink:href="#libγ6" attributeName="opacity" from="0" to="1" dur="1000ms" begin="10000ms" fill="freeze"/>
<animate xlink:href="#biγ6" attributeName="opacity" from="0" to="1" dur="1000ms" begin="10000ms" fill="freeze"/>
<animate attributeName="viewBox" from="-179 -104 358 208" to="-143 -140 307 315" begin="11000ms" dur="1000ms" fill="freeze" />
<animate xlink:href="#β5" begin="11000ms" fill="freeze" attributeName="d" dur="1000ms" values="M53 64 L-139 64 Z;M124 135 L79 -100 Z" />
<animateMotion xlink:href="#libβ5" begin="11000ms" dur="1000ms" fill="freeze" path="m -43 64 l 144 -47" />
<animate xlink:href="#α4" begin="11000ms" fill="freeze" attributeName="d" dur="1000ms" values="M139 -64 L53 64 Z;M-103 59 L124 135 Z" />
<animateMotion xlink:href="#libα4" begin="11000ms" dur="1000ms" fill="freeze" path="m 210 0 l -86 97" />
<animate xlink:href="#γ6" begin="11000ms" fill="freeze" attributeName="d" dur="1000ms" values="M-139 64 L139 -64 Z;M79 -100 L-103 59 Z" />
<animateMotion xlink:href="#libγ6" begin="11000ms" dur="1000ms" fill="freeze" path="m 0 0 l -12 -20" />
<animate xlink:href="#γ6" attributeName="stroke" from="rgb(0,0,255)" to="rgb(128,139,150)" dur="1000ms" begin="11000ms" fill="freeze"/>
<animateMotion xlink:href="#B2" begin="11000ms" dur="1000ms"
                    fill="freeze" path="m 53 64 l 71 71" />
<animateMotion xlink:href="#A1" begin="11000ms" dur="1000ms"
                    fill="freeze" path="m 139 -64 l -242 123" />
<animateMotion xlink:href="#C3" begin="11000ms" dur="1000ms"
                    fill="freeze" path="m -139 64 l 218 -164" />
<animate xlink:href="#β5" attributeName="opacity" from="1" to="0" dur="1000ms" begin="12000ms" fill="freeze"/>
<animate xlink:href="#libβ5" attributeName="opacity" from="1" to="0" dur="1000ms" begin="12000ms" fill="freeze"/>
<animate xlink:href="#biβ5" attributeName="opacity" from="1" to="0" dur="1000ms" begin="12000ms" fill="freeze"/>
<animate xlink:href="#β5" attributeName="stroke" from="rgb(128,139,150)" to="rgb(255,0,0)" dur="1000ms" begin="12000ms" fill="freeze"/>
<animate xlink:href="#α4" attributeName="opacity" from="1" to="0" dur="1000ms" begin="12000ms" fill="freeze"/>
<animate xlink:href="#libα4" attributeName="opacity" from="1" to="0" dur="1000ms" begin="12000ms" fill="freeze"/>
<animate xlink:href="#biα4" attributeName="opacity" from="1" to="0" dur="1000ms" begin="12000ms" fill="freeze"/>
<animate xlink:href="#α4" attributeName="stroke" from="rgb(128,139,150)" to="rgb(255,0,0)" dur="1000ms" begin="12000ms" fill="freeze"/>
<animate xlink:href="#γ6" attributeName="opacity" from="1" to="0" dur="1000ms" begin="12000ms" fill="freeze"/>
<animate xlink:href="#libγ6" attributeName="opacity" from="1" to="0" dur="1000ms" begin="12000ms" fill="freeze"/>
<animate xlink:href="#biγ6" attributeName="opacity" from="1" to="0" dur="1000ms" begin="12000ms" fill="freeze"/>
<animate xlink:href="#γ6" attributeName="stroke" from="rgb(128,139,150)" to="rgb(255,0,0)" dur="1000ms" begin="12000ms" fill="freeze"/>
<animateMotion xlink:href="#B2" begin="13000ms" dur="1000ms"
                    fill="freeze" path="m 124 135 l -227 -76" />
<animateMotion xlink:href="#A1" begin="13000ms" dur="1000ms"
                    fill="freeze" path="m -103 59 l 227 76" />
<animate xlink:href="#γ8" attributeName="opacity" from="0" to="1" dur="1000ms" begin="14000ms" fill="freeze"/>
<animate xlink:href="#libγ8" attributeName="opacity" from="0" to="1" dur="1000ms" begin="14000ms" fill="freeze"/>
<animate xlink:href="#biγ8" attributeName="opacity" from="0" to="1" dur="1000ms" begin="14000ms" fill="freeze"/>
<animate xlink:href="#α7" attributeName="opacity" from="0" to="1" dur="1000ms" begin="14000ms" fill="freeze"/>
<animate xlink:href="#libα7" attributeName="opacity" from="0" to="1" dur="1000ms" begin="14000ms" fill="freeze"/>
<animate xlink:href="#biα7" attributeName="opacity" from="0" to="1" dur="1000ms" begin="14000ms" fill="freeze"/>
<animate xlink:href="#β9" attributeName="opacity" from="0" to="1" dur="1000ms" begin="14000ms" fill="freeze"/>
<animate xlink:href="#libβ9" attributeName="opacity" from="0" to="1" dur="1000ms" begin="14000ms" fill="freeze"/>
<animate xlink:href="#biβ9" attributeName="opacity" from="0" to="1" dur="1000ms" begin="14000ms" fill="freeze"/>
</svg>
  </body>
</html>