Fix animation in Chrome 34 and Firefox 26

This is the same as #12 just from a local branch.