In the left example the path is continuous (i.e. no m
commands), hence the segments of the path are drawn one after another.
In the right example the path is discontinuous (i.e. containing m
commands), which causes all segments to be drawn at once.
How can I make the segments in the right example be drawn one after another?
That is, the second stroke starting only when the topmost stroke is finished instead of both starting simultaneously.
<svg width="220px" height="100px" viewBox="-10 -10 240 120">
<style>
path{stroke-dasharray:500;stroke-dashoffset:500;fill:none;stroke:#000;stroke-width:6px;animation:draw 5s linear infinite;}
@keyframes draw{to{stroke-dashoffset:0;}}
</style>
<path d="m0,0 h60 v60 h-60 z" />
<path d="m120,0 h60 m-60,20 h60 m-60,20 h60 m-60,20 h60 m-60,20" />
</svg>
Here is an approach using several path elements and using animation-delay to make the lines draw one after the other :