lib.rs 1.27 KiB
use bevy_app::{App, Last, Plugin};
#[cfg(feature = "bevy_defaults")]
mod bevy_tweenables;
mod commands;
mod components;
mod easing;
mod events;
mod systems;
#[cfg(feature = "bevy_defaults")]
pub use bevy_tweenables::{
TweenImageNodeColour, TweenSpriteColour, TweenTextColour, TweenTransformScale,
TweenTransformTranslation, TweenableColour,
};
pub use commands::{ClearTweensExt, RegisterTweenableExt, UpdateOwnTweenExt, UpdateTweenExt};
pub use components::{
ActiveTweens, Tween, TweenMode, TweenTarget, Tweenable, UpdateTween, UpdateUserData,
};
pub use easing::{EaseTween, easing_functions};
pub use events::{
DESPAWN_ANCESTORS_ON_TWEEN_COMPLETE_EVENT, DESPAWN_ON_TWEEN_COMPLETE_EVENT, TweenComplete,
TweenLooped,
};
pub struct TweenPlugin;
impl Plugin for TweenPlugin {
fn build(&self, app: &mut App) {
#[cfg(feature = "bevy_defaults")]
{
app.register_tweenable::<TweenImageNodeColour>()
.register_tweenable::<TweenSpriteColour>()
.register_tweenable::<TweenTextColour>()
.register_tweenable::<TweenTransformTranslation>()
.register_tweenable::<TweenTransformScale>();
}
app.add_event::<TweenComplete>()
.add_event::<TweenLooped>()
.add_systems(
Last,
(
systems::despawn_on_complete,
systems::despawn_ancestors_on_complete,
),
);
}
}