[RequestAnimationFrame] don't loop getElementById

function animate(time) {
  document.getElementById("animated").style.left =
    (time - animationStartTime) % 2000 / 4 + "px";
  requestId = window.requestAnimationFrame(animate);
}

document.getElementById("animated") should be declared outside the
animate() function.

Received on Monday, 12 November 2012 13:44:25 UTC