TAG
CSS
JavaScript
Result
Run
License
<div id="target"></div>
#target { width: 100px; height: 100px; background-color: #FF0000; }
window.addEventListener("load", () => { var target = document.querySelector("#target"); let x = 0; function move(time) { x += 1; target.style.transform = `translateX(${x}px)`; if (x < 200) window.requestAnimationFrame(move); } window.requestAnimationFrame(move); });
Console
expand_less
License
License
by DevDic
Close