injectBeforeRender
injectBeforeRender
is a function that allows the consumers to register a callback to be run in the animation loop.
It takes a callback that has access to the state of the canvas and the delta time since the last frame.
injectBeforeRender
cleans up the callback when the component is destroyed. Alternatively, injectBeforeRender
returns a clean up function that can be called manually.