Use requestAnimationFrame for drawing.