I am trying to recreate the following animation:
I am having trouble with getting a line to properly animate around corners. I've tried using an animateMotion-element like so:
<line class="testLine" x1="10" y1="10" x2="100" y2="10" stroke="white">
<animateMotion dur="1.6s" repeatCount="indefinite"
path="M 10 10 L 390 10
M 390 10 L 390 290
M 390 290 L 10 290
M 10 290 L 10 10">
</animateMotion>
</line>
But the line is not smoothly rounding corners. Any idea on how to get it to make it move smoothly around corners as shown in the GIF?
You will need to create a path with srtoke-dasharray = 1/2 of the side of the rect and animate the stroke-dashoffset of the path to 0
Please read the comments in the code: