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 - This is the example n°1</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="-138 -154 292 308" preserveAspectRatio="xMidYMid meet">
<path id="ε12" stroke-width="2" opacity="0" stroke="rgb(0,0,255)" d="M-75 -165 L75 165 Z" />
<g id="libε12" opacity="0">
  <text id="mε12" x="0" y="0" dx="-5" dy="-5"  fill="rgb(0,0,0)">50</text>
</g>
<text id="biε12" fill="rgb(0,0,0)" opacity="0">
<textpath startOffset="20" xlink:href="#ε12"></textpath>
</text>
<path id="δ11" stroke-width="2" opacity="0" stroke="rgb(0,0,255)" d="M-119 153 L-119 -153 Z" />
<g id="libδ11" opacity="0">
  <text id="mδ11" x="-119" y="0" dx="-5" dy="-5"  fill="rgb(0,0,0)">40</text>
</g>
<text id="biδ11" fill="rgb(0,0,0)" opacity="0">
<textpath startOffset="20" xlink:href="#δ11"></textpath>
</text>
<path id="β9" stroke-width="2" opacity="0" stroke="rgb(0,0,255)" d="M114 3 L-98 114 Z" />
<g id="libβ9" opacity="0">
  <text id="mβ9" x="8" y="58" dx="-5" dy="-5"  fill="rgb(0,0,0)">20</text>
</g>
<path id="γ8" stroke-width="2" opacity="0" stroke="rgb(0,0,255)" d="M-98 114 L-95 -114 Z" />
<g id="libγ8" opacity="0">
  <text id="mγ8" x="-96" y="0" dx="-5" dy="-5"  fill="rgb(0,0,0)">30</text>
</g>
<path id="α7" stroke-width="2" opacity="0" stroke="rgb(0,0,255)" d="M-95 -114 L114 3 Z" />
<g id="libα7" opacity="0">
  <text id="mα7" x="9" y="-55" dx="-5" dy="-5"  fill="rgb(0,0,0)">10</text>
</g>
<path id="γ6" stroke-width="2" opacity="0" stroke="rgb(0,0,255)" d="M0 0 L0 0 Z" />
<g id="libγ6" opacity="0">
  <text id="mγ6" x="0" y="0" dx="-5" dy="-5"  fill="rgb(0,0,0)">30</text>
</g>
<path id="β5" stroke-width="2" opacity="0" stroke="rgb(0,0,255)" d="M0 0 L0 0 Z" />
<g id="libβ5" opacity="0">
  <text id="mβ5" x="0" y="0" 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="M0 0 L0 0 Z" />
<g id="libα4" opacity="0">
  <text id="mα4" x="0" y="0" dx="-5" dy="-5"  fill="rgb(0,0,0)">10</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>
<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>
<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="#α4" begin="0ms" fill="freeze" attributeName="d" dur="1000ms" values="M0 0 L0 0 Z;M-95 -114 L114 3 Z" />
<animateMotion xlink:href="#libα4" begin="0ms" dur="1000ms" fill="freeze" path="m 0 0 l 9 -55" />
<animate xlink:href="#α4" attributeName="opacity" from="0" to="1" dur="1000ms" begin="0ms" fill="freeze"/>
<animate xlink:href="#libα4" attributeName="opacity" from="0" to="1" dur="1000ms" begin="0ms" fill="freeze"/>
<animate xlink:href="#biα4" attributeName="opacity" from="0" to="1" dur="1000ms" begin="0ms" fill="freeze"/>
<animate xlink:href="#β5" begin="0ms" fill="freeze" attributeName="d" dur="1000ms" values="M0 0 L0 0 Z;M114 3 L-98 114 Z" />
<animateMotion xlink:href="#libβ5" begin="0ms" dur="1000ms" fill="freeze" path="m 0 0 l 8 58" />
<animate xlink:href="#β5" attributeName="opacity" from="0" to="1" dur="1000ms" begin="0ms" fill="freeze"/>
<animate xlink:href="#libβ5" attributeName="opacity" from="0" to="1" dur="1000ms" begin="0ms" fill="freeze"/>
<animate xlink:href="#biβ5" attributeName="opacity" from="0" to="1" dur="1000ms" begin="0ms" fill="freeze"/>
<animate xlink:href="#γ6" begin="0ms" fill="freeze" attributeName="d" dur="1000ms" values="M0 0 L0 0 Z;M-98 114 L-95 -114 Z" />
<animateMotion xlink:href="#libγ6" begin="0ms" dur="1000ms" fill="freeze" path="m 0 0 l -96 0" />
<animate xlink:href="#γ6" attributeName="opacity" from="0" to="1" dur="1000ms" begin="0ms" fill="freeze"/>
<animate xlink:href="#libγ6" attributeName="opacity" from="0" to="1" dur="1000ms" begin="0ms" fill="freeze"/>
<animate xlink:href="#biγ6" attributeName="opacity" from="0" to="1" dur="1000ms" begin="0ms" fill="freeze"/>
<animateMotion xlink:href="#C3" begin="0ms" dur="1000ms"
                    fill="freeze" path="m 0 0 l -98 114" />
