MCPcopy Index your code
hub / github.com/abnormalbrain/bevy_particle_systems

github.com/abnormalbrain/bevy_particle_systems @0.13.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release 0.13.0 ↗ · + Follow
98 symbols 130 edges 12 files 22 documented · 22%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

bevy_particle_systems

Crates.io docs MIT

A native and WASM-compatible 2D particle system plugin for bevy

Note: This crate is still under development and its API may change between releases.

Example

The above was captured running a release build of the basic example, cargo run --example basic --release, and ran at 190-200 FPS on a 2019 Intel i9 MacBook Pro, rendering about 10k particles.

INFO bevy diagnostic: frame_time                      :    5.125810ms (avg 5.211673ms)
INFO bevy diagnostic: fps                             :  206.027150   (avg 204.176718)
INFO bevy diagnostic: entity_count                    : 11358.713999   (avg 11341.450000)

Usage

  1. Add the [ParticleSystemPlugin] plugin.
use bevy::prelude::*;
use bevy_particle_systems::ParticleSystemPlugin;

fn main() {
    App::new()
        .add_plugins((DefaultPlugins, ParticleSystemPlugin)) // <-- Add the plugin
        // ...
        .add_systems(Startup, spawn_particle_system)
        .run();
}

fn spawn_particle_system() { /* ... */ }
  1. Spawn a particle system whenever necessary.
use bevy::prelude::*;
use bevy_particle_systems::*;

fn spawn_particle_system(mut commands: Commands, asset_server: Res<AssetServer>) {
    commands
    // Add the bundle specifying the particle system itself.
    .spawn(ParticleSystemBundle {
        particle_system: ParticleSystem {
            max_particles: 10_000,
            texture: ParticleTexture::Sprite(asset_server.load("my_particle.png")),
            spawn_rate_per_second: 25.0.into(),
            initial_speed: JitteredValue::jittered(3.0, -1.0..1.0),
            lifetime: JitteredValue::jittered(8.0, -2.0..2.0),
            color: ColorOverTime::Gradient(Gradient::new(vec![
                ColorPoint::new(Color::WHITE, 0.0),
                ColorPoint::new(Color::srgba(0.0, 0.0, 1.0, 0.0), 1.0),
            ])),
            looping: true,
            system_duration_seconds: 10.0,
            ..ParticleSystem::default()
        },
        ..ParticleSystemBundle::default()
    })
    // Add the playing component so it starts playing. This can be added later as well.
    .insert(Playing);
}

Bevy Versions

bevy_particle_systems bevy
0.13 0.14
0.12 0.13
0.11 0.12
0.10 0.11
0.9 0.10
0.6 - 0.8 0.9
0.5 0.8
0.4 0.7

Extension points exported contracts — how you extend this code

Lerpable (Interface)
Linearly interpolates between two values by a given percentage. ``pct`` should be between `0.0` and `1.0`, but it is up [3 …
src/values.rs
ErrorDefault (Interface)
Define the default value returned by a [`Curve`] if misconfigured. [3 implementers]
src/values.rs
RoughlyEqual (Interface)
Determines whether or not two values of an imprecise type are close enough to call equal. Provides implementations for [2 …
src/values.rs

Core symbols most depended-on inside this repo

get_value
called by 11
src/values.rs
lerp
called by 9
src/values.rs
at_lifetime_pct
called by 7
src/values.rs
sample
called by 5
src/values.rs
roughly_equal
called by 4
src/values.rs
lerp
called by 2
src/values.rs
get_particle_sqr_speed
called by 2
src/values.rs
get_particle_direction
called by 2
src/values.rs

Shape

Function 32
Class 28
Method 26
Enum 9
Interface 3

Languages

Rust100%

Modules by API surface

src/values.rs43 symbols
src/components.rs22 symbols
src/systems.rs7 symbols
examples/local_space.rs6 symbols
examples/velocity_modifiers.rs3 symbols
examples/time_scaling.rs3 symbols
examples/texture_atlas.rs3 symbols
examples/oneshot.rs3 symbols
src/lib.rs2 symbols
examples/shape_emitter.rs2 symbols
examples/directional.rs2 symbols
examples/basic.rs2 symbols

For agents

$ claude mcp add bevy_particle_systems \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact