Performance of CSS Transitions vs. JS animation packages

后端 未结 4 509
攒了一身酷
攒了一身酷 2020-11-28 05:31

I\'m wondering is there any difference in performance of using CSS Transitions vs. any of the various JavaScript animation libraries? (script.aculo.us, sc

4条回答
  •  天命终不由人
    2020-11-28 06:08

    To add to Uphelix's (correct) answer: JavaScript is an interpreted language and the JS engine of the browser has to parse and execute every instruction during run-time (I know there exist JS compilers, like V8 (used in Chrome), but the principle remains the same).

    On the other hand, browsers can implement CSS transitions natively, e.g. in C/C++ or something. This code will be compiled to machine language.

    If CSS transitions are hardware accelerated or not, depends on the techniques the browser uses, the platform the browser runs on, etc.

提交回复
热议问题