Alaja.Components.Pulsar (Alaja v2.4.0)

Copy Markdown View Source

Pulsar/radar animation component with gradient wave effect.

Renders a rectangular area with content (text or image) in the center, surrounded by characters that animate with a pulse/radar wave effect.

Uses the Cell/Buffer engine for proper rendering.

Options

  • :width — total width in characters (default: 40)
  • :height — total height in lines (default: 7)
  • :text — central text to display
  • :content_type:text or :image (default: :text)
  • :content_position_x — X offset for content within pulsar (default: center)
  • :content_position_y — Y offset for content within pulsar (default: center)
  • :pulse_chars — characters used for pulse effect (default: ["░", "▒", "▓", "█"])
  • :colors — list of RGB tuples for gradient (default: [{0, 180, 216}])
  • :speed — animation speed in ms (default: 100)
  • :direction:out or :in wave direction (default: :out)
  • :align — text alignment (:left, :center, :right; default: :center)

Summary

Functions

Returns the default options for the pulsar component.

Renders a single frame of the pulsar animation.

Renders a single frame of the pulsar animation as pixel data.

Functions

default_opts()

@spec default_opts() :: keyword()

Returns the default options for the pulsar component.

render_frame(text, frame, opts \\ [])

@spec render_frame(String.t(), non_neg_integer(), keyword()) :: Alaja.Buffer.t()

Renders a single frame of the pulsar animation.

Returns iodata representing the current frame.

render_frame_pixels(image_path, frame, opts \\ [])

@spec render_frame_pixels(String.t(), non_neg_integer(), keyword()) ::
  {:ok, [[{0..255, 0..255, 0..255}]]} | {:error, String.t()}

Renders a single frame of the pulsar animation as pixel data.

Returns pixel data as a list of rows, each row a list of {r, g, b} tuples. Used when content_type is :image for compositing with image protocols.