Crate bevy_button_transitions

Source
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§

ButtonTransitionsPlugin
A Plugin that sets up button transitions.
ColorTint
Defines the different tints of a ButtonTransition::ColorTint.
ImageSwap
Defines the different image swaps of a ButtonTransition::ImageSwap.
Interactable
A Component that determines if a button can be pressed.

Enums§

ButtonTransition
A Component that automatically adds transitions for a button.