(Solved):In Javascript, what does the requestAnimationFrame() function do?

 

Question

In Javascript, what does the requestAnimationFrame() function do?

 

EXPERT ANSWER

The requestAnimationFrame() is used to do animation on the screen of the user in an efficient, optimized and battery-friendly manner. For this purpose, this function makes a call to the browser to call a function for the animation on the screen before the next repaint. For the animation at the next repaint, the requestAnimationFrame() should be called. Before using the requestAnimationFrame(), setinterval()

Scroll to top