Crates.io | bevy_flicker |
lib.rs | bevy_flicker |
version | 0.6.0 |
source | src |
created_at | 2023-05-13 00:55:36.774572 |
updated_at | 2024-07-13 20:16:41.540673 |
description | An easy to use event-based system to apply brief overlays to sprites and meshes |
homepage | |
repository | https://github.com/bilowik/bevy_flicker |
max_upload_size | |
id | 863427 |
size | 191,409 |
This plugin facilitates creating a brief overlay/mix of a specific color over a sprite or mesh.
To trigger a flicker, you can send a FlickerStartEvent, which will contain the parameters that dictate the color, length, and strength of the flicker.
Included is also a RepeatingFlicker component that will send a FlickerStartEvent on an interval.
This also works on textures with alpha, the overlay takes into account the alpha of the
underlying texture and will adjust the overlay alpha so that it's intensity is proportional between
different underlying alpha values. So an underlying 0.2 alpha value will reduce the alpha of the overlay by
80%. For alpha values of 0, the overlay's alpha will also be 0.
See this alpha example for
a visual of this effect, you will notice that the underlying color is still looks consistent across the
sprite.
See more, complete examples (some shown below) here
use bevy_flicker::prelude::*;
fn tick(query: Query<Entity>, mut event_writer: EventWriter<FlickerStartEvent>) {
for e in query.iter() {
event_writer.send(
FlickerStartEvent::builder(e)
.with_secs(0.5)
.with_color(Color::rgba(0.0, 0.0, 1.0, 0.2))
.build(),
);
}
}
cargo run --example sprite_flicker |
---|
cargo run --example mesh_flicker |
---|
cargo run --example alpha_flicker |
---|