+ 25

Priority to Javascript or Css for animation ?

Hello everyone, I just finished css3 courses and it's really a powerful tool to make animations. I used to use plain Javascript for animation though. My question is which way is better in terms of performance ?

22nd May 2019, 2:34 PM
Michaël Randrianarisona
Michaël Randrianarisona - avatar
12 Answers
+ 20
Nevermind I found the answer. Css3 rivals with Javascript but not necessarily better. However, Css3 animations run in a separate thread which is an advantage because the browser is single threaded. Say we do something heavy with JS that could freeze the entire page thus stop animations. By using Css3, animations will not freeze.
22nd May 2019, 4:35 PM
Michaël Randrianarisona
Michaël Randrianarisona - avatar
+ 10
🤔 Wow, what a strange article. I can see why it was confusing though, since it was pitting JavaScript against JavaScript in its stress test claiming that it was pitting CSS against JavaScript.
23rd May 2019, 4:51 AM
Janning⭐ - avatar
+ 7
23rd May 2019, 2:17 AM
Petros the Parakeet
Petros the Parakeet - avatar
+ 5
CSS is made for animations, so it is better; but if you want something conditional (like the animation runs when you press a button), you should use JS
22nd May 2019, 2:36 PM
Airree - avatar
+ 3
Indeed, I don't need any logic. However I'm more confused after looking at this https://css-tricks.com/myth-busting-css-animations-vs-javascript/ I did the performance test and GSAP (JS) outperformed Zepto (CSS) with a gap of 10 fps.
22nd May 2019, 3:17 PM
Michaël Randrianarisona
Michaël Randrianarisona - avatar
+ 3
Css3 is better way to create animation. Also, it is easy to create animation using css. But JavaScript is little difficult. Hope you understand what I am trying to say.
23rd May 2019, 1:18 PM
Kaif Hossain
Kaif Hossain - avatar
+ 2
Before css3 you should check out javascript in css3 animation is cool and simple
23rd May 2019, 4:56 AM
Najmuddin Ansari
Najmuddin Ansari - avatar
+ 1
22nd May 2019, 10:23 PM
Paul Orighoye Ariri
Paul Orighoye Ariri - avatar
+ 1
CSS is Cascade Style Sheet and is made for animations and defining the style, but if you want animation make them with JS or React
22nd May 2019, 11:17 PM
romeodelguasta - avatar
+ 1
--- sometimes must be considered performance such as page speed! In JS, two-part for executing. 1- parse 2- execute but in CSS, Just needed parse for executing. -- CSS Animation it's simple and comfortable -- JS Animation The implement may harder than CSS. Debugging is harder than CSS. JS animation power more than CSS. Remind: 100ms faster -> increase 1% revenue.
23rd May 2019, 3:16 AM
hosein shurabi
hosein shurabi - avatar
+ 1
Before css3 you should check out javascript
23rd May 2019, 7:03 PM
Anri - avatar
- 1
it is fine to use css or javascript, just use the one u got most technique but i think css is easier
24th May 2019, 3:21 AM
Shushu - avatar