JSFiddle - React, Tailwind, and code Playground
HTML
<div class="container">
<div class="box">
</div>
<div class="box">
</div>
</div>
CSS
.container {
width: 500px;
height: 500px;
margin: 0 auto;
}
.box {
background-color: pink;
width: 100px;
height: 100px;
animation: battle 6s linear infinite;
position: absolute;
margin: 10px;
}
@keyframes battle {
from {
transform: rotate(0deg) translateX(150px) rotate(0deg);
}
to {
transform: rotate(360deg) translateX(150px) rotate(-360deg);
}
}