The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
This version is compatible with Bevy 0.18
- Added the missing
EntityEventderive toAnimCompletedEvent. - Added
UiTransformTranslationPxLensto animate the translation of aUiTransform(pixel values only).
- Compatible with Bevy 0.18
- Fix examples, add a missing
UiTransformScaleLensto animate theUiTransform::scale.
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
TweenAnim, a representation of the runtime parameters of an active animation. -
Added
AnimTarget, a component describing (via itsAnimTargetKind) the target mutated by an animation. -
Added some extension functions on
EntityCommandsto 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
EntityCommandsTweeningExtensionsfor 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 withTween::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 aDurationtype 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 previousprogress(). -
Added
Tween::cycle_fraction()andTween::cycle_index()to query the position of the animation inside a cycle and the cycle number, respectively. -
Added helper
Tween::is_cycle_mirrored(), which returnstrueif the playback of the current cycle the animation is at is mirrored. This always returnsfalseunlessRepeatStrategy::MirroredRepeatis used, and the animation contains more than 1 cycle. -
Added a new example
followdemonstrating how to achieve following-with-smoothing. The example moves an entity to follow the mouse cursor on screen. -
Added a new example
ambient_lightshowing how to animate resources (here,AmbientLight). -
Added new built-in lenses applying a rotation on top of the existing
Transform::rotation:TransformRotateAdditiveXLensTransformRotateAdditiveYLensTransformRotateAdditiveZLens
Those are useful to create animations with infinitely-rotating objects.
-
The
bevy_assetfeature was removed;bevy_tweeningnow depends onbevy/bevy_assetalways. You can just delete that feature from yourCargo.tomlif you were adding it explicitly. -
Sequencenow 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>:TweenableTweenSequenceDelayThey 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 asMut<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 toTweenable::cycle_duration()for clarity. -
Tweenable::times_completed()was renamed toTweenable::cycles_completed()for clarity. -
Tweenable::tick()was renamed toTweenable::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 takeuser_dataanymore, which was removed. Instead it takes aboolindicating whether to send completion events or not. -
Renamed
Tween<T>::set_direction()intoTween::set_playback_direction()for clarity, andTween<T>::direction()intoTween::playback_direction(). Note the clarified semantic of playback direction vs. mirroring repeat; see the migration guide for details. -
Renamed
AnimatorStateintoPlaybackStatefor clarity. -
Renamed
TweeningDirectionintoPlaybackDirectionto clarify the fact it only affects animation playback, and is completely unrelated to cycle mirroring repeat.
- Removed the
component_animator_systemandasset_animator_system. Animations are now auto-played based on the presence of aTweenAnimcomponent. 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 useMut<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_datavalue from completed events. - Removed callback-based completion events. Use Bevy-style events or one-shot systems instead. Observers are also supported.
- Compatible with Bevy 0.16
- Fixed
Sequence::duration()returning the wrong result when any child is repeating. (#143)
- Compatible with Bevy 0.15
- Replaced
interpolation::EaseFunctionwithbevy_math::EaseFunction, and removed theinterpolationcrate dependency.
- 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 aMut<T>, but allows encapsulating assets too. There should be no other change than the function signature to upgrade custom lenses, becausedyn Targetable<T>now implementsDeferandDeferMut, so can be used in place of&mut T.AssetTarget::new()now takes a simpleMut<Assets<T>>instead ofResMut<Assets<T>>.
- 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
Targetable::target(&self) -> &T. dyn Targetable<T>now implementsDeferandDeferMut, so can be used in place of&Tand&mut T.- Added
ComponentTarget::to_mut(&mut self) -> Mut<'_, T>to "reborrow" the component target as aMut<T>.
- Compatible with Bevy 0.13
- Compatible with Bevy 0.12
- The
AssetAnimator<T>doesn't take anyHandle<T>anymore; instead theasset_animator_system::<T>()retrieves the handle of the asset to animate from the sameEntitytheAssetAnimator<T>is attached to. This aligns the behavior with component animation. (#101)
- Fixed a panic when a
TextLenstried to change a text section that wasn't present.
- Added built-in support for the
BackgroundColorbevy component, under thebevy_uifeature.
- Compatible with Bevy 0.11
- Added
From<u32>andFrom<Duration>forRepeatCount, respectively yieldingRepeatCount::Finite(value)andRepeatCount::For(value).
- Compatible with Bevy 0.10
- Changed the signature of
with_repeat_count()to take animpl Into<RepeatCount>instead of aRepeatCountby value.
- Added
RepeatCountandRepeatStrategyfor more granular control over animation looping. - Added
with_repeat_count()andwith_repeat_strategy()builder methods toTween<T>. - Added a
speed()getter onAnimator<T>andAssetAnimator<T>. - Added
set_elapsed(Duration)andelapsed() -> Durationto theTweenable<T>trait. Those methods are preferable overset_progress()andprogress()as they avoid the conversion to floating-point values and any rounding errors. - Added a new
bevy_textfeature forText-related built-in lenses. - Added
Targetable,ComponentTarget, andAssetTarget, 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 forTween<T>. - Added
TotalDurationand a newTweenable<T>::total_duration()method to retrieve the total duration of the animation including looping.
- Compatible with Bevy 0.9
- Removed the
tweening_typeparameter from the signature ofTween<T>::new(); usewith_repeat_count()andwith_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 thedurationis zero. This prevents creating no-opDelayobjects, and avoids an internal edge case producing wrong results.- Tweens moving to
TweenState::Completedare 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 isRepeatStrategy::MirroredRepeat. - Moved the
TextColorLenslens from thebevy_uifeature to the newbevy_textone, to allow using it without the Bevy UI crate. - Changed the signature of the
component_animator_system()andasset_animator_system()public functions to directly consume aResMut<Events<TweenCompleted>>instead of anEventWriter<TweenCompleted>, to work around some internal limitations. - Changed
DelayintoDelay<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 replaceCompletedCallback<T>withCompletedCallback<Tween<T>>. - The
set_progress(),progress(), andtimes_completed()method ofTweenable<T>now have a default implementation, and all built-in tweenables use that implementation.
- Removed
Tweenable::is_looping(), which was not implemented for most tweenables. - Removed
TweeningTypein favor ofRepeatCountandRepeatStrategy.
- Fixed the animator speed feature, which got broken in #44.
- Fixed change detection triggering unconditionally when
component_animator_system()orasset_animator_system()are ticked, even when the animator did not mutate its target component or asset. (#33)
- Added
is_forward()andis_backward()convenience helpers toTweeningDirection. - Added
Tween::set_direction()andTween::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
AnimationSystemlabel to tweening tick systems. - Added a
BoxedTweenabletrait to make working withBox<dyn Tweenable + ...>easier.
- Compatible with Bevy 0.8
- Double boxing in
SequenceandTrackswas fixed. As a result, any custom tweenables should implementFromforBoxedTweenableto make those APIs easier to use.
- Compatible with Bevy 0.7
- Better dependencies: Introduced features
bevy_spriteandbevy_uitaking a dependency on the same-named crates of Bevy, and removed the forced dependency onbevy/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.
- Added new built-in rotation lenses based on angle interpolation, to allow rotation animations larger than a half turn:
TransformRotateXLensTransformRotateYLensTransformRotateZLensTransformRotateAxisLens
- Implemented
DefaultforTweeningType(=Once),EaseMethod(=Linear),TweeningDirection(=Forward). - Added
Tweenable::is_looping(),Tweenable::set_progress(),Tweenable::times_completed(), andTweenable::rewind(). - Added
Animator::set_progress(),Animator::progress(),Animator::stop(), andAnimator::rewind(). - Added
AssetAnimator::set_progress(),AssetAnimator::progress(),AssetAnimator::stop(), andAssetAnimator::rewind(). - Added the
TweenCompletedevent, raised when aTween<T>completed its animation if that feature was previously activated withset_completed_event()orwith_completed_event().
TweenStatenow contains only two states:ActiveandCompleted. Looping animations are always active, and non-looping ones are completed once they reach their end point.- Merged the
startedandendedcallbacks into acompletedone (Tween::set_completed()andTween::clear_completed()), which is invoked when the tween completes a single iteration. That is, for non-looping animations, whenTweenState::Completedis reached. And for looping animations, once per iteration (going from start -> end, or from end -> start).
- 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 theAnimatororAssetAnimatorwhich controls them.
- Fixed a bug with the alpha value of colored lenses being too large (
TextColorLens,SpriteColorLens,ColorMaterialColorLens).
- Add user callbacks on tween started (
Tween::set_started) and ended (Tween::set_ended). - Implement
DefaultforAnimatorStateasAnimatorState::Playing. - Added
Animator::with_state()andAssetAnimator::with_state(), builder-like functions to override the defaultAnimatorState. - Added
Tween::is_looping()returning true for all butTweeningType::Once. - Added the
Tweenable<T>trait, implemented by theTween<T>andDelay<T>animation, and by theTracks<T>andSequence<T>animation collections. - Added
IntoBoxDynTweenable<T>, a trait to convert aTweenable<T>trait object into a boxed variant. - Publicly exposed
Sequence<T>, a sequence ofTweenable<T>running one after the other. - Publicly exposed
Tracks<T>, a collection ofTweenable<T>running in parallel. - Publicly exposed
TweenState, the playback state of a singleTweenable<T>item. - Added
Tween<T>::then()andSequence<T>::then()to append aTweenable<T>to a sequence (creating a new sequence in the case ofTween<T>::then()). - Added
tweenable()andtweenable_mut()on theAnimator<T>andAssetAnimator<T>to access their top-levelTweenable<T>. - Implemented
DefaultforAnimator<T>andAssetAnimator<T>, creating an animator without any tweenable item (no-op). - Added
Delaytweenable for a time delay between other tweens. - Added a new
menuexample demonstrating in particular theDelaytweenable.
- Moved tween duration out of the
TweeningTypeenum, 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
sequenceexample to add some text showing the current sequence progress. - Modified the signature of
new()forAnimator<T>andAssetAnimator<T>to take a singleTweenable<T>instead of trying to build aTween<T>internally. This allows passing anyTweenable<T>as the top-level animatable item of an animator, and avoids the overhead of maintaining aTracks<T>internally in each animator when the most common use case is likely to use a singleTween<T>or aSequence<T>without parallelism.
- Removed the "pause" feature in-between loops of
TweeningType::LoopandTweeningType::PingPong, which can be replaced if needed by a sequence including aDelaytweenable. RemovedTween::is_paused(). - Removed
new_single()andnew_seq()on theAnimator<T>andAssetAnimator<T>. Users should explicitly create aTween<T>orSequence<T>instead, and usenew().
- Fix missing public export of
component_animator_system()andasset_animator_system()preventing the animation of all but the built-in items.
- 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.
- Perform spherical linear interpolation (slerp) for
Quatrotation ofTransformanimation viaTransformRotationLens, instead of mere linear interpolation leaving the quaternion non-normalized.
- Update to Bevy 0.6
- Update to rust edition 2021
- Force Cargo resolver v2
- Added built-in lens
SpriteColorLens, since the color of aSpriteis now an intrinsic property of the component in Bevy 0.6, and does not useColorMaterialanymore.
Initial version for Bevy 0.5