Skip to content

Commit

Permalink
feat: Add particle brightness change (#43)
Browse files Browse the repository at this point in the history
* Add brightness change to particles
  • Loading branch information
Zac8668 authored Jan 6, 2024
1 parent 218021c commit 954bf5a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/atom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ impl Atom {
pub fn object() -> Self {
Atom {
state: State::Object,
color: [255, 255, 255, 255],
//color: [255, 255, 255, 255],
..Default::default()
}
}
Expand Down
11 changes: 8 additions & 3 deletions src/particles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,19 @@ pub fn hydrate_particles(
) {
//Spawn particle sprite
for (particle, ent) in particles.iter() {
let mult = if particle.state == PartState::Normal {
1.2
} else {
0.8
};
commands
.entity(ent)
.insert(SpriteBundle {
sprite: Sprite {
color: Color::rgba(
particle.atom.color[0] as f32 / 255.,
particle.atom.color[1] as f32 / 255.,
particle.atom.color[2] as f32 / 255.,
particle.atom.color[0] as f32 / 255. * mult,
particle.atom.color[1] as f32 / 255. * mult,
particle.atom.color[2] as f32 / 255. * mult,
particle.atom.color[3] as f32 / 255.,
),
custom_size: Some(Vec2::new(1.0, 1.0)),
Expand Down

0 comments on commit 954bf5a

Please sign in to comment.