javascript - When to use requestAnimationFrame? and why we need requestAnimationFrame if we have had css transition? -


i don't know when use requestanimationframe. if requestanimationframe , css both can satisfy needs, 1 should choose?

can show me of applied cases?

thx much~

i think reason opt requestanimationframe on css animations when want quick animations need ensure browsers make smooth. animations jump, stop, pause, return benefit using requestanimationframe.

the thing requestanimationframe uses no cpu power, , draws animation visible user (it doesn't consume if swich tabs, minimize, etc). frames drawn when browser ready , since there no ready frames waiting drawn, there no unnecessary frame draws. so, smoothness guarantee, can safely opt requestanimationframe.

if plan simple doesn't fit above explanation, requestanimationframe overkill , you'd better switch css animations.

source consulted:

https://dev.opera.com/articles/better-performance-with-requestanimationframe/


Comments

Popular posts from this blog

scala - 'wrong top statement declaration' when using slick in IntelliJ -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

PySide and Qt Properties: Connecting signals from Python to QML -