Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Velocity Modifiers #44

Merged
merged 17 commits into from
Mar 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions examples/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ use bevy::{
DefaultPlugins,
};
use bevy_particle_systems::{
ColorOverTime, ColorPoint, Gradient, JitteredValue, ParticleBurst, ParticleSystem,
ParticleSystemBundle, ParticleSystemPlugin, ParticleTexture, Playing,
ColorOverTime, Curve, CurvePoint, JitteredValue, ParticleBurst, ParticleSystem,
ParticleSystemBundle, ParticleSystemPlugin, ParticleTexture, Playing, VelocityModifier::*,
};

fn main() {
Expand Down Expand Up @@ -37,12 +37,12 @@ fn startup_system(mut commands: Commands, asset_server: Res<AssetServer>) {
texture: ParticleTexture::Sprite(asset_server.load("px.png")),
spawn_rate_per_second: 1000.0.into(),
initial_speed: JitteredValue::jittered(200.0, -50.0..50.0),
drag: 0.01.into(),
velocity_modifiers: vec![Drag(0.01.into())],
lifetime: JitteredValue::jittered(8.0, -2.0..2.0),
color: ColorOverTime::Gradient(Gradient::new(vec![
ColorPoint::new(Color::PURPLE, 0.0),
ColorPoint::new(Color::RED, 0.5),
ColorPoint::new(Color::rgba(0.0, 0.0, 1.0, 0.0), 1.0),
color: ColorOverTime::Gradient(Curve::new(vec![
CurvePoint::new(Color::PURPLE, 0.0),
CurvePoint::new(Color::RED, 0.5),
CurvePoint::new(Color::rgba(0.0, 0.0, 1.0, 0.0), 1.0),
])),
looping: true,
system_duration_seconds: 10.0,
Expand Down
93 changes: 0 additions & 93 deletions examples/drag.rs

This file was deleted.

16 changes: 8 additions & 8 deletions examples/local_space.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ use bevy_math::Quat;
use bevy_time::Time;

use bevy_particle_systems::{
CircleSegment, ColorOverTime, ColorPoint, Gradient, JitteredValue, ParticleSpace,
ParticleSystem, ParticleSystemBundle, ParticleSystemPlugin, ParticleTexture, Playing,
CircleSegment, ColorOverTime, Curve, CurvePoint, JitteredValue, ParticleSpace, ParticleSystem,
ParticleSystemBundle, ParticleSystemPlugin, ParticleTexture, Playing,
};

#[derive(Debug, Component)]
Expand Down Expand Up @@ -48,9 +48,9 @@ fn startup_system(mut commands: Commands, asset_server: Res<AssetServer>) {
spawn_rate_per_second: 35.0.into(),
initial_speed: JitteredValue::jittered(25.0, 0.0..5.0),
lifetime: JitteredValue::jittered(3.0, -2.0..2.0),
color: ColorOverTime::Gradient(Gradient::new(vec![
ColorPoint::new(Color::RED, 0.0),
ColorPoint::new(Color::rgba(0.0, 0.0, 0.0, 0.0), 1.0),
color: ColorOverTime::Gradient(Curve::new(vec![
CurvePoint::new(Color::RED, 0.0),
CurvePoint::new(Color::rgba(0.0, 0.0, 0.0, 0.0), 1.0),
])),
looping: true,
system_duration_seconds: 10.0,
Expand Down Expand Up @@ -79,9 +79,9 @@ fn startup_system(mut commands: Commands, asset_server: Res<AssetServer>) {
spawn_rate_per_second: 35.0.into(),
initial_speed: JitteredValue::jittered(25.0, 0.0..5.0),
lifetime: JitteredValue::jittered(3.0, -2.0..2.0),
color: ColorOverTime::Gradient(Gradient::new(vec![
ColorPoint::new(Color::GREEN, 0.0),
ColorPoint::new(Color::rgba(0.0, 0.0, 0.0, 0.0), 1.0),
color: ColorOverTime::Gradient(Curve::new(vec![
CurvePoint::new(Color::GREEN, 0.0),
CurvePoint::new(Color::rgba(0.0, 0.0, 0.0, 0.0), 1.0),
])),
looping: true,
system_duration_seconds: 10.0,
Expand Down
24 changes: 12 additions & 12 deletions examples/shape_emitter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ use bevy_app::PluginGroup;
use bevy_asset::AssetServer;

use bevy_particle_systems::{
CircleSegment, ColorOverTime, ColorPoint, EmitterShape, Gradient, JitteredValue,
ParticleSystem, ParticleSystemBundle, ParticleSystemPlugin, ParticleTexture, Playing,
CircleSegment, ColorOverTime, Curve, CurvePoint, EmitterShape, JitteredValue, ParticleSystem,
ParticleSystemBundle, ParticleSystemPlugin, ParticleTexture, Playing,
};

fn main() {
Expand Down Expand Up @@ -40,11 +40,11 @@ fn startup_system(mut commands: Commands, asset_server: Res<AssetServer>) {
texture: ParticleTexture::Sprite(asset_server.load("arrow.png")),
spawn_rate_per_second: 10.0.into(),
initial_speed: JitteredValue::jittered(70.0, -3.0..3.0),
lifetime: JitteredValue::jittered(10.0, -2.0..2.0),
color: ColorOverTime::Gradient(Gradient::new(vec![
ColorPoint::new(Color::PURPLE, 0.0),
ColorPoint::new(Color::RED, 0.5),
ColorPoint::new(Color::rgba(0.0, 0.0, 1.0, 0.0), 1.0),
lifetime: JitteredValue::jittered(3.0, -2.0..2.0),
color: ColorOverTime::Gradient(Curve::new(vec![
CurvePoint::new(Color::PURPLE, 0.0),
CurvePoint::new(Color::RED, 0.5),
CurvePoint::new(Color::rgba(0.0, 0.0, 1.0, 0.0), 1.0),
])),
emitter_shape: EmitterShape::line(200.0, std::f32::consts::FRAC_PI_4),
looping: true,
Expand All @@ -67,11 +67,11 @@ fn startup_system(mut commands: Commands, asset_server: Res<AssetServer>) {
texture: ParticleTexture::Sprite(asset_server.load("arrow.png")),
spawn_rate_per_second: 10.0.into(),
initial_speed: JitteredValue::jittered(70.0, -3.0..3.0),
lifetime: JitteredValue::jittered(10.0, -2.0..2.0),
color: ColorOverTime::Gradient(Gradient::new(vec![
ColorPoint::new(Color::PURPLE, 0.0),
ColorPoint::new(Color::RED, 0.5),
ColorPoint::new(Color::rgba(0.0, 0.0, 1.0, 0.0), 1.0),
lifetime: JitteredValue::jittered(3.0, -2.0..2.0),
color: ColorOverTime::Gradient(Curve::new(vec![
CurvePoint::new(Color::PURPLE, 0.0),
CurvePoint::new(Color::RED, 0.5),
CurvePoint::new(Color::rgba(0.0, 0.0, 1.0, 0.0), 1.0),
])),
emitter_shape: CircleSegment {
radius: 10.0.into(),
Expand Down
8 changes: 4 additions & 4 deletions examples/texture_atlas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use bevy_app::App;
use bevy_asset::{AssetServer, Assets};
use bevy_math::Vec2;
use bevy_particle_systems::{
ColorOverTime, ColorPoint, Gradient, JitteredValue, ParticleSystem, ParticleSystemBundle,
ColorOverTime, Curve, CurvePoint, JitteredValue, ParticleSystem, ParticleSystemBundle,
ParticleSystemPlugin, ParticleTexture, Playing,
};
use bevy_sprite::TextureAtlas;
Expand Down Expand Up @@ -45,9 +45,9 @@ fn startup_system(
lifetime: 3.0.into(),
initial_speed: JitteredValue::jittered(150.0, -50.0..50.0),
scale: 1.5.into(),
color: ColorOverTime::Gradient(Gradient::new(vec![
ColorPoint::new(Color::WHITE, 0.0),
ColorPoint::new(Color::rgba(1.0, 1.0, 1.0, 0.0), 1.0),
color: ColorOverTime::Gradient(Curve::new(vec![
CurvePoint::new(Color::WHITE, 0.0),
CurvePoint::new(Color::rgba(1.0, 1.0, 1.0, 0.0), 1.0),
])),
..Default::default()
},
Expand Down
16 changes: 8 additions & 8 deletions examples/time_scaling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ use bevy::{
};
use bevy_asset::AssetServer;
use bevy_particle_systems::{
CircleSegment, ColorOverTime, ColorPoint, Gradient, JitteredValue, ParticleSpace,
ParticleSystem, ParticleSystemBundle, ParticleSystemPlugin, ParticleTexture, Playing,
CircleSegment, ColorOverTime, Curve, CurvePoint, JitteredValue, ParticleSpace, ParticleSystem,
ParticleSystemBundle, ParticleSystemPlugin, ParticleTexture, Playing,
};
use bevy_time::Time;
fn main() {
Expand Down Expand Up @@ -40,9 +40,9 @@ fn startup_system(mut commands: Commands, asset_server: Res<AssetServer>) {
spawn_rate_per_second: 35.0.into(),
initial_speed: JitteredValue::jittered(25.0, 0.0..5.0),
lifetime: JitteredValue::jittered(3.0, -2.0..2.0),
color: ColorOverTime::Gradient(Gradient::new(vec![
ColorPoint::new(Color::RED, 0.0),
ColorPoint::new(Color::rgba(0.0, 0.0, 0.0, 0.0), 1.0),
color: ColorOverTime::Gradient(Curve::new(vec![
CurvePoint::new(Color::RED, 0.0),
CurvePoint::new(Color::rgba(0.0, 0.0, 0.0, 0.0), 1.0),
])),
looping: true,
system_duration_seconds: 10.0,
Expand Down Expand Up @@ -71,9 +71,9 @@ fn startup_system(mut commands: Commands, asset_server: Res<AssetServer>) {
spawn_rate_per_second: 35.0.into(),
initial_speed: JitteredValue::jittered(25.0, 0.0..5.0),
lifetime: JitteredValue::jittered(3.0, -2.0..2.0),
color: ColorOverTime::Gradient(Gradient::new(vec![
ColorPoint::new(Color::GREEN, 0.0),
ColorPoint::new(Color::rgba(0.0, 0.0, 0.0, 0.0), 1.0),
color: ColorOverTime::Gradient(Curve::new(vec![
CurvePoint::new(Color::GREEN, 0.0),
CurvePoint::new(Color::rgba(0.0, 0.0, 0.0, 0.0), 1.0),
])),
looping: true,
system_duration_seconds: 10.0,
Expand Down
Loading