JSFiddle - React, Tailwind, and code Playground
by teneff
HTML
<div id="left"></div>
<div id="right"></div>
CSS
div {
position: absolute;
width: 200px;
height: 200px;
}
div#left {
background-color: red;
top: 100px;
left: 100px;
}
div#right {
background-color: blue;
top: 100px;
left: 300px;
}
JavaScript
ints=[];
angles=[];
rotate = function(el, speed) {
angles[el.id] += speed;
el[i].style.roration = angles[el.id];
el[i].style.MozTransform = angles[el.id];
el[i].style.WebkitTransform = angles[el.id];
el[i].style.OTransform = angles[el.id];
}
rotationStart = function(el, speed) {
angles[el.id] = 0;
ints[el.id] = setInterval(function(){
rotate(el);
}, 10);
}
window.onload = function() {
rorationStart(document.getElementById('left'), 10);
rorationStart(document.getElementById('left'), 10);
}