RequestAnimationFrame
RequestAnimationFrame
Note: Just pasting from Mozilla Docs
The window.requestAnimationFrame() method tells the browser that you wish to perform an animation and requests that the browser calls a specified function to update an animation before the next repain