Raxol. Effects. BorderBeam
(Raxol v2.6.0)
View Source
Animated border beam effect for terminal interfaces.
Creates a traveling glow that orbits around an element's border, mirroring the border-beam React component. Three visual layers:
- Beam stroke -- bright colored highlight traveling clockwise
- Inner glow -- muted background color inside the border at the beam head
- Outer bloom -- dim foreground bleed outside the border at the beam head
Example
beam = BorderBeam.new(color_variant: :ocean, duration_ms: 2000)
beam = BorderBeam.set_bounds(beam, %{x: 5, y: 2, width: 30, height: 10})
# In your tick handler (30 FPS):
beam = BorderBeam.update(beam)
buffer = BorderBeam.apply(beam, buffer)Configuration
BorderBeam.new(
size: :full, # :full | :compact | :line
color_variant: :colorful, # :colorful | :mono | :ocean | :sunset
strength: 0.8, # 0.0-1.0 overall intensity
duration_ms: 2000, # ms for one full orbit
trail_length: 0.25, # fraction of perimeter the trail covers
fade_ms: 300, # fade in/out transition time
static_colors: false # disables color cycling when true
)
Summary
Functions
Renders the three beam layers onto the buffer.
Creates a new BorderBeam effect with the given options.
Toggles active state with fade transition.
Sets the target bounds and computes the perimeter path.
Updates timing state. Call each frame.
Updates config fields. Recomputes perimeter if size changed.
Returns true if the effect is currently rendering (active or mid-fade).
Types
@type config() :: %{ size: size(), color_variant: Raxol.Effects.BorderBeam.Colors.variant(), strength: float(), duration_ms: pos_integer(), brightness: float(), saturation: float(), hue_range: non_neg_integer(), border_style: atom(), fade_ms: pos_integer(), trail_length: float(), static_colors: boolean(), enabled: boolean() }
@type size() :: :full | :compact | :line
Functions
Renders the three beam layers onto the buffer.
Layer order: bloom (lowest) -> inner glow -> beam stroke (highest). Only modifies cell styles, never replaces characters.
Creates a new BorderBeam effect with the given options.
Toggles active state with fade transition.
Sets the target bounds and computes the perimeter path.
Updates timing state. Call each frame.
Updates config fields. Recomputes perimeter if size changed.
Returns true if the effect is currently rendering (active or mid-fade).