Here’s how to do this without using jQuery:
<?xml version="1.0" encoding="UTF-8"?>
<svg viewBox="0 0 480 360" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Animates a path</title>
<path id="arc" d="M0 0"/>
<script>
var circle = document.getElementById("arc"),
startangle = -90,
angle = startangle,
radius = 100,
cx = 240,
cy = 180,
increment = 5; // make this negative to animate counter-clockwise
function drawCircle() {
var radians = (angle/180) * Math.PI,
x = cx + Math.cos(radians) * radius,
y = cy + Math.sin(radians) * radius,
e = circle.getAttribute("d"),
d = "";
if(angle == startangle)
d = "M "+cx + " " + cy + "L "+x + " " + y;
else
d = e + " L "+x + " " + y;
circle.setAttribute("d", d);
angle += increment;
if (Math.abs(angle) > (360+startangle*Math.sign(increment)))
angle = startangle;
window.requestAnimationFrame(drawCircle);
}
drawCircle();
</script>
</svg>
See live example.
1
solved SVG Path animation with Jquery