Suggestions:
- use if else;
- replace "if(stop){return}" with "cancelAnimationFrame";
- don't save data in the html nodes, DOM is slow, use js object to store data (timespans[currentUrl].textContent = d;).
- no need to use "window.links = ..." you can simply "links = ..."