bevy_flicker

Crates.iobevy_flicker
lib.rsbevy_flicker
version0.6.0
sourcesrc
created_at2023-05-13 00:55:36.774572
updated_at2024-07-13 20:16:41.540673
descriptionAn easy to use event-based system to apply brief overlays to sprites and meshes
homepage
repositoryhttps://github.com/bilowik/bevy_flicker
max_upload_size
id863427
size191,409
(bilowik)

documentation

README

Bevy Flicker

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(),
        );
    }
}


Visual Examples

cargo run --example sprite_flicker
svuL4w_7

cargo run --example mesh_flicker
5b-1OxIy

cargo run --example alpha_flicker
lzwT7Hl-
Commit count: 53

cargo fmt