Expand description
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!
Structs§
- Button
Transitions Plugin - A
Plugin
that sets up button transitions. - Color
Tint - Defines the different tints of a
ButtonTransition::ColorTint
. - Image
Swap - Defines the different image swaps of a
ButtonTransition::ImageSwap
. - Interactable
- A
Component
that determines if a button can be pressed.
Enums§
- Button
Transition - A
Component
that automatically adds transitions for a button.