console
let timer = null
function move (distance = 2) {
let box = document.querySelector('.white')
let left = box.style.left || 0
let bottom = box.style.bottom || 0
box.style.left = parseInt(left) + distance + 'px'
box.style.bottom = parseInt(bottom) + distance + 'px'
console.log(box.offsetRight)
if (box.offsetLeft >= 250) {
clearInterval(timer)
}
}
timer = setInterval(move,10)
<div class="container">
<div class="white"></div>
</div>
.container {
width: 300px;
height: 300px;
background: #000;
position: relative;
}
.white {
width: 50px;
height: 50px;
background: #fff;
position: absolute;
left: 0;
bottom: 0;
}