I have the following code (in TypeScript) that creates a polyline (based on 4 differents points x1y1, xCy1, xCy1, x2y2, where Xc is the half distance between x1 and x2 on a plane), so it is not a circular shape.
private createPolyline(points: Array<[number, number]>): SVGPolylineElement {
let polyline: SVGPolylineElement = document.createElementNS('http://www.w3.org/2000/svg', 'polyline');
let pointsAttr: string = points.map(point => point.join(',')).join(' ');
polyline.setAttribute('points', pointsAttr);
polyline.setAttribute('stroke', 'green');
polyline.setAttribute('stroke-width', '2');
polyline.setAttribute('fill', 'none');
polyline.setAttribute('stroke-dasharray', '25');
polyline.setAttribute('stroke-dashoffset', '40');
polyline.style.animation = 'dash 5s linear infinite';
return polyline;
}
What I want is basically to have the appearance of a continously flowing dashed line. The above method achieves that, but after 5 seconds it will reset to the original position of the dashes and restarts the animation.
Is there a way I can make this infinitely continous?