Based on Chris Hiester's http://bl.ocks.org/chiester/11267307, mostly tweaked to make it easier for beginners to understand. NOTE: it takes a second or two before the animation begins.