Moved things to requestAnimationFrame.