JSFiddle - React, Tailwind, and code Playground
by brigand
HTML
<div id="box"></div>
CSS
#box {
width: 12em;
height: 12em;
animation: 5s slide linear infinite alternate;
position: relative;
background: #3399ff;
}
@keyframes slide {
0% {
left: 0;
}
100% {
left: calc(100% - 12em);
}
}
JavaScript
box.addEventListener('mousemove', event => {
event.currentTarget.textContent = Date.now() % (60 * 1000) / 1000;
})