Skip to content

Latest commit

 

History

History
366 lines (257 loc) · 18.4 KB

File metadata and controls

366 lines (257 loc) · 18.4 KB

Changelog

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

[0.15.0] 2026-01-31

This version is compatible with Bevy 0.18

Added

  • Added the missing EntityEvent derive to AnimCompletedEvent.
  • Added UiTransformTranslationPxLens to animate the translation of a UiTransform (pixel values only).

Changed

  • Compatible with Bevy 0.18

Fixed

  • Fix examples, add a missing UiTransformScaleLens to animate the UiTransform::scale.

[0.14.0] 2025-10-07

This version is compatible with Bevy 0.17

This change introduces a major API redesign compared to v0.13. It removes the need for generics, and unifies all animations of all components and assets, executing them from a single exclusive system. See the Migration Guide for v0.14 for details.

Added

  • Added TweenAnim, a representation of the runtime parameters of an active animation.

  • Added AnimTarget, a component describing (via its AnimTargetKind) the target mutated by an animation.

  • Added some extension functions on EntityCommands to enable simplified create-and-spawn patterns:

    commands
      // Spawn an entity to animate the position of
      .spawn(Transform::default())
      // Create-and-spawn a new Transform::translation animation
      .move_to(
          Vec3::new(1., 2., -4.),
          Duration::from_secs(1),
          EaseFunction::QuadraticInOut,
      );

    See EntityCommandsTweeningExtensions for all the possible animations.

  • Added AnimCompletedEvent, raised when the entire tweenable animation completed.

  • Added CycleCompletedEvent, optionally raised when a single tweenable animation cycle completed. Enable it with Tween::with_cycle_completed_event().

  • Added TotalDuration::from_cycles() to simply creating an animation duration from a number of individual cycles and their duration.

  • Added TotalDuration::is_finite() helper to check an animation duration is finite.

  • Added TotalDuration::as_finite() helper to convert an animation duration into a Duration type if it's finite.

  • Implemented various operations on TotalDuration: From<Duration>, Add, Sum, PartialOrd, Ord.

  • Added Tweenable::cycle_fraction() to query the current position of the animation inside a cycle. This is roughly equivalent to the previous progress().

  • Added Tween::cycle_fraction() and Tween::cycle_index() to query the position of the animation inside a cycle and the cycle number, respectively.

  • Added helper Tween::is_cycle_mirrored(), which returns true if the playback of the current cycle the animation is at is mirrored. This always returns false unless RepeatStrategy::MirroredRepeat is used, and the animation contains more than 1 cycle.

  • Added a new example follow demonstrating how to achieve following-with-smoothing. The example moves an entity to follow the mouse cursor on screen.

  • Added a new example ambient_light showing how to animate resources (here, AmbientLight).

  • Added new built-in lenses applying a rotation on top of the existing Transform::rotation:

    • TransformRotateAdditiveXLens
    • TransformRotateAdditiveYLens
    • TransformRotateAdditiveZLens

    Those are useful to create animations with infinitely-rotating objects.

Changed

  • The bevy_asset feature was removed; bevy_tweening now depends on bevy/bevy_asset always. You can just delete that feature from your Cargo.toml if you were adding it explicitly.

  • Sequence now accepts infinite duration child animations. It's your responsibility to ensure the resulting sequence makes sense, which generally means only using an infinite animation as the last item.

  • The following types lost their generic parameter <T>:

    • Tweenable
    • Tween
    • Sequence
    • Delay They still implicitly depend on a target type, but this is not encoded in the Rust type anymore.
  • The Lens<T> trait now takes its target as Mut<T> instead of &mut dyn Targetable<T>.

    fn lerp(&mut self, target: Mut<T>, ratio: f32)

    The functioning is the same, but this removes one level of indirection. The use of Mut<T> should be familiar to most Bevy users.

  • Tweenable::duration() was renamed to Tweenable::cycle_duration() for clarity.

  • Tweenable::times_completed() was renamed to Tweenable::cycles_completed() for clarity.

  • Tweenable::tick() was renamed to Tweenable::step(), to insist on the fact the step computes a new state, but doesn't necessarily moves any time back or forth.

  • Tween::with_completed_event() doesn't take user_data anymore, which was removed. Instead it takes a bool indicating whether to send completion events or not.

  • Renamed Tween<T>::set_direction() into Tween::set_playback_direction() for clarity, and Tween<T>::direction() into Tween::playback_direction(). Note the clarified semantic of playback direction vs. mirroring repeat; see the migration guide for details.

  • Renamed AnimatorState into PlaybackState for clarity.

  • Renamed TweeningDirection into PlaybackDirection to clarify the fact it only affects animation playback, and is completely unrelated to cycle mirroring repeat.

