Use requestAnimationFrame rather than setInterval. The animation seems
more smooth now. Thanks @damiankao