Raxol. Demo. Particles
(Raxol v2.6.0)
View Source
Particle system for animated demo effects. Supports sparkles, explosions, trails, and floating elements.
Summary
Functions
Creates a new particle at the given position.
Creates a cascading explosion particle that spawns children.
Creates an explosion particle (radiates outward).
Creates a rain particle (falls down).
Creates a rain particle with phase for sine wave motion.
Creates a ring of particles expanding outward. Y is compressed for terminal aspect ratio.
Creates a rising rocket particle with trail.
Creates a particle with size-based character selection. Size can be :small, :medium, or :large.
Creates an explosion particle with size distribution. 70% small, 25% medium, 5% large.
Creates a sparkle particle (rising, fading).
Creates a trail particle (slow fade, minimal movement).
Creates a particle with trail tracking enabled.
Returns a random color from a specific palette.
Filters out dead particles.
Returns a random color from the available palettes.
Renders particles to a frame buffer, returns ANSI escape sequences.
Renders particles with their trail history. Trail chars fade from bright to dim.
Updates a particle's position and life.
Updates cascading particles and returns {updated_particle, spawned_children}. Call this when you need cascade behavior.
Updates particle without gravity (for floating effects).
Updates particle and maintains position history for trail effect. Keeps last 4 positions.
Types
@type particle() :: %{ :x => float(), :y => float(), :vx => float(), :vy => float(), :char => String.t(), :color => non_neg_integer(), :life => integer(), :history => [{float(), float()}], :generation => non_neg_integer(), :spawn_at_life => non_neg_integer(), optional(:phase) => float() }
Functions
Creates a new particle at the given position.
Creates a cascading explosion particle that spawns children.
Creates an explosion particle (radiates outward).
@spec create_rain(float(), float(), non_neg_integer()) :: particle()
Creates a rain particle (falls down).
@spec create_rain_with_phase(float(), float(), non_neg_integer(), float()) :: particle()
Creates a rain particle with phase for sine wave motion.
Creates a ring of particles expanding outward. Y is compressed for terminal aspect ratio.
Creates a rising rocket particle with trail.
Creates a particle with size-based character selection. Size can be :small, :medium, or :large.
Creates an explosion particle with size distribution. 70% small, 25% medium, 5% large.
Creates a sparkle particle (rising, fading).
@spec create_trail(float(), float(), non_neg_integer()) :: particle()
Creates a trail particle (slow fade, minimal movement).
Creates a particle with trail tracking enabled.
@spec palette_color(atom()) :: non_neg_integer()
Returns a random color from a specific palette.
Filters out dead particles.
@spec random_color() :: non_neg_integer()
Returns a random color from the available palettes.
@spec render([particle()], non_neg_integer(), non_neg_integer()) :: String.t()
Renders particles to a frame buffer, returns ANSI escape sequences.
@spec render_with_trails( [particle()], non_neg_integer(), non_neg_integer() ) :: String.t()
Renders particles with their trail history. Trail chars fade from bright to dim.
Updates a particle's position and life.
Updates cascading particles and returns {updated_particle, spawned_children}. Call this when you need cascade behavior.
Updates particle without gravity (for floating effects).
Updates particle and maintains position history for trail effect. Keeps last 4 positions.