Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
826532a
v2
djeedai Apr 29, 2024
9439e56
Move action into `Tween` itself
djeedai May 1, 2024
c3ced14
Re-rename (-Untyped)Tweenable trait
djeedai May 1, 2024
946b17e
Add TweenAnim container
djeedai May 4, 2024
7e556e7
Add AnimCompleted event, fix tests
djeedai May 5, 2024
f7a9fe2
Fix more tests and docs
djeedai May 5, 2024
3315d8b
Start attempting to re-add Asset support...
djeedai Jun 25, 2025
eac902e
Merge remote-tracking branch 'origin/main' into u/v2
djeedai Jun 25, 2025
ec4a275
Build fixes
djeedai Jun 26, 2025
263c981
Rework animation clock
djeedai Jun 28, 2025
176065a
Stateless mirroring split from tween state
djeedai Jun 28, 2025
dc46592
Fix backward tests
djeedai Jun 29, 2025
b3b7e8d
Fix infinite repeat test
djeedai Jun 29, 2025
53f6018
Fix last test cases
djeedai Jun 29, 2025
f5c0bce
Fix sequence example
djeedai Jun 29, 2025
6754fd2
Fix all non-asset examples
djeedai Jun 29, 2025
df01c5a
Fix example build script
djeedai Jun 29, 2025
89c1f7e
Finish implementing asset animation
djeedai Jun 29, 2025
c47956b
Remove `Targetable` and other unused bits
djeedai Jul 1, 2025
99ee28a
Fix some docs, add first draft of migration guide
djeedai Jul 2, 2025
5a1ef81
Fix animation target in completion events
djeedai Jul 5, 2025
355c96e
Fix all tests
djeedai Jul 5, 2025
5a6d3b6
Fix all docs
djeedai Jul 6, 2025
8d4d5b7
Fix doctest
djeedai Jul 6, 2025
32cabe1
Remove `bevy_asset` feature
djeedai Jul 6, 2025
e30d05b
Clean-up extension traits, add more helpers
djeedai Jul 6, 2025
57256ea
Create targets via `Components` only
djeedai Jul 6, 2025
814b951
Fix asset resolver
djeedai Jul 12, 2025
535f425
Minor doc fix
djeedai Jul 12, 2025
f1b6086
Remove dangerous `TweenAnimator::add()`
djeedai Jul 12, 2025
7976b5e
Enable retaining completed animations
djeedai Jul 13, 2025
56ef60a
Add retargeting and tweenable swapping
djeedai Jul 13, 2025
7ac47ad
README fixes
djeedai Jul 13, 2025
f4f9f8b
Fix event sending
djeedai Jul 16, 2025
370af8d
Fix one-shot systems
djeedai Jul 16, 2025
ac22e14
Fix examples
djeedai Jul 16, 2025
fbb1dc2
Unified `Tween::new()`
djeedai Jul 16, 2025
6f064b7
Improve tween documentation
djeedai Jul 16, 2025
d13ab25
Clamp negative anim speed
djeedai Jul 16, 2025
369c67d
Intern resource scoping in step_xxx()
djeedai Jul 16, 2025
2e7a438
Add some more `#[must_use]`
djeedai Jul 17, 2025
eaede15
Misc. doc improvements and minor clean-ups
djeedai Jul 17, 2025
da15292
Top-level doc polish
djeedai Jul 17, 2025
6175ae7
Try to make TweenAnim a component
djeedai Jul 17, 2025
113794e
Remove one-shot suppoer in favor of observers
djeedai Jul 19, 2025
8ebb665
Fix doctest
djeedai Jul 19, 2025
9cbb28b
Add `tween_target()`
djeedai Jul 20, 2025
6b60b62
Add `tween_asset()` and fix examples
djeedai Jul 20, 2025
dc86388
Fix observer triggering on TweenAnim entity
djeedai Jul 20, 2025
61ff5ef
Rename `tween_target()` to `tween_component()` for consistency
djeedai Jul 24, 2025
ff6bb7d
Fix a few doc tests
djeedai Jul 24, 2025
c05f8d6
Add step functions to `TweenAnim`.
djeedai Jul 24, 2025
e08643a
Fix docs
djeedai Jul 24, 2025
f037b9e
Resource support and animated commands
djeedai Aug 1, 2025
632381c
Make `AnimatedEntityCommands` owns by value
djeedai Aug 1, 2025
0de4630
Fix example launch command
djeedai Aug 1, 2025
44e2894
Settle on `duration` for `move_to()` etc.
djeedai Aug 1, 2025
eba6aa3
Fix animation event on sequence example
djeedai Aug 1, 2025
3a9706b
`AnimTarget` as component with auto-register
djeedai Aug 7, 2025
b7f009c
Fix asset anim and all examples
djeedai Aug 10, 2025
e8e954c
Fix docs
djeedai Aug 11, 2025
5a5ec38
WIP - trying to handle heterogenous Sequence via retargetting
djeedai Aug 11, 2025
17837a4
Panic on multi-target seq (unsupported)
djeedai Aug 26, 2025
d789641
Fix uniform multi-target sequence
djeedai Aug 30, 2025
b0a196b
Minor clean-ups
djeedai Aug 30, 2025
c5ccb8f
Linter and doc fixes
djeedai Aug 30, 2025
070741d
Fix auto-registration in `step_many()`
djeedai Sep 3, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,6 @@ jobs:
env:
CARGO_INCREMENTAL: 1
RUSTFLAGS: "-C debuginfo=0 -D warnings"
- name: Build & run tests (asset)
run: cargo test --no-default-features --features="bevy_asset"
env:
CARGO_INCREMENTAL: 1
RUSTFLAGS: "-C debuginfo=0 -D warnings"
- name: Build & run tests (all)
run: cargo test --all-features
env:
Expand Down
106 changes: 106 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,112 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

