diff --git a/CHANGELOG.md b/CHANGELOG.md index 3604dc7521e46740603483497b70ab621585c1ac..a421d5dbb692e8e13f18bf8445fed6003e926572 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Add `is_forward()` and `is_backward()` convenience helpers to `TweeningDirection`. - Add `Tween::set_direction()` and `Tween::with_direction()` which allow configuring the playback direction of a tween, allowing to play it backward from end to start. - Support dynamically changing an animation's speed with `Animator::set_speed` +- Add `AnimationSystem` label to tweening tick systems ## [0.4.0] - 2022-04-16 diff --git a/src/lib.rs b/src/lib.rs index 587e67ba8300f4a6b1f24c361b6b86df2927a651..51f0f8611f4ed62ab56f4bc60aa3e2ebcecafa1b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -158,7 +158,9 @@ mod plugin; mod tweenable; pub use lens::Lens; -pub use plugin::{asset_animator_system, component_animator_system, TweeningPlugin}; +pub use plugin::{ + asset_animator_system, component_animator_system, AnimationSystem, TweeningPlugin, +}; pub use tweenable::{Delay, Sequence, Tracks, Tween, TweenCompleted, TweenState, Tweenable}; /// Type of looping for a tween animation. diff --git a/src/plugin.rs b/src/plugin.rs index ff98803a91f601e297e5f4015b4b26e91ffb29dc..10f0c077028b36e17cee636616f26c7ff753650e 100644 --- a/src/plugin.rs +++ b/src/plugin.rs @@ -33,19 +33,29 @@ pub struct TweeningPlugin; impl Plugin for TweeningPlugin { fn build(&self, app: &mut App) { - app.add_event::<TweenCompleted>() - .add_system(component_animator_system::<Transform>); + app.add_event::<TweenCompleted>().add_system( + component_animator_system::<Transform>.label(AnimationSystem::AnimationUpdate), + ); #[cfg(feature = "bevy_ui")] - app.add_system(component_animator_system::<Text>) - .add_system(component_animator_system::<Style>); + app.add_system(component_animator_system::<Text>.label(AnimationSystem::AnimationUpdate)) + .add_system(component_animator_system::<Style>.label(AnimationSystem::AnimationUpdate)); #[cfg(feature = "bevy_sprite")] - app.add_system(component_animator_system::<Sprite>) - .add_system(asset_animator_system::<ColorMaterial>); + app.add_system(component_animator_system::<Sprite>.label(AnimationSystem::AnimationUpdate)) + .add_system( + asset_animator_system::<ColorMaterial>.label(AnimationSystem::AnimationUpdate), + ); } } +/// Label enum for the systems relating to animations +#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash, SystemLabel)] +pub enum AnimationSystem { + /// Ticks animations + AnimationUpdate, +} + /// Animator system for components. /// /// This system extracts all components of type `T` with an `Animator<T>` attached to the same entity,