TipeError Uncaught: document.getElementsByClassName (...). Gaya tidak ditentukan

var elem = document.getElementById("animate");
var pos = 0;
var id = setInterval(frame, 10);

function frame() {
  if (pos == 150) { pos = 0; }
  pos++;
  elem.style.top = pos + '5px';
  elem.style.left = pos + 'px';
}
Hilarious Hare