Recently stumbled upon this cool code snippet on stack overflow http://codepen.io/anon/pen/LERrGG.
I see a lot of potential in this pen, but the one drawback is the lack of functionality to execute a function after the timer expires. I've been trying to figure out how to solve this without any luck.
Can someone help me modify the code so that it can be utilized as a timer that 'runs out'?
(function animate() {
theta += 0.5;
theta %= 360;
var x = Math.sin(theta * Math.PI / 180) * radius;
var y = Math.cos(theta * Math.PI / 180) * -radius;
var d = 'M0,0 v' + -radius + 'A' + radius + ',' + radius + ' 1 ' + ((theta > 180) ? 1 : 0) + ',1 ' + x + ',' + y + 'z';
timer.setAttribute('d', d);
setTimeout(animate, t)
})();