refactor loading animation - borrowed from http://projects.lukehaas.me/css-loaders/