Removed

  • Removed the component_animator_system and asset_animator_system. Animations are now auto-played based on the presence of a TweenAnim component. There's no need for you to manually register anything.
  • Removed Tracks<T>. Use multiple animations instead.
  • Removed Targetable, ComponentTarget, AssetTarget. Those were workarounds for the inability to use Mut<T> directly. In Bevy 0.16 they're not necessary.
  • Removed all references to "progress" in all APIs, in favor of Durations.
  • Removed the user_data value from completed events.
  • Removed callback-based completion events. Use Bevy-style events or one-shot systems instead. Observers are also supported.

[0.13.0] - 2025-04-28

Changed

  • Compatible with Bevy 0.16

Fixed

  • Fixed Sequence::duration() returning the wrong result when any child is repeating. (#143)

[0.12.0] - 2024-12-07

Changed

  • Compatible with Bevy 0.15
  • Replaced interpolation::EaseFunction with bevy_math::EaseFunction, and removed the interpolation crate dependency.

[0.11.0] - 2024-07-08

Changed

  • Compatible with Bevy 0.14
  • Lens::lerp() now takes a &mut dyn Targetable<T> instead of &mut T. This ensures the lens can skip change detection if needed. Targetable<T> conceptually acts like a Mut<T>, but allows encapsulating assets too. There should be no other change than the function signature to upgrade custom lenses, because dyn Targetable<T> now implements Defer and DeferMut, so can be used in place of &mut T.
  • AssetTarget::new() now takes a simple Mut<Assets<T>> instead of ResMut<Assets<T>>.

Fixed

  • Fixed change detection such that lenses which do not dereference their target do not unconditionally mark that target (component or asset) as changed from the point of view of ECS. (#91)

Added

  • Added Targetable::target(&self) -> &T.
  • dyn Targetable<T> now implements Defer and DeferMut, so can be used in place of &T and &mut T.
  • Added ComponentTarget::to_mut(&mut self) -> Mut<'_, T> to "reborrow" the component target as a Mut<T>.

[0.10.0] - 2024-02-27

Changed

  • Compatible with Bevy 0.13

[0.9.0] - 2023-11-07

Changed

  • Compatible with Bevy 0.12
  • The AssetAnimator<T> doesn't take any Handle<T> anymore; instead the asset_animator_system::<T>() retrieves the handle of the asset to animate from the same Entity the AssetAnimator<T> is attached to. This aligns the behavior with component animation. (#101)

Fixed

  • Fixed a panic when a TextLens tried to change a text section that wasn't present.

Added

  • Added built-in support for the BackgroundColor bevy component, under the bevy_ui feature.

[0.8.0] - 2023-07-12

Changed

  • Compatible with Bevy 0.11

[0.7.0] - 2023-03-09

Added

  • Added From<u32> and From<Duration> for RepeatCount, respectively yielding RepeatCount::Finite(value) and RepeatCount::For(value).

Changed

  • Compatible with Bevy 0.10
  • Changed the signature of with_repeat_count() to take an impl Into<RepeatCount> instead of a RepeatCount by value.

[0.6.0] - 2022-11-15

Added

  • Added RepeatCount and RepeatStrategy for more granular control over animation looping.
  • Added with_repeat_count() and with_repeat_strategy() builder methods to Tween<T>.
  • Added a speed() getter on Animator<T> and AssetAnimator<T>.
  • Added set_elapsed(Duration) and elapsed() -> Duration to the Tweenable<T> trait. Those methods are preferable over set_progress() and progress() as they avoid the conversion to floating-point values and any rounding errors.
  • Added a new bevy_text feature for Text-related built-in lenses.
  • Added Targetable, ComponentTarget, and AssetTarget, which should be considered private even though they appear in the public API. They are a workaround for Bevy 0.8 and will likely be removed in the future once the related Bevy limitation is lifted.
  • Added the missing Tween::with_completed() to raise a callback.
  • Added completion event and callback support to Delay<T>, similar to what existed for Tween<T>.
  • Added TotalDuration and a new Tweenable<T>::total_duration() method to retrieve the total duration of the animation including looping.

Changed

  • Compatible with Bevy 0.9
  • Removed the tweening_type parameter from the signature of Tween<T>::new(); use with_repeat_count() and with_repeat_strategy() instead.
  • Animators now always have a tween (instead of it being optional). This means the default animator implementation was removed.
  • Delay::new() now panics if the duration is zero. This prevents creating no-op Delay objects, and avoids an internal edge case producing wrong results.
  • Tweens moving to TweenState::Completed are now guaranteed to freeze their state. In particular, this means that their direction will not flip at the end of the last loop if their repeat strategy is RepeatStrategy::MirroredRepeat.
  • Moved the TextColorLens lens from the bevy_ui feature to the new bevy_text one, to allow using it without the Bevy UI crate.
  • Changed the signature of the component_animator_system() and asset_animator_system() public functions to directly consume a ResMut<Events<TweenCompleted>> instead of an EventWriter<TweenCompleted>, to work around some internal limitations.
  • Changed Delay into Delay<T>, taking the animation target type like other tweenables, to be able to emit events and raise callbacks.
  • Changed CompletedCallback<T> to take the tweenable type itself, instead of the target type. Users upgrading should replace CompletedCallback<T> with CompletedCallback<Tween<T>>.
  • The set_progress(), progress(), and times_completed() method of Tweenable<T> now have a default implementation, and all built-in tweenables use that implementation.

Removed

  • Removed Tweenable::is_looping(), which was not implemented for most tweenables.
  • Removed TweeningType in favor of RepeatCount and RepeatStrategy.

Fixed

  • Fixed the animator speed feature, which got broken in #44.
  • Fixed change detection triggering unconditionally when component_animator_system() or asset_animator_system() are ticked, even when the animator did not mutate its target component or asset. (#33)

[0.5.0] - 2022-08-04

Added

  • Added is_forward() and is_backward() convenience helpers to TweeningDirection.
  • Added 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.
  • Added support for dynamically changing an animation's speed with Animator::set_speed.
  • Added AnimationSystem label to tweening tick systems.
  • Added a BoxedTweenable trait to make working with Box<dyn Tweenable + ...> easier.

Changed

  • Compatible with Bevy 0.8
  • Double boxing in Sequence and Tracks was fixed. As a result, any custom tweenables should implement From for BoxedTweenable to make those APIs easier to use.

[0.4.0] - 2022-04-16

Changed

  • Compatible with Bevy 0.7
  • Better dependencies: Introduced features bevy_sprite and bevy_ui taking a dependency on the same-named crates of Bevy, and removed the forced dependency on bevy/render. The new features are enabled by default, for discoverability, and only impact the prebuilt lenses. The library now builds without any Bevy optional feature.

[0.3.3] - 2022-03-05

Added

  • Added new built-in rotation lenses based on angle interpolation, to allow rotation animations larger than a half turn:
    • TransformRotateXLens
    • TransformRotateYLens
    • TransformRotateZLens
    • TransformRotateAxisLens

[0.3.2] - 2022-02-24

Added

  • Implemented Default for TweeningType (= Once), EaseMethod (= Linear), TweeningDirection (= Forward).
  • Added Tweenable::is_looping(), Tweenable::set_progress(), Tweenable::times_completed(), and Tweenable::rewind().
  • Added Animator::set_progress(), Animator::progress(), Animator::stop(), and Animator::rewind().
  • Added AssetAnimator::set_progress(), AssetAnimator::progress(), AssetAnimator::stop(), and AssetAnimator::rewind().
  • Added the TweenCompleted event, raised when a Tween<T> completed its animation if that feature was previously activated with set_completed_event() or with_completed_event().

Changed

  • TweenState now contains only two states: Active and Completed. Looping animations are always active, and non-looping ones are completed once they reach their end point.
  • Merged the started and ended callbacks into a completed one (Tween::set_completed() and Tween::clear_completed()), which is invoked when the tween completes a single iteration. That is, for non-looping animations, when TweenState::Completed is reached. And for looping animations, once per iteration (going from start -> end, or from end -> start).

Removed

  • Removed Tweenable::stop(). Tweenables do not have a "stop" state anymore, they are only either active or completed. The playback state is only relevant on the Animator or AssetAnimator which controls them.

Fixed

  • Fixed a bug with the alpha value of colored lenses being too large (TextColorLens, SpriteColorLens, ColorMaterialColorLens).

[0.3.1] - 2022-02-12

Added

  • Add user callbacks on tween started (Tween::set_started) and ended (Tween::set_ended).
  • Implement Default for AnimatorState as AnimatorState::Playing.
  • Added Animator::with_state() and AssetAnimator::with_state(), builder-like functions to override the default AnimatorState.
  • Added Tween::is_looping() returning true for all but TweeningType::Once.
  • Added the Tweenable<T> trait, implemented by the Tween<T> and Delay<T> animation, and by the Tracks<T> and Sequence<T> animation collections.
  • Added IntoBoxDynTweenable<T>, a trait to convert a Tweenable<T> trait object into a boxed variant.
  • Publicly exposed Sequence<T>, a sequence of Tweenable<T> running one after the other.
  • Publicly exposed Tracks<T>, a collection of Tweenable<T> running in parallel.
  • Publicly exposed TweenState, the playback state of a single Tweenable<T> item.
  • Added Tween<T>::then() and Sequence<T>::then() to append a Tweenable<T> to a sequence (creating a new sequence in the case of Tween<T>::then()).
  • Added tweenable() and tweenable_mut() on the Animator<T> and AssetAnimator<T> to access their top-level Tweenable<T>.
  • Implemented Default for Animator<T> and AssetAnimator<T>, creating an animator without any tweenable item (no-op).
  • Added Delay tweenable for a time delay between other tweens.
  • Added a new menu example demonstrating in particular the Delay tweenable.

Changed

  • Moved tween duration out of the TweeningType enum, which combined with the removal of the "pause" feature in loops makes it a C-like enum.
  • The Sequence<T> progress now reports the progress of the total sequence. Individual sub-tweenables cannot be accessed.
  • Updated the sequence example to add some text showing the current sequence progress.
  • Modified the signature of new() for Animator<T> and AssetAnimator<T> to take a single Tweenable<T> instead of trying to build a Tween<T> internally. This allows passing any Tweenable<T> as the top-level animatable item of an animator, and avoids the overhead of maintaining a Tracks<T> internally in each animator when the most common use case is likely to use a single Tween<T> or a Sequence<T> without parallelism.

Removed

  • Removed the "pause" feature in-between loops of TweeningType::Loop and TweeningType::PingPong, which can be replaced if needed by a sequence including a Delay tweenable. Removed Tween::is_paused().
  • Removed new_single() and new_seq() on the Animator<T> and AssetAnimator<T>. Users should explicitly create a Tween<T> or Sequence<T> instead, and use new().

Fixed

  • Fix missing public export of component_animator_system() and asset_animator_system() preventing the animation of all but the built-in items.

[0.3.0] - 2022-01-28

Added

  • Add Tween<T> describing a single tween animation, independently of its target (asset or component).
  • Add Tween<T>::is_paused() to query when a tweening animation is in its pause phase, if any.
  • Add Tween<T>::direction() to query the playback direction of a tweening animation (forward or backward).
  • Add Tween<T>::progress() to query the progres ratio in [0:1] of a tweening animation.
  • Enable multiple lenses per animator via "tracks", the ability to add multiple tween animations running in parallel on the same component.
  • Enable sequences of tween animations running serially, one after the other, for each track of an animator, allowing to create more complex animations.

Fixed

  • Perform spherical linear interpolation (slerp) for Quat rotation of Transform animation via TransformRotationLens, instead of mere linear interpolation leaving the quaternion non-normalized.

[0.2.0] - 2022-01-09

Changed

  • Update to Bevy 0.6
  • Update to rust edition 2021
  • Force Cargo resolver v2

Added

  • Added built-in lens SpriteColorLens, since the color of a Sprite is now an intrinsic property of the component in Bevy 0.6, and does not use ColorMaterial anymore.

[0.1.0] - 2021-12-24

Initial version for Bevy 0.5