Your recursive function starts immediately - replace count++; on console.log(count++); - and you will see that the console will be filled 1, 2, 3, ..., 59 immediately. Transitions continue to play slowly, because d3 automatically transitions circuits , therefore:
svg.selectAll('circle') .transition().style("fill","pink") .transition().duration(10000).style("fill", "green") .transition().duration(400).style("fill", "red")
will turn all circles into svg pink, then slowly and then quickly. The recursive function that you mostly combine contains a large long list of 60 transitions and d3 that slowly reproduces it.
I'm not sure of the best place in your code so that the counter synchronizes with the animation - maybe someone else can call back? I would probably use d3.timer instead of an inactive recursive function.
source share