Function: useAnimationFrame()
function useAnimationFrame(callback, __namedParameters?): void;
Defined in: react/src/hooks/useAnimationFrame.ts:24
Call callback on every animation frame for as long as the component is
mounted.
The callback is read on every frame, so it can be written inline and see the latest render without restarting the loop.
Parameters
| Parameter | Type | Description |
|---|---|---|
callback | (timestamp, deltaTime) => void | receives the frame's timestamp and the milliseconds since the previous frame, which is 0 on the first one |
__namedParameters | UseAnimationFrameOptions | - |
Returns
void