// 1
var left = 0;
function frame() {
left += 10;
el.style.setProperty('transform', 'translateX(' + left + 'px)');
if (left < 200) window.requestAnimationFrame(frame);
}
window.requestAnimationFrame(frame);
// 2
var start = null;
function step(timestamp) {
if (!start) start = timestamp;
var progress = timestamp - start;
el.style.left = Math.min(progress / 10, 200) + 'px';
if (progress < 2000) window.requestAnimationFrame(step);
}
window.requestAnimationFrame(step);