<animate xlink:href="#C3" attributeName="opacity" from="0" to="1" dur="1000ms" begin="0ms" fill="freeze"/>
<animateMotion xlink:href="#A1" begin="0ms" dur="1000ms"
                    fill="freeze" path="m 0 0 l -95 -114" />
<animate xlink:href="#A1" attributeName="opacity" from="0" to="1" dur="1000ms" begin="0ms" fill="freeze"/>
<animateMotion xlink:href="#B2" begin="0ms" dur="1000ms"
                    fill="freeze" path="m 0 0 l 114 3" />
<animate xlink:href="#B2" attributeName="opacity" from="0" to="1" dur="1000ms" begin="0ms" fill="freeze"/>
<animate xlink:href="#α4" attributeName="opacity" from="1" to="0" dur="1000ms" begin="1000ms" fill="freeze"/>
<animate xlink:href="#libα4" attributeName="opacity" from="1" to="0" dur="1000ms" begin="1000ms" fill="freeze"/>
<animate xlink:href="#biα4" attributeName="opacity" from="1" to="0" dur="1000ms" begin="1000ms" fill="freeze"/>
<animate xlink:href="#α4" attributeName="stroke" from="rgb(0,0,255)" to="rgb(255,0,0)" dur="1000ms" begin="1000ms" fill="freeze"/>
<animate xlink:href="#α4" attributeName="stroke" from="rgb(0,0,255)" to="rgb(255,0,0)" dur="1000ms" begin="1000ms" fill="freeze"/>
<animate xlink:href="#β5" attributeName="opacity" from="1" to="0" dur="1000ms" begin="1000ms" fill="freeze"/>
<animate xlink:href="#libβ5" attributeName="opacity" from="1" to="0" dur="1000ms" begin="1000ms" fill="freeze"/>
<animate xlink:href="#biβ5" attributeName="opacity" from="1" to="0" dur="1000ms" begin="1000ms" fill="freeze"/>
<animate xlink:href="#β5" attributeName="stroke" from="rgb(0,0,255)" to="rgb(255,0,0)" dur="1000ms" begin="1000ms" fill="freeze"/>
<animate xlink:href="#β5" attributeName="stroke" from="rgb(0,0,255)" to="rgb(255,0,0)" dur="1000ms" begin="1000ms" fill="freeze"/>
<animate xlink:href="#γ6" attributeName="opacity" from="1" to="0" dur="1000ms" begin="1000ms" fill="freeze"/>
<animate xlink:href="#libγ6" attributeName="opacity" from="1" to="0" dur="1000ms" begin="1000ms" fill="freeze"/>
<animate xlink:href="#biγ6" attributeName="opacity" from="1" to="0" dur="1000ms" begin="1000ms" fill="freeze"/>
<animate xlink:href="#γ6" attributeName="stroke" from="rgb(0,0,255)" to="rgb(255,0,0)" dur="1000ms" begin="1000ms" fill="freeze"/>
<animate xlink:href="#γ6" attributeName="stroke" from="rgb(0,0,255)" to="rgb(255,0,0)" dur="1000ms" begin="1000ms" fill="freeze"/>
<animate xlink:href="#cC3" attributeName="stroke" from="rgb(0,0,255)" to="rgb(128,139,150)" dur="1000ms" begin="1000ms" fill="freeze"/>
<animate xlink:href="#cA1" attributeName="stroke" from="rgb(0,0,255)" to="rgb(128,139,150)" dur="1000ms" begin="1000ms" fill="freeze"/>
<animate xlink:href="#cB2" attributeName="stroke" from="rgb(0,0,255)" to="rgb(128,139,150)" dur="1000ms" begin="1000ms" fill="freeze"/>
<animateMotion xlink:href="#A1" begin="2000ms" dur="1000ms"
                    fill="freeze" path="m -95 -114 l 209 117" />