_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](./docs/migration-guide-0.14.md) 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:

```rust
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>`.

```rust
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 `Duration`s.
- 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
Expand Down
19 changes: 13 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bevy_tweening"
version = "0.13.0"
version = "0.14.0-dev"
authors = [
"François Mockers <mockersf@gmail.com>",
"Jerome Humbert <djeedai@gmail.com>",
Expand All @@ -16,9 +16,7 @@ readme = "README.md"
exclude = ["examples/*.gif", ".github", "release.md", "run_examples.bat"]

[features]
default = ["bevy_sprite", "bevy_ui", "bevy_asset", "bevy_text"]
# Enable support for Asset animation
bevy_asset = ["bevy/bevy_asset"]
default = ["bevy_sprite", "bevy_ui", "bevy_text"]
# Enable built-in lenses for Bevy sprites
bevy_sprite = ["bevy/bevy_sprite", "bevy/bevy_render"]
# Enable built-in lenses for Bevy UI
Expand All @@ -28,18 +26,27 @@ bevy_text = ["bevy/bevy_text", "bevy/bevy_render", "bevy/bevy_sprite"]

[dependencies]
# Note: abuse 'bevy_color' to force 'bevy_math/curve' feature, which defines EaseFunction
bevy = { version = "0.16", default-features = false, features = [ "bevy_color" ]}
bevy = { version = "0.16", default-features = false, features = [ "bevy_color", "bevy_asset", "bevy_log" ]}
thiserror = "2"

[dev-dependencies]
bevy-inspector-egui = { version = "0.31" }

[[example]]
name = "ambient_light"
required-features = ["bevy_ui", "bevy_text", "bevy/bevy_winit", "bevy/bevy_picking", "bevy/bevy_pbr", "bevy/hdr", "bevy/tonemapping_luts"]

[[example]]
name = "follow"
required-features = ["bevy_sprite", "bevy_text", "bevy/bevy_winit", "bevy/bevy_picking"]

[[example]]
name = "menu"
required-features = ["bevy_ui", "bevy_text", "bevy/bevy_winit", "bevy/bevy_picking"]

[[example]]
name = "colormaterial_color"
required-features = ["bevy_asset", "bevy_sprite", "bevy/bevy_winit", "bevy/bevy_picking"]
required-features = ["bevy_sprite", "bevy/bevy_winit", "bevy/bevy_picking"]

[[example]]
name = "sprite_color"
Expand Down
Loading
Loading