JSFiddle - React, Tailwind, and code Playground

by Nicolas PUJOL

HTML

<img id="roue" src="http://lorempicsum.com/futurama/200/200/2">

JavaScript

$.fn.animateRotate = function(angle, duration, easing, complete) {
    var args = $.speed(duration, easing, complete);
    var step = args.step;
    return this.each(function(i, e) {
        var self = this;
        args.complete = $.proxy(args.complete, e);
        args.step = function(now) {
            $(self).css({
                '-webkit-transform': 'rotate(' + now + 'deg)',
                '-moz-transform': 'rotate(' + now + 'deg)',
                '-ms-transform': 'rotate(' + now + 'deg)',
                'transform': 'rotate(' + now + 'deg)'
            });

            if (step) return step.apply(e, arguments);
        };
        $({
            deg: 0
        }).animate({
            deg: angle
        }, args);
    });
};
$("#roue").animateRotate((4680), {
    duration: 5000,
    easing: 'swing',
    complete: function() {
        finPartie = true;
    }
});