<animateMotion xlink:href="#B2" begin="2000ms" dur="1000ms"
                    fill="freeze" path="m 114 3 l -209 -117" />
<animate xlink:href="#α7" attributeName="opacity" from="0" to="1" dur="1000ms" begin="3000ms" fill="freeze"/>
<animate xlink:href="#libα7" attributeName="opacity" from="0" to="1" dur="1000ms" begin="3000ms" fill="freeze"/>
<animate xlink:href="#biα7" attributeName="opacity" from="0" to="1" dur="1000ms" begin="3000ms" fill="freeze"/>
<animate xlink:href="#β9" attributeName="opacity" from="0" to="1" dur="1000ms" begin="3000ms" fill="freeze"/>
<animate xlink:href="#libβ9" attributeName="opacity" from="0" to="1" dur="1000ms" begin="3000ms" fill="freeze"/>
<animate xlink:href="#biβ9" attributeName="opacity" from="0" to="1" dur="1000ms" begin="3000ms" fill="freeze"/>
<animate xlink:href="#γ8" attributeName="opacity" from="0" to="1" dur="1000ms" begin="3000ms" fill="freeze"/>
<animate xlink:href="#libγ8" attributeName="opacity" from="0" to="1" dur="1000ms" begin="3000ms" fill="freeze"/>
<animate xlink:href="#biγ8" attributeName="opacity" from="0" to="1" dur="1000ms" begin="3000ms" fill="freeze"/>
<animate xlink:href="#α7" attributeName="stroke" from="rgb(0,0,255)" to="rgb(128,139,150)" dur="1000ms" begin="4000ms" fill="freeze"/>
<animate xlink:href="#β9" attributeName="stroke" from="rgb(0,0,255)" to="rgb(128,139,150)" dur="1000ms" begin="4000ms" fill="freeze"/>
<animate xlink:href="#γ8" attributeName="stroke" from="rgb(0,0,255)" to="rgb(128,139,150)" dur="1000ms" begin="4000ms" fill="freeze"/>
<animate xlink:href="#cA1" attributeName="fill" from="rgb(255,255,255)" to="rgb(0,128,0)" dur="1000ms" begin="4000ms" fill="freeze"/>
<animate xlink:href="#cC3" attributeName="fill" from="rgb(255,255,255)" to="rgb(128,0,0)" dur="1000ms" begin="5000ms" fill="freeze"/>
<animate xlink:href="#γ8" attributeName="opacity" from="1" to="0" dur="1000ms" begin="6000ms" fill="freeze"/>
<animate xlink:href="#libγ8" attributeName="opacity" from="1" to="0" dur="1000ms" begin="6000ms" fill="freeze"/>
<animate xlink:href="#biγ8" attributeName="opacity" from="1" to="0" dur="1000ms" begin="6000ms" fill="freeze"/>
<animate xlink:href="#γ8" attributeName="stroke" from="rgb(128,139,150)" to="rgb(255,0,0)" dur="1000ms" begin="6000ms" fill="freeze"/>
<animate xlink:href="#α7" attributeName="opacity" from="1" to="0" dur="1000ms" begin="7000ms" fill="freeze"/>
<animate xlink:href="#libα7" attributeName="opacity" from="1" to="0" dur="1000ms" begin="7000ms" fill="freeze"/>
<animate xlink:href="#biα7" attributeName="opacity" from="1" to="0" dur="1000ms" begin="7000ms" fill="freeze"/>
<animate xlink:href="#α7" attributeName="stroke" from="rgb(128,139,150)" to="rgb(255,0,0)" dur="1000ms" begin="7000ms" fill="freeze"/>
<animate attributeName="viewBox" from="-138 -154 292 308" to="-138 -37 292 191" begin="8000ms" dur="1000ms" fill="freeze" />
<animate xlink:href="#B2" attributeName="opacity" from="1" to="0" dur="1000ms" begin="8000ms" fill="freeze"/>
<animate xlink:href="#cB2" attributeName="stroke" from="rgb(128,139,150)" to="rgb(255,0,0)" dur="1000ms" begin="8000ms" fill="freeze"/>
<g id="D10" opacity="0">
  <circle id="cD10" cx="0" cy="0" r="20" fill="rgb(255,255,255)" stroke="rgb(0,0,255)" stroke-width="2"></circle>
  <text id="coD10" x="0" y="0" dx="-5" dy="5" fill="rgb(0,0,0)">D</text>
