From https://github.com/giniedp/spritespin