Use "enterframe" event listener instead of setTimout.