SOURCE

console 命令行工具 X clear

                    
>
console
// TODO: 5S 到达怎么实现
// js 实现 position
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'
  // console.log(box.style.left)
  box.style.bottom = parseInt(bottom) + distance + 'px'
  
  console.log(box.offsetRight)
  if (box.offsetLeft >= 250) {
    clearInterval(timer)
  }
}

timer = setInterval(move,10)




// requestFrame
<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;
}