Polyfill requestAnimationFrame when necessary