1 unstable release
new 0.1.0 | Dec 20, 2024 |
---|
#12 in #transition
49KB
85 lines
bevy_button_transitions
A simple button transition component (less than 100 lines of code). Supports image swapping and color tinting like Unity does.
Supported Bevy Versions
Bevy | bevy_button_transitions |
---|---|
0.15 | 0.1 |
ToDo
- Support Animations
- Remove unnecessary dependencies (currently uses bevy as whole, which might not be needed)
- currently needs reflection, which might be unnecessary
lib.rs
:
Provides Unity style button interactions
Currently supports color tinting and image swapping.
Getting started
Import the crate to bring all necessary types into scope:
use bevy_button_transitions::*;
Add ButtonTransitionsPlugin
to setup the system:
app.add_plugins(ButtonTransitionsPlugin);
Add the ButtonTransition
component to your buttons
commands.spawn((
ButtonTransition::ColorTint(ColorTint::default()),
ImageNode {
image: asset_server.load("normal_image.png"),
..default()
},
Node {
width: Val::Px(250.0),
height: Val::Px(80.0),
..default()
},
));
Be aware that the color tint button transition needs an image to tint!
Dependencies
~22–32MB
~523K SLoC