JSFiddle - React, Tailwind, and code Playground

by Nicolas PUJOL

HTML

<div id="MyDiv2" class="SomeDiv">test</div>

CSS

.SomeDiv {
    width:200px;
    height:200px;
    margin:50px 50px;
    background-color: red;
    border-radius: 100px;
}

JavaScript

$.fn.animateRotate = function(angle, duration, easing, complete) {
  var args = $.speed(duration, easing, complete);
  var step = args.step;
  return this.each(function(i, e) {
    args.complete = $.proxy(args.complete, e);
    args.step = function(now) {
      $.style(e, 'transform', 'rotate(' + now + 'deg)');
      if (step) return step.apply(e, arguments);
    };

    $({deg: 0}).animate({deg: angle}, args);
  });
};
$("#MyDiv2").animateRotate(5000, {
  duration: 5000,
  easing: 'swing',
  complete: function () {
      /*$("#MyDiv2").animateRotate(300, {
          duration: 1500,
          easing: 'linear',
          complete: function () {
              
          }
        });*/
  },
  step: function () {}
});