Raxol.Animation.Physics.PhysicsEngine (Raxol v0.5.0)
View SourcePhysics engine for Raxol animations.
Provides physics-based animation capabilities including:
- Spring simulations
- Gravity and bounce effects
- Friction and damping
- Collisions
- Particle systems
- Force fields
These can be used to create natural, organic animations that respond to user interactions in a physically plausible way.
Summary
Functions
Adds a force field to the physics world.
Adds an object to the physics world.
Applies an impulse force to an object.
Creates a particle system at the specified position.
Creates a new physics object with the given properties.
Creates a new physics world with default values.
Creates a new physics world with custom settings.
Removes an object from the physics world.
Sets the boundaries of the physics world.
Creates a spring force between two objects.
Updates the physics world by one time step.
Types
@type physics_object() :: %{ id: String.t(), position: Raxol.Animation.Physics.Vector.t(), velocity: Raxol.Animation.Physics.Vector.t(), acceleration: Raxol.Animation.Physics.Vector.t(), mass: float(), forces: [Raxol.Animation.Physics.Vector.t()], constraints: map(), properties: map() }
@type world_state() :: %{ objects: %{required(String.t()) => physics_object()}, gravity: Raxol.Animation.Physics.Vector.t(), time_scale: float(), iteration: non_neg_integer(), boundaries: map(), force_fields: [Raxol.Animation.Physics.ForceField.t()], last_update: integer() }
Functions
Adds a force field to the physics world.
Adds an object to the physics world.
Applies an impulse force to an object.
Creates a particle system at the specified position.
Creates a new physics object with the given properties.
Creates a new physics world with default values.
Creates a new physics world with custom settings.
Removes an object from the physics world.
Sets the boundaries of the physics world.
Creates a spring force between two objects.
Updates the physics world by one time step.