Use requestAnimationFrame when it's available