Raxol.Animation.StateServer (Raxol v2.0.1)
View SourceGenServer implementation for animation state management in Raxol.
This server provides a pure functional approach to animation state management, eliminating Process dictionary usage and implementing proper OTP patterns.
Features
- Centralized animation settings management
- Animation definition storage and retrieval
- Active animation instance tracking
- Supervised state management with fault tolerance
- Concurrent-safe operations
State Structure
The server maintains state with the following structure:
%{
settings: map(),
animations: %{animation_name => animation_definition},
active_animations: %{element_id => %{animation_name => instance}}
}Performance Considerations
This implementation uses ETS for read-heavy operations when performance is critical, while maintaining GenServer for write operations and state consistency.
Summary
Functions
Batch updates multiple active animations at once for performance.
Returns a specification to start this module under a supervisor.
Clears all animation state (used primarily for testing or reset).
Retrieves a specific active animation instance for a given element and animation name.
Retrieves all active animations.
Returns a map of {element_id, %{animation_name => instance}}.
Retrieves all animation definitions.
Retrieves an animation definition by name.
Retrieves the animation framework settings.
Gets the current state (for debugging/testing).
Callback implementation for Raxol.Core.Behaviours.BaseManager.handle_manager_cast/2.
Callback implementation for Raxol.Core.Behaviours.BaseManager.handle_manager_info/2.
Initializes the animation state storage with the given settings.
Stores an active animation instance for a given element.
Stores an animation definition.
Removes a completed or stopped animation instance for a specific element.
Removes all active animations for a specific element.
Updates the animation framework settings.
Functions
Batch updates multiple active animations at once for performance.
Returns a specification to start this module under a supervisor.
See Supervisor.
Clears all animation state (used primarily for testing or reset).
Retrieves a specific active animation instance for a given element and animation name.
Retrieves all active animations.
Returns a map of {element_id, %{animation_name => instance}}.
Retrieves all animation definitions.
Retrieves an animation definition by name.
Retrieves the animation framework settings.
Gets the current state (for debugging/testing).
Callback implementation for Raxol.Core.Behaviours.BaseManager.handle_manager_cast/2.
Callback implementation for Raxol.Core.Behaviours.BaseManager.handle_manager_info/2.
Initializes the animation state storage with the given settings.
Stores an active animation instance for a given element.
Stores an animation definition.
Removes a completed or stopped animation instance for a specific element.
Removes all active animations for a specific element.
Updates the animation framework settings.