Changed setInterval() to requestAnimationFrame() as the former was causing issues for some reason.