AnimationFrames
A wrapper over `requestAnimationFrame`, with controls for limiting FPS, and information about the current frame.
Demo
Frames: 0 FPS: 0 Delta: 0ms
FPS limit: 10
Mouse sprite extracted from Animal Well
Description
AnimationFrames
wraps over requestAnimationFrame
.
While it is not necessary to use it to use requestAnimationFrame
, it removes some of the
boilerplate, and adds common utilities for it.
- Automatically interrupts the requestAnimationFrame loop once the component is unmounted
- Lets you set an FPS limit
- Lets you get information about the current frame, such as its current timestamp, and the difference in ms between the last frame and the current one
- Returns information about current FPS