Fix runtime error if requestAnimationFrame is not defined

Thanks @jwmerrill!