Is is safe to use requestAnimationFrame in real projects?
-
25-05-2021 - |
题
I'm wondering if it's safe to use requestAnimationFrame outside of experimenting yet? I guess you still need the vendor prefixes (moz, ms etc). How many of the modern browsers support it? And how big are the differences? I know FF had trouble with the fps capping at 62.5 - callback time.
Also what is the real difference in using requestAnimationFrame when compared to a setInterval loop?
解决方案
It's safe, as long as you are aware the syntax could change, though I doubt it will. Testing is of course important, but I can't see any reason not to, as the enhanced performance is worth it. You can also omit the prefixed version if a browser doesnt work as expected.
不隶属于 StackOverflow