the browser/requestAnimationFrame drops the frame if it takes more than 16.7ms to run.
If we call Babylon render() in requestAnimationFrame and let’s say we have a scene that takes 20ms to render, will all the frames be dropped forever, because we keep doing the same work over and over?
Or does Babylon do something clever to prevent this?
What do you mean ? The animation are basically interpolating and such to ensure the frame time/delay would not impact the time used by the animation
( requestAnimationFrame is discussed in the video )
Amazing reference @shaderbytes
that will be nice to watch in any case, thanks.
I guess when the frame is dropped the previous requestAnimationFrame will finish anyway and the result will be used in the next frame… that’s probably the mistake in my reasoning.
Yea, its gonna just skip the next raf (like it wont even be called), not drop the result of current one.
To understand libuv , just think of it as a 12 hour clock, where every time it hits midnight, timers and resolved promises get checked.
So, process.nextTick in node now makes sense;) its gonna run on the next tick of the clock (aka after the next synchronous block finishes), which is of course before the clock hits midnight again. SetImmediate runs right after midnight. Quemicrotask or an empty promise.resolve() run right before midnight. Raf is basically a timer/promise here.