In the morphic.js example file, there's this code
function loop() {
requestAnimationFrame(loop)
world.doOneCycle()
}
Won't this just keep recursively call loop()
and and prevent code from ever reaching world.doOneCycle()
?
In the morphic.js example file, there's this code
function loop() {
requestAnimationFrame(loop)
world.doOneCycle()
}
Won't this just keep recursively call loop()
and and prevent code from ever reaching world.doOneCycle()
?
I think requestAnimationFrame
is asynchronous.
No because the loop function is asynchronous, and it calls the function loop on the next screen refresh?