In my TypeScript code, I have implemented a function that creates a polyline based on 4 different points (x1y1, xCy1, xCy1, x2y2), where Xc represents the half distance between x1 and x2 on a plane. This polyline does not form 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;
}
My goal is to create a constantly flowing dashed line effect. The current method achieves this, but the animation resets after 5 seconds and restarts from the beginning.
Is there a way to make this animation continuously infinite?