Raxol.Terminal.Graphics.Animation (Raxol v2.0.1)
View SourceTerminal graphics animation adapter that bridges the existing Raxol.Animation.Framework with terminal graphics capabilities.
This module provides:
- Frame-based animation system for terminal graphics
- Integration with Kitty protocol animations
- Smooth transitions for graphics elements
- Performance monitoring for terminal animations
- Fallback support for non-animation terminals
Usage
# Create a graphics fade animation
Graphics.Animation.create_graphics_animation(:fade_in, %{
duration: 500,
easing: :ease_out_cubic,
from: %{opacity: 0.0},
to: %{opacity: 1.0}
})
# Animate an image scaling
Graphics.Animation.create_image_animation(:scale_up, %{
duration: 300,
from: %{width: 100, height: 100},
to: %{width: 200, height: 200}
})
Summary
Functions
Returns a specification to start this module under a supervisor.
Creates a graphics animation definition for use with terminal graphics.
Creates a smooth image animation between frames.
Gets current performance metrics for graphics animations.
Callback implementation for Raxol.Core.Behaviours.BaseManager.handle_manager_cast/2.
Starts a graphics animation on a specific graphics element.
Stops a running graphics animation.
Types
@type animation_id() :: String.t()
@type frame_data() :: %{ timestamp: non_neg_integer(), graphics_id: graphics_id(), properties: map() }
@type graphics_id() :: non_neg_integer()
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
Creates a graphics animation definition for use with terminal graphics.
Parameters
name- Animation name/identifierparams- Animation parameters including:duration- Animation duration in millisecondseasing- Easing function (see Raxol.Animation.Interpolate)from/to- Graphics properties to animateframe_delay- Delay between frames (default: calculated from fps)
Creates a smooth image animation between frames.
Parameters
name- Animation nameframes- List of image data for animation framesoptions- Animation options (duration, loop_count, etc.)
@spec get_performance_metrics() :: map()
Gets current performance metrics for graphics animations.
Callback implementation for Raxol.Core.Behaviours.BaseManager.handle_manager_cast/2.
@spec start_graphics_animation(atom(), graphics_id(), map()) :: {:ok, animation_id()} | {:error, term()}
Starts a graphics animation on a specific graphics element.
Parameters
animation_name- Name of the animation to startgraphics_id- Graphics element ID to animateoptions- Additional options for the animation instance
@spec stop_graphics_animation(animation_id()) :: :ok | {:error, term()}
Stops a running graphics animation.