Raxol.Animation.EnhancedTransitions (Raxol v2.0.1)

View Source

Enhanced animation transitions with advanced effects and performance optimizations.

This module provides:

  • Morphing transitions between different shapes/states
  • Particle system animations
  • Path-based animations (curves, spirals, etc.)
  • Physics-based animations with spring dynamics
  • Chained animation sequences
  • Performance-optimized batch animations

Summary

Functions

Creates a batch animation that efficiently animates multiple elements simultaneously.

Creates a morphing animation that smoothly transitions between different visual states.

Creates a particle system animation for effects like sparkles, explosions, or trails.

Creates a path-based animation that follows curves, spirals, or custom paths.

Creates a sequence of chained animations that execute one after another.

Creates a physics-based animation using spring dynamics for natural movement.

Functions

create_batch_animation(name, params)

Creates a batch animation that efficiently animates multiple elements simultaneously.

Examples

iex> EnhancedTransitions.create_batch_animation(:stagger_in, %{
...>   elements: ["item1", "item2", "item3", "item4"],
...>   base_animation: :fade_in,
...>   stagger_delay: 100,
...>   duration: 300
...> })

create_morph_animation(name, params)

Creates a morphing animation that smoothly transitions between different visual states.

Examples

iex> EnhancedTransitions.create_morph_animation(:button_to_input, %{
...>   from_state: %{width: 100, height: 30, border_radius: 15},
...>   to_state: %{width: 200, height: 40, border_radius: 5},
...>   duration: 500,
...>   easing: :ease_in_out_cubic
...> })

create_particle_animation(name, params)

Creates a particle system animation for effects like sparkles, explosions, or trails.

Examples

iex> EnhancedTransitions.create_particle_animation(:sparkle_effect, %{
...>   particle_count: 20,
...>   spawn_area: %{x: 0, y: 0, width: 100, height: 50},
...>   velocity_range: %{min: 10, max: 50},
...>   duration: 1000,
...>   particle_lifetime: 800
...> })

create_path_animation(name, params)

Creates a path-based animation that follows curves, spirals, or custom paths.

Examples

iex> EnhancedTransitions.create_path_animation(:spiral_entrance, %{
...>   path_type: :spiral,
...>   center: %{x: 100, y: 100},
...>   radius: 50,
...>   rotations: 2,
...>   duration: 1200,
...>   easing: :ease_out_back
...> })

create_sequence_animation(name, params)

Creates a sequence of chained animations that execute one after another.

Examples

iex> EnhancedTransitions.create_sequence_animation(:entrance_sequence, %{
...>   animations: [
...>     {:fade_in, %{duration: 300, easing: :ease_out}},
...>     {:slide_up, %{duration: 400, easing: :ease_out_back}},
...>     {:scale_bounce, %{duration: 200, easing: :ease_out_bounce}}
...>   ]
...> })

create_spring_animation(name, params)

Creates a physics-based animation using spring dynamics for natural movement.

Examples

iex> EnhancedTransitions.create_spring_animation(:elastic_bounce, %{
...>   target: %{x: 200, y: 150},
...>   spring_tension: 300,
...>   spring_friction: 20,
...>   mass: 1.0,
...>   velocity: %{x: 0, y: 0}
...> })