<style>
* {
padding: 0;
margin: 0;
}
#box {
width: 100px;
height: 100px;
background: skyblue;
position: fixed;
left: 0;
top: 0;
}
</style>
<body>
<div id="box"></div>
</body>
<script>
var speed = 1;
var direction = 1000;
var timer = setInterval(() => {
var left = box.offsetLeft;
speed++
left += speed;
if (left >= direction) {
clearInterval(timer);
left = direction;
}
box.style.left = `${left}px`;
}, 100);
</script>