</g>
<animate attributeName="viewBox" from="-138 -37 292 191" to="-138 -40 292 194" begin="9000ms" dur="1000ms" fill="freeze" />
<animate xlink:href="#D10" attributeName="opacity" from="0" to="1" dur="1000ms" begin="9000ms" fill="freeze"/>
<animate attributeName="viewBox" from="-138 -40 292 194" to="-159 -193 318 386" begin="10000ms" dur="1000ms" fill="freeze" />
<animate xlink:href="#β9" begin="10000ms" fill="freeze" attributeName="d" dur="1000ms" values="M114 3 L-98 114 Z;M119 153 L-119 153 Z" />
<animateMotion xlink:href="#libβ9" begin="10000ms" dur="1000ms" fill="freeze" path="m 0 0 l -8 95" />
<animateMotion xlink:href="#C3" begin="10000ms" dur="1000ms"
                    fill="freeze" path="m -98 114 l -21 39" />
<animateMotion xlink:href="#A1" begin="10000ms" dur="1000ms"
                    fill="freeze" path="m 114 3 l 5 150" />
<animateMotion xlink:href="#D10" begin="10000ms" dur="1000ms"
                    fill="freeze" path="m 0 0 l -119 -153" />
<animate xlink:href="#cD10" attributeName="stroke" from="rgb(0,0,255)" to="rgb(128,139,150)" dur="1000ms" begin="10000ms" fill="freeze"/>
<animate xlink:href="#δ11" attributeName="opacity" from="0" to="1" dur="1000ms" begin="11000ms" fill="freeze"/>
<animate xlink:href="#libδ11" attributeName="opacity" from="0" to="1" dur="1000ms" begin="11000ms" fill="freeze"/>
<animate xlink:href="#biδ11" attributeName="opacity" from="0" to="1" dur="1000ms" begin="11000ms" fill="freeze"/>
<animate attributeName="viewBox" from="-159 -193 318 386" to="-115 -205 230 410" begin="12000ms" dur="1000ms" fill="freeze" />
<animate xlink:href="#β9" begin="12000ms" fill="freeze" attributeName="d" dur="1000ms" values="M119 153 L-119 153 Z;M75 165 L75 -45 Z" />
<animateMotion xlink:href="#libβ9" begin="12000ms" dur="1000ms" fill="freeze" path="m -8 95 l 75 -93" />
<animate xlink:href="#δ11" begin="12000ms" fill="freeze" attributeName="d" dur="1000ms" values="M-119 153 L-119 -153 Z;M75 -45 L-75 -165 Z" />
<animateMotion xlink:href="#libδ11" begin="12000ms" dur="1000ms" fill="freeze" path="m 0 0 l 119 -105" />
<animate xlink:href="#δ11" attributeName="stroke" from="rgb(0,0,255)" to="rgb(128,139,150)" dur="1000ms" begin="12000ms" fill="freeze"/>
<animateMotion xlink:href="#C3" begin="12000ms" dur="1000ms"
                    fill="freeze" path="m -119 153 l 194 -198" />
