Alaja.Components.AnimatedBar (Alaja v1.0.0)

Copy Markdown View Source

Animated bar component with embedded animation in the filled portion.

Renders a progress bar where the filled portion displays a moving animation pattern while the empty portion stays static. The bar size is fixed based on value/max ratio, and the animation runs indefinitely.

Animation types

  • :spinner — spinner characters cycle through the filled portion
  • :kitt — a bright scanner spot moves back-and-forth across the filled portion with gradient
  • :pulse — the filled portion pulses in intensity
  • :wave — a wave-like pattern moves through the filled portion
  • :rainbow — colors cycle through the filled portion

Summary

Functions

Renders a single frame of the animated bar.

Runs the animated bar in a loop until the process receives a shutdown signal, the user presses Ctrl+C, or the maximum number of iterations is reached.

Functions

render_frame(value, max, position, opts \\ [])

@spec render_frame(number(), number(), non_neg_integer(), keyword()) :: iodata()

Renders a single frame of the animated bar.

Options

  • :animation — animation type (:spinner, :kitt, :pulse, :wave, :rainbow; default :spinner)
  • :width — total bar width in chars (default: 40)
  • :filled_char — char for filled portion (default: "▓")
  • :empty_char — char for empty portion (default: "░")
  • :filled_color — RGB tuple for filled portion color
  • :empty_color — RGB tuple for empty portion color
  • :animation_color — RGB tuple for the animation highlight
  • :label — optional label text before the bar
  • :show_percent — show percentage at end (default: true)

run_infinite(value, max, opts \\ [])

@spec run_infinite(number(), number(), keyword()) :: :ok

Runs the animated bar in a loop until the process receives a shutdown signal, the user presses Ctrl+C, or the maximum number of iterations is reached.

Options

  • :max_iterations — safety limit to prevent infinite loops (default: 100_000)