Re:Annotated code: Circles bouncing off lines
by mxtopher on Sunday February 08, 2015 @08:34PM
(#9019336)
so tick calls requestAnimationFrame that calls tick that...
Doesn't it create an ever growing stack? Isn't there a way to do it with a while loop?
[ Parent
| on HN ]
Re:Annotated code: Circles bouncing off lines
by Rusky on Sunday February 08, 2015 @08:50PM
(#9019384)
requestAnimationFrame just queues up the callback for later, it doesn't actually call into it. There's no stack growth.
Re:Annotated code: Circles bouncing off lines
by zerocrates on Sunday February 08, 2015 @08:42PM
(#9019355)
It doesn't create an ever-growing stack.
tick calls requestAnimationFrame, tick returns, the browser waits for the next frame and calls tick...