Optional
props: StaticProps & MutablePropsProtected
_callbacksCallbacks instance
Protected
_destroyableStores actions that need to be executed when the module is destroyed
Protected
_durationDuration of the last frame in ms
Protected
_fpsReal-time FPS
Protected
_indexCurrent frame index
Protected
_isTracks whether the module has been destroyed
Protected
_isIndicates if the animation frame is currently running
Protected
_lastTimestamp of the last frame
Protected
_propsCurrent properties
Protected
_rafActive requestAnimationFrame ID, or null
if not running
Protected
_timestampTimestamp of the current frame
Retrieves the module's callbacks instance.
Duration of the last frame in ms
Real-time FPS
Scaling coefficient based on a 60 FPS target
Current frame index
Checks if the module has been destroyed.
Playback state of the animation frame
The name of the module, derived from the class name
Optional prefix for classnames used by the module
Current properties. Do not mutate these directly, use updateProps
instead.
Timestamp of the current frame
Protected
_addAdds a class name on an element, and keeps track of it for removal when the module is destroyed.
The target DOM element.
The class name to toggle.
Protected
_animateAnimation loop handler, calculates FPS, and triggers callbacks
Protected
_cnHelper function to generate classnames with the module's prefix.
The class names to generate.
A string of class names with the module's prefix applied.
Protected
_computeFPSCompute real-time FPS from frame durations
Protected
_destroyDestroy the animation frame and stop the loop
Get default mutable properties
Get default static properties
Protected
_handleHandle property mutations
Protected
_pauseInternal method to pause the loop
Protected
_playInternal method to start the loop
Destroys the module, cleaning up resources, callbacks, and event listeners.
Calculate linear interpolation factor to make animations run the same regardless of FPS
Adds a custom callback to the module.
The event type to listen for (e.g., 'props', 'destroy').
The function to execute when the event is triggered.
Additional settings for the callback.
Adds a callback on the module's destruction.
The function to execute during destruction.
Pause the animation loop
Start the animation loop
Manages an animation frame loop with configurable FPS and playback controls.
Documentation