October 2018
Intermediate to advanced
500 pages
12h 40m
English
The requestAnimationFrame function is available in all WebGL-enabled browsers. One of the advantages of leveraging this function is that it is designed to call the rendering function (whatever function we indicate) only when the browser/tab window is in focus. Otherwise, there is no call. This saves precious CPU, GPU, and memory resources. By using the requestAnimationFrame function, we can obtain a rendering cycle that is in sync with hardware capabilities and one that will automatically suspend itself when the window is out of focus.