Returns an API that starts and stops an animation loop.
When start is called, the animation loop begins invoking the provided callback using requestAnimationFrame.
If an animation is already running, it is stopped and restarted with the new callback.
The animation is automatically stopped when the component unmounts.
The animation should be started or stopped only after the component has mounted. Before that, calling either function
is a no-op.
Returns an API that starts and stops an animation loop.
When
startis called, the animation loop begins invoking the provided callback usingrequestAnimationFrame. If an animation is already running, it is stopped and restarted with the new callback.The animation is automatically stopped when the component unmounts.
The animation should be started or stopped only after the component has mounted. Before that, calling either function is a no-op.