JSFiddle - React, Tailwind, and code Playground

HTML

<div>

</div>

CSS

div {
  position: absolute;
  width: 10px;
  height: 10px;
  background: red;
  top: 0;
}

JavaScript

var div = document.querySelector('div');

moveTo(100);

function moveTo(y) {
	var currentTop = div.offsetTop;
  
  if(currentTop < y) {
     div.style.top = (currentTop+1)+'px';
     setTimeout(function() {
        moveTo(y);
     }, 100);
  }
}