JSFiddle - React, Tailwind, and code Playground
HTML
<div id="MyDiv1" class="SomeDiv">test</div>
<div id="MyDiv2" class="SomeDiv">test</div>
CSS
.SomeDiv {
width:50px;
height:50px;
margin:50px 50px;
background-color: red;
}
JavaScript
$(document).ready(function () {
DoRotate(30);
AnimateRotate(30);
});
function DoRotate(d) {
$("#MyDiv1").css({
transform: 'rotate(' + d + 'deg)'
});
}
function AnimateRotate(d){
var elem = $("#MyDiv2");
$({deg: 0}).animate({deg: d}, {
duration: 2000,
step: function(now){
elem.css({
transform: "rotate(" + now + "deg)"
});
}
});
}