JSFiddle - React, Tailwind, and code Playground
HTML
<button id="line"><span>X</span></button>
CSS
#line span{
display: block;
}
JavaScript
var angle = 1;
var timeoutId = 0;
$('#line').mousedown(function() {
timeoutId = setInterval(rotate, 20);
}).on('mouseup mouseleave', function() {
clearInterval(timeoutId);
});
function rotate() {
$('#line').find('span').css ({
'-webkit-transform': 'rotate(' + angle + 'deg)',
'-moz-transform': 'rotate(' + angle + 'deg)',
'-o-transform': 'rotate(' + angle + 'deg)',
'-ms-transform': 'rotate(' + angle + 'deg)'
});
angle+=1;
};