<animateMotion xlink:href="#A1" begin="12000ms" dur="1000ms"
                    fill="freeze" path="m 119 153 l -44 12" />
<animateMotion xlink:href="#D10" begin="12000ms" dur="1000ms"
                    fill="freeze" path="m -119 -153 l 44 -12" />
<animate xlink:href="#ε12" attributeName="opacity" from="0" to="1" dur="1000ms" begin="13000ms" fill="freeze"/>
<animate xlink:href="#libε12" attributeName="opacity" from="0" to="1" dur="1000ms" begin="13000ms" fill="freeze"/>
<animate xlink:href="#biε12" attributeName="opacity" from="0" to="1" dur="1000ms" begin="13000ms" fill="freeze"/>
<animate attributeName="viewBox" from="-115 -205 230 410" to="-157 -139 324 278" begin="14000ms" dur="1000ms" fill="freeze" />
<animate xlink:href="#ε12" begin="14000ms" fill="freeze" attributeName="d" dur="1000ms" values="M-75 -165 L75 165 Z;M127 99 L-117 99 Z" />
<animateMotion xlink:href="#libε12" begin="14000ms" dur="1000ms" fill="freeze" path="m 0 0 l 5 99" />
<animate xlink:href="#ε12" attributeName="stroke" from="rgb(0,0,255)" to="rgb(128,139,150)" dur="1000ms" begin="14000ms" fill="freeze"/>
<animate xlink:href="#β9" begin="14000ms" fill="freeze" attributeName="d" dur="1000ms" values="M75 165 L75 -45 Z;M-117 99 L3 -99 Z" />
<animateMotion xlink:href="#libβ9" begin="14000ms" dur="1000ms" fill="freeze" path="m 67 2 l -132 -60" />
<animate xlink:href="#δ11" begin="14000ms" fill="freeze" attributeName="d" dur="1000ms" values="M75 -45 L-75 -165 Z;M3 -99 L127 99 Z" />
<animateMotion xlink:href="#libδ11" begin="14000ms" dur="1000ms" fill="freeze" path="m 119 -105 l 65 105" />
<animateMotion xlink:href="#C3" begin="14000ms" dur="1000ms"
                    fill="freeze" path="m 75 -45 l -72 -54" />
<animateMotion xlink:href="#A1" begin="14000ms" dur="1000ms"
                    fill="freeze" path="m 75 165 l -192 -66" />
<animateMotion xlink:href="#D10" begin="14000ms" dur="1000ms"
                    fill="freeze" path="m -75 -165 l 202 264" />
<animate xlink:href="#cD10" attributeName="stroke-width" from="2" to="4" dur="1000ms" begin="15000ms" fill="freeze"/>
<animate xlink:href="#cD10" attributeName="stroke" from="rgb(128,139,150)" to="rgb(191,255,0)" dur="1000ms" begin="15000ms" fill="freeze"/>
<animate xlink:href="#δ11" attributeName="stroke-width" from="2" to="4" dur="1000ms" begin="16000ms" fill="freeze"/>
<animate xlink:href="#δ11" attributeName="stroke" from="rgb(128,139,150)" to="rgb(191,255,0)" dur="1000ms" begin="16000ms" fill="freeze"/>
<animate xlink:href="#ε12" attributeName="stroke-width" from="2" to="4" dur="1000ms" begin="17000ms" fill="freeze"/>
<animate xlink:href="#ε12" attributeName="stroke" from="rgb(128,139,150)" to="rgb(191,255,0)" dur="1000ms" begin="17000ms" fill="freeze"/>
</svg>
  </body>
</html>