I am using pure javascript (no jquery or any other framework) for animations. Which one's more optimized? Creating classes for transition like:
CSS class:
.all-div-has-this-class { transition: all 1s; }
.class1 { left: 0; }
.class2 { left: 30px; }
Javscript:
testdiv.className += " class1";
testdiv.className += " class2";
or just this in javascript => Initialize the testdiv position in the css then just dotestdiv.style.left = "30px"; in the js code?
By the way, these are all in setTimeout functions to set the properties according to timing. Also, it has to be only javascript without any jquery or any other framework specifically for animations.