<div style="position:relative">111</div>
<script>
var div = document.querySelector('div');
(run=()=>{
var l = parseFloat(getComputedStyle(div).left),
t = parseFloat(getComputedStyle(div).top);
if(l<200 && t==0) div.style.left = l+1+'px';
if(l==200 && t<200) div.style.top = t+1+'px';
if(l>0 && t==200) div.style.left = l-1+'px';
if(l==0 && t>0) div.style.top = t-1+'px';
setTimeout(run,4);
})();
</script>