Invoke the specified callback function at the next VSYNC.
requestAnimationFrame
is typically used in scenarios where you want to achieve animation effects by modifying element attributes in each frame.
Note that requestAnimationFrame
will only take effect in the next frame; if you want it to continue to take effect, you need to nest requestAnimationFrame
.
The callback function that needs to be called at the next VSYNC.
The callback function has one parameter timeStamp
, which is the moment when the callback function starts to execute.
An integer type id, used to cancel this requestAnimationFrame
callback.
Print the frame rate in the console:
// Todo add example later