JSFiddle - React, Tailwind, and code Playground
by cssGuy
HTML
<div id="wrap">
<div id="box"></div>
</div>
CSS
html, body {
height: 100%;
margin: 0;
overflow: hidden;
}
body, div {
display: flex;
margin: auto;
}
#box {
width: 150px;
height: 150px;
background-color: tomato;
-webkit-animation: move 9s linear infinite alternate;
transform: rotate(45deg);
}
#box::after {
content:"";
display: block;
width: 10px;
height: 10px;
background-color: black;
border-radius: 5px;
position: absolute;
top: 50%;
left: 50%;
margin-top: -5px;
margin-left: -5px;
}
/*@-webkit-keyframes move{
from{
transform: rotateZ(0deg);
transform-origin: 100% 100%;
}
to{
transform: rotateZ(360deg);
transform-origin: 0 0;
}
}*/
#wrap {
border: 1px solid;
}
JavaScript
//Transform origin by default is center center or 50% 50%