Use requestAnimationFrame instead of setInterval for animation