requestAnimationFrame

suggest change

Syntax

Parameters

Remarks

When it comes to animating DOM elements fluidly, we are limited to the following CSS transitions:

However, using these is no guarantee that your animations will be fluid, because it causes the browser to start new paint cycles, regardless of what else is going on. Basically, paint are made inefficiently and your animation looks “janky” because the frames per second (FPS) suffers.

To guarantee smooth-as-possible DOM animations, requestAnimationFrame must be used in conjunction with the above CSS transitions.

The reason this works, is because the requestAnimationFrame API lets the browser know that you want an animation to happen at the next paint cycle, as opposed to interrupting what’s going on to force a new paint cycle in when a non-RAF animation is called.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:


requestAnimationFrame:
* Syntax

Table Of Contents
11 Arrays
12 Objects
14 Classes
16 Map
17 Set
24 Loops
27 Date
29 Scope
30 AJAX
35 Cookies
41 JSON
44 Fetch
45 Modules
46 Screen
60 requestAnimationFrame
64 Console
68 Symbols
73 Modals
76 Events
86 Proxy
89 WeakMap
90 WeakSet
102 Tilde