From f08891cb8ef8946f4d9838e9ac1f05ada3d94192 Mon Sep 17 00:00:00 2001 From: Jerome Humbert Date: Mon, 8 Jul 2024 19:58:17 +0100 Subject: [PATCH] v0.11.0 --- CHANGELOG.md | 3 ++- README.md | 45 +++++++++++++++++++++-------------------- benchmarks/Cargo.toml | 2 +- src/tweenable.rs | 47 ++++++++++++++++++++++++------------------- 4 files changed, 52 insertions(+), 45 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dd2d7a9..51e1108 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,10 +3,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [Unreleased] +## [0.11.0] - 2024-07-08 ### Changed +- Compatible with Bevy 0.14 - `Lens::lerp()` now takes a `&mut dyn Targetable` instead of `&mut T`. This ensures the lens can skip change detection if needed. `Targetable` conceptually acts like a `Mut`, but allows encapsulating assets too. diff --git a/README.md b/README.md index 9840e64..64669dc 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ [![Crate](https://img.shields.io/crates/v/bevy_tweening.svg)](https://crates.io/crates/bevy_tweening) [![Build Status](https://github.com/djeedai/bevy_tweening/actions/workflows/ci.yaml/badge.svg)](https://github.com/djeedai/bevy_tweening/actions/workflows/ci.yaml) [![Coverage Status](https://coveralls.io/repos/github/djeedai/bevy_tweening/badge.svg?branch=main&kill_cache=1)](https://coveralls.io/github/djeedai/bevy_tweening?branch=main) -[![Bevy tracking](https://img.shields.io/badge/Bevy%20tracking-v0.13-lightblue)](https://github.com/bevyengine/bevy/blob/main/docs/plugins_guidelines.md#main-branch-tracking) +[![Bevy tracking](https://img.shields.io/badge/Bevy%20tracking-v0.14-lightblue)](https://github.com/bevyengine/bevy/blob/main/docs/plugins_guidelines.md#main-branch-tracking) Tweening animation plugin for the Bevy game engine. @@ -24,7 +24,7 @@ Add to `Cargo.toml`: ```toml [dependencies] -bevy_tweening = "0.10" +bevy_tweening = "0.11" ``` This crate supports the following features: @@ -144,17 +144,17 @@ The naming scheme for predefined lenses is `"Lens"`, wher | Target Component | Animated Field | Lens | Feature | |---|---|---|---| -| [`Transform`](https://docs.rs/bevy/0.12.0/bevy/transform/components/struct.Transform.html) | [`translation`](https://docs.rs/bevy/0.12.0/bevy/transform/components/struct.Transform.html#structfield.translation) | [`TransformPositionLens`](https://docs.rs/bevy_tweening/latest/bevy_tweening/lens/struct.TransformPositionLens.html) | | -| | [`rotation`](https://docs.rs/bevy/0.12.0/bevy/transform/components/struct.Transform.html#structfield.rotation) (`Quat`)¹ | [`TransformRotationLens`](https://docs.rs/bevy_tweening/latest/bevy_tweening/lens/struct.TransformRotationLens.html) | | -| | [`rotation`](https://docs.rs/bevy/0.12.0/bevy/transform/components/struct.Transform.html#structfield.rotation) (angle)² | [`TransformRotateXLens`](https://docs.rs/bevy_tweening/latest/bevy_tweening/lens/struct.TransformRotateXLens.html) | | -| | [`rotation`](https://docs.rs/bevy/0.12.0/bevy/transform/components/struct.Transform.html#structfield.rotation) (angle)² | [`TransformRotateYLens`](https://docs.rs/bevy_tweening/latest/bevy_tweening/lens/struct.TransformRotateYLens.html) | | -| | [`rotation`](https://docs.rs/bevy/0.12.0/bevy/transform/components/struct.Transform.html#structfield.rotation) (angle)² | [`TransformRotateZLens`](https://docs.rs/bevy_tweening/latest/bevy_tweening/lens/struct.TransformRotateZLens.html) | | -| | [`rotation`](https://docs.rs/bevy/0.12.0/bevy/transform/components/struct.Transform.html#structfield.rotation) (angle)² | [`TransformRotateAxisLens`](https://docs.rs/bevy_tweening/latest/bevy_tweening/lens/struct.TransformRotateAxisLens.html) | | -| | [`scale`](https://docs.rs/bevy/0.12.0/bevy/transform/components/struct.Transform.html#structfield.scale) | [`TransformScaleLens`](https://docs.rs/bevy_tweening/latest/bevy_tweening/lens/struct.TransformScaleLens.html) | | -| [`Sprite`](https://docs.rs/bevy/0.12.0/bevy/sprite/struct.Sprite.html) | [`color`](https://docs.rs/bevy/0.12.0/bevy/sprite/struct.Sprite.html#structfield.color) | [`SpriteColorLens`](https://docs.rs/bevy_tweening/latest/bevy_tweening/lens/struct.SpriteColorLens.html) | `bevy_sprite` | -| [`Style`](https://docs.rs/bevy/0.12.0/bevy/ui/struct.Style.html) | [`position`](https://docs.rs/bevy/0.12.0/bevy/ui/struct.Style.html#structfield.position) | [`UiPositionLens`](https://docs.rs/bevy_tweening/latest/bevy_tweening/lens/struct.UiPositionLens.html) | `bevy_ui` | -| [`BackgroundColor`](https://docs.rs/bevy/0.12.0/bevy/ui/struct.BackgroundColor.html)| | [`UiBackgroundColorLens`](https://docs.rs/bevy_tweening/latest/bevy_tweening/lens/struct.UiBackgroundColorLens.html) | `bevy_ui` | -| [`Text`](https://docs.rs/bevy/0.12.0/bevy/text/struct.Text.html) | [`TextStyle::color`](https://docs.rs/bevy/0.12.0/bevy/text/struct.TextStyle.html#structfield.color) | [`TextColorLens`](https://docs.rs/bevy_tweening/latest/bevy_tweening/lens/struct.TextColorLens.html) | `bevy_text` | +| [`Transform`](https://docs.rs/bevy/0.14.0/bevy/transform/components/struct.Transform.html) | [`translation`](https://docs.rs/bevy/0.14.0/bevy/transform/components/struct.Transform.html#structfield.translation) | [`TransformPositionLens`](https://docs.rs/bevy_tweening/latest/bevy_tweening/lens/struct.TransformPositionLens.html) | | +| | [`rotation`](https://docs.rs/bevy/0.14.0/bevy/transform/components/struct.Transform.html#structfield.rotation) (`Quat`)¹ | [`TransformRotationLens`](https://docs.rs/bevy_tweening/latest/bevy_tweening/lens/struct.TransformRotationLens.html) | | +| | [`rotation`](https://docs.rs/bevy/0.14.0/bevy/transform/components/struct.Transform.html#structfield.rotation) (angle)² | [`TransformRotateXLens`](https://docs.rs/bevy_tweening/latest/bevy_tweening/lens/struct.TransformRotateXLens.html) | | +| | [`rotation`](https://docs.rs/bevy/0.14.0/bevy/transform/components/struct.Transform.html#structfield.rotation) (angle)² | [`TransformRotateYLens`](https://docs.rs/bevy_tweening/latest/bevy_tweening/lens/struct.TransformRotateYLens.html) | | +| | [`rotation`](https://docs.rs/bevy/0.14.0/bevy/transform/components/struct.Transform.html#structfield.rotation) (angle)² | [`TransformRotateZLens`](https://docs.rs/bevy_tweening/latest/bevy_tweening/lens/struct.TransformRotateZLens.html) | | +| | [`rotation`](https://docs.rs/bevy/0.14.0/bevy/transform/components/struct.Transform.html#structfield.rotation) (angle)² | [`TransformRotateAxisLens`](https://docs.rs/bevy_tweening/latest/bevy_tweening/lens/struct.TransformRotateAxisLens.html) | | +| | [`scale`](https://docs.rs/bevy/0.14.0/bevy/transform/components/struct.Transform.html#structfield.scale) | [`TransformScaleLens`](https://docs.rs/bevy_tweening/latest/bevy_tweening/lens/struct.TransformScaleLens.html) | | +| [`Sprite`](https://docs.rs/bevy/0.14.0/bevy/sprite/struct.Sprite.html) | [`color`](https://docs.rs/bevy/0.14.0/bevy/sprite/struct.Sprite.html#structfield.color) | [`SpriteColorLens`](https://docs.rs/bevy_tweening/latest/bevy_tweening/lens/struct.SpriteColorLens.html) | `bevy_sprite` | +| [`Style`](https://docs.rs/bevy/0.14.0/bevy/ui/struct.Style.html) | [`position`](https://docs.rs/bevy/0.14.0/bevy/ui/struct.Style.html#structfield.position) | [`UiPositionLens`](https://docs.rs/bevy_tweening/latest/bevy_tweening/lens/struct.UiPositionLens.html) | `bevy_ui` | +| [`BackgroundColor`](https://docs.rs/bevy/0.14.0/bevy/ui/struct.BackgroundColor.html)| | [`UiBackgroundColorLens`](https://docs.rs/bevy_tweening/latest/bevy_tweening/lens/struct.UiBackgroundColorLens.html) | `bevy_ui` | +| [`Text`](https://docs.rs/bevy/0.14.0/bevy/text/struct.Text.html) | [`TextStyle::color`](https://docs.rs/bevy/0.14.0/bevy/text/struct.TextStyle.html#structfield.color) | [`TextColorLens`](https://docs.rs/bevy_tweening/latest/bevy_tweening/lens/struct.TextColorLens.html) | `bevy_text` | ¹ Shortest-path interpolation between two rotations, using `Quat::slerp()`. @@ -168,7 +168,7 @@ Asset animation always requires the `bevy_asset` feature. | Target Asset | Animated Field | Lens | Feature | |---|---|---|---| -| [`ColorMaterial`](https://docs.rs/bevy/0.12.0/bevy/sprite/struct.ColorMaterial.html) | [`color`](https://docs.rs/bevy/0.12.0/bevy/sprite/struct.ColorMaterial.html#structfield.color) | [`ColorMaterialColorLens`](https://docs.rs/bevy_tweening/latest/bevy_tweening/lens/struct.ColorMaterialColorLens.html) | `bevy_asset` + `bevy_sprite` | +| [`ColorMaterial`](https://docs.rs/bevy/0.14.0/bevy/sprite/struct.ColorMaterial.html) | [`color`](https://docs.rs/bevy/0.14.0/bevy/sprite/struct.ColorMaterial.html#structfield.color) | [`ColorMaterialColorLens`](https://docs.rs/bevy_tweening/latest/bevy_tweening/lens/struct.ColorMaterialColorLens.html) | `bevy_asset` + `bevy_sprite` | ## Custom lens @@ -226,7 +226,7 @@ The process is similar to custom components, creating a custom lens for the cust ## Examples -See the [`examples/`](https://github.com/djeedai/bevy_tweening/tree/77b89d9df5a28f66ae6b153e6d24cf0d58042353/examples) folder. +See the [`examples/`](https://github.com/djeedai/bevy_tweening/tree/ef7090cddd19971316ee1583076007f67ead6580/examples) folder. ### [`menu`](examples/menu.rs) @@ -234,7 +234,7 @@ See the [`examples/`](https://github.com/djeedai/bevy_tweening/tree/77b89d9df5a2 cargo run --example menu --features="bevy/bevy_winit" ``` -![menu](https://raw.githubusercontent.com/djeedai/bevy_tweening/77b89d9df5a28f66ae6b153e6d24cf0d58042353/examples/menu.gif) +![menu](https://raw.githubusercontent.com/djeedai/bevy_tweening/ef7090cddd19971316ee1583076007f67ead6580/examples/menu.gif) ### [`sprite_color`](examples/sprite_color.rs) @@ -242,7 +242,7 @@ cargo run --example menu --features="bevy/bevy_winit" cargo run --example sprite_color --features="bevy/bevy_winit" ``` -![sprite_color](https://raw.githubusercontent.com/djeedai/bevy_tweening/77b89d9df5a28f66ae6b153e6d24cf0d58042353/examples/sprite_color.gif) +![sprite_color](https://raw.githubusercontent.com/djeedai/bevy_tweening/ef7090cddd19971316ee1583076007f67ead6580/examples/sprite_color.gif) ### [`transform_rotation`](examples/transform_rotation.rs) @@ -250,7 +250,7 @@ cargo run --example sprite_color --features="bevy/bevy_winit" cargo run --example transform_rotation --features="bevy/bevy_winit" ``` -![sprite_color](https://raw.githubusercontent.com/djeedai/bevy_tweening/77b89d9df5a28f66ae6b153e6d24cf0d58042353/examples/transform_rotation.gif) +![sprite_color](https://raw.githubusercontent.com/djeedai/bevy_tweening/ef7090cddd19971316ee1583076007f67ead6580/examples/transform_rotation.gif) ### [`transform_translation`](examples/transform_translation.rs) @@ -258,7 +258,7 @@ cargo run --example transform_rotation --features="bevy/bevy_winit" cargo run --example transform_translation --features="bevy/bevy_winit" ``` -![sprite_color](https://raw.githubusercontent.com/djeedai/bevy_tweening/77b89d9df5a28f66ae6b153e6d24cf0d58042353/examples/transform_translation.gif) +![sprite_color](https://raw.githubusercontent.com/djeedai/bevy_tweening/ef7090cddd19971316ee1583076007f67ead6580/examples/transform_translation.gif) ### [`colormaterial_color`](examples/colormaterial_color.rs) @@ -266,7 +266,7 @@ cargo run --example transform_translation --features="bevy/bevy_winit" cargo run --example colormaterial_color --features="bevy/bevy_winit" ``` -![colormaterial_color](https://raw.githubusercontent.com/djeedai/bevy_tweening/77b89d9df5a28f66ae6b153e6d24cf0d58042353/examples/colormaterial_color.gif) +![colormaterial_color](https://raw.githubusercontent.com/djeedai/bevy_tweening/ef7090cddd19971316ee1583076007f67ead6580/examples/colormaterial_color.gif) ### [`ui_position`](examples/ui_position.rs) @@ -274,7 +274,7 @@ cargo run --example colormaterial_color --features="bevy/bevy_winit" cargo run --example ui_position --features="bevy/bevy_winit" ``` -![ui_position](https://raw.githubusercontent.com/djeedai/bevy_tweening/77b89d9df5a28f66ae6b153e6d24cf0d58042353/examples/ui_position.gif) +![ui_position](https://raw.githubusercontent.com/djeedai/bevy_tweening/ef7090cddd19971316ee1583076007f67ead6580/examples/ui_position.gif) ### [`sequence`](examples/sequence.rs) @@ -282,7 +282,7 @@ cargo run --example ui_position --features="bevy/bevy_winit" cargo run --example sequence --features="bevy/bevy_winit" ``` -![sequence](https://raw.githubusercontent.com/djeedai/bevy_tweening/77b89d9df5a28f66ae6b153e6d24cf0d58042353/examples/sequence.gif) +![sequence](https://raw.githubusercontent.com/djeedai/bevy_tweening/ef7090cddd19971316ee1583076007f67ead6580/examples/sequence.gif) ## Ease Functions @@ -327,6 +327,7 @@ Compatibility of `bevy_tweening` versions: | `bevy_tweening` | `bevy` | | :-- | :-- | +| `0.11` | `0.14` | | `0.10` | `0.13` | | `0.9` | `0.12` | | `0.8` | `0.11` | diff --git a/benchmarks/Cargo.toml b/benchmarks/Cargo.toml index cf0d9f6..a0b79cd 100644 --- a/benchmarks/Cargo.toml +++ b/benchmarks/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bevy_tweening_bench" -version = "0.10.0" +version = "0.11.0" authors = ["Jerome Humbert "] edition = "2021" description = "Tweening plugin for Bevy -- Benchmarks" diff --git a/src/tweenable.rs b/src/tweenable.rs index c3b80d0..8443773 100644 --- a/src/tweenable.rs +++ b/src/tweenable.rs @@ -273,7 +273,7 @@ impl<'a, T: Asset> AssetTarget<'a, T> { /// Check if the current target is valid given the value of [`handle`]. /// - /// [`handle`]: self::handle + /// [`handle`]: AssetTarget::handle pub fn is_valid(&self) -> bool { self.assets.contains(&self.handle) } @@ -583,9 +583,10 @@ impl Tween { /// Enable running a one-shot system upon completion. /// - /// If enabled, the tween will run a system via a provided [`SystemId`] when the - /// animation completes. This is similar to the [`with_completed()`], - /// but uses a system registered by [`register_system()`] instead of a callback. + /// If enabled, the tween will run a system via a provided [`SystemId`] when + /// the animation completes. This is similar to the + /// [`with_completed()`], but uses a system registered by + /// [`register_system()`] instead of a callback. /// /// # Example /// @@ -716,9 +717,10 @@ impl Tween { /// Enable running a one-shot system upon completion. /// - /// If enabled, the tween will run a system via a provided [`SystemId`] when the - /// animation completes. This is similar to the [`with_completed()`], - /// but uses a system registered by [`register_system()`] instead of a callback. + /// If enabled, the tween will run a system via a provided [`SystemId`] when + /// the animation completes. This is similar to the + /// [`with_completed()`], but uses a system registered by + /// [`register_system()`] instead of a callback. /// /// [`with_completed()`]: Tween::with_completed /// [`register_system()`]: bevy::ecs::world::World::register_system @@ -1145,7 +1147,7 @@ impl Delay { /// }); /// ``` /// - /// [`with_completed_event()`]: Tween::with_completed_event + /// [`with_completed_event()`]: Delay::with_completed_event pub fn with_completed(mut self, callback: C) -> Self where C: Fn(Entity, &Self) + Send + Sync + 'static, @@ -1156,9 +1158,10 @@ impl Delay { /// Enable running a one-shot system upon completion. /// - /// If enabled, the tween will run a system via a provided [`SystemId`] when the - /// animation completes. This is similar to the [`with_completed()`], - /// but uses a system registered by [`register_system()`] instead. + /// If enabled, the tween will run a system via a provided [`SystemId`] when + /// the animation completes. This is similar to the + /// [`with_completed()`], but uses a system registered by + /// [`register_system()`] instead. /// /// # Example /// @@ -1186,7 +1189,7 @@ impl Delay { /// } /// ``` /// - /// [`with_completed()`]: Tween::with_completed + /// [`with_completed()`]: Delay::with_completed /// [`register_system()`]: bevy::ecs::world::World::register_system #[must_use] pub fn with_completed_system(mut self, system_id: SystemId) -> Self { @@ -1226,7 +1229,7 @@ impl Delay { /// /// See also [`set_completed()`]. /// - /// [`set_completed()`]: Tween::set_completed + /// [`set_completed()`]: Delay::set_completed pub fn clear_completed(&mut self) { self.on_completed = None; } @@ -1239,8 +1242,8 @@ impl Delay { /// /// See [`with_completed_event()`] for details. /// - /// [`set_completed()`]: Tween::set_completed - /// [`with_completed_event()`]: Tween::with_completed_event + /// [`set_completed()`]: Delay::set_completed + /// [`with_completed_event()`]: Delay::with_completed_event pub fn set_completed_event(&mut self, user_data: u64) { self.event_data = Some(user_data); } @@ -1249,20 +1252,22 @@ impl Delay { /// /// See also [`set_completed_event()`]. /// - /// [`set_completed_event()`]: Tween::set_completed_event + /// [`set_completed_event()`]: Delay::set_completed_event pub fn clear_completed_event(&mut self) { self.event_data = None; } /// Enable running a one-shot system upon completion. /// - /// If enabled, the tween will run a system via a provided [`SystemId`] when the - /// animation completes. This is similar to the [`with_completed()`], - /// but uses a system registered by [`register_system()`] instead of a callback. + /// If enabled, the tween will run a system via a provided [`SystemId`] when + /// the animation completes. This is similar to the + /// [`with_completed()`], but uses a system registered by + /// [`register_system()`] instead of a callback. /// /// See [`with_completed_system()`] for details. /// - /// [`with_completed()`]: Tween::with_completed + /// [`with_completed()`]: Delay::with_completed + /// [`with_completed_system()`]: Delay::with_completed_system /// [`register_system()`]: bevy::ecs::world::World::register_system pub fn set_completed_system(&mut self, system_id: SystemId) { self.system_id = Some(system_id); @@ -1272,7 +1277,7 @@ impl Delay { /// /// See also [`set_completed_system()`]. /// - /// [`clear_completed_system()`]: Tween::clear_completed_system + /// [`set_completed_system()`]: Delay::set_completed_system pub fn clear_completed_system(&mut self) { self.system_id = None; }