+21

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 ?

5/22/2019 2:34:15 PM

Michaël Randrianarisona

14 Answers

New Answer

+18

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.

+42

Michaël Randrianarisona JavaScript is better in case your using Events. And CSS3 is better if You want To change your Styles. JavaScript is more preferable.

+8

🤔 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.

+6

Can't you do event driven animations in CSS?

+6

Both

+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

+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.

+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.

+2

Before css3 you should check out javascript in css3 animation is cool and simple

+1

+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

+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.

+1

Before css3 you should check out javascript

-1

it is fine to use css or javascript, just use the one u got most technique but i think css is easier