Skip to content

Commit 814c764

Browse files
committed
Fix bug in Sequence::duration()
Fix bug introduced in previous change, while CI was broken.
1 parent 7f20f34 commit 814c764

File tree

6 files changed

+52
-38
lines changed

6 files changed

+52
-38
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,16 @@
33
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
44
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
55

6+
## [Unreleased]
7+
8+
### Changed
9+
10+
- Compatible with Bevy 0.16
11+
12+
### Fixed
13+
14+
- Fixed `Sequence::duration()` returning the wrong result when any child is repeating. (#143)
15+
616
## [0.12.0] - 2024-12-07
717

818
### Changed

Cargo.toml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "bevy_tweening"
3-
version = "0.12.0"
3+
version = "0.13.0"
44
authors = [
55
"François Mockers <[email protected]>",
66
"Jerome Humbert <[email protected]>",
@@ -27,13 +27,12 @@ bevy_ui = ["bevy/bevy_ui", "bevy/bevy_render"]
2727
bevy_text = ["bevy/bevy_text", "bevy/bevy_render", "bevy/bevy_sprite"]
2828

2929
[dependencies]
30-
bevy = { version = "0.16", default-features = false, features = [ "bevy_color",]}
31-
30+
# Note: abuse 'bevy_color' to force 'bevy_math/curve' feature, which defines EaseFunction
31+
bevy = { version = "0.16", default-features = false, features = [ "bevy_color" ]}
3232

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

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

LICENSE

Lines changed: 0 additions & 6 deletions
This file was deleted.

README.md

Lines changed: 35 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
[![Crate](https://img.shields.io/crates/v/bevy_tweening.svg)](https://crates.io/crates/bevy_tweening)
66
[![Build Status](https://github.com/djeedai/bevy_tweening/actions/workflows/ci.yaml/badge.svg)](https://github.com/djeedai/bevy_tweening/actions/workflows/ci.yaml)
77
[![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)
8-
[![Bevy tracking](https://img.shields.io/badge/Bevy%20tracking-v0.15-lightblue)](https://github.com/bevyengine/bevy/blob/main/docs/plugins_guidelines.md#main-branch-tracking)
8+
[![Bevy tracking](https://img.shields.io/badge/Bevy%20tracking-v0.16-lightblue)](https://github.com/bevyengine/bevy/blob/main/docs/plugins_guidelines.md#main-branch-tracking)
99

1010
Tweening animation plugin for the Bevy game engine.
1111

@@ -141,19 +141,19 @@ The naming scheme for predefined lenses is `"<TargetName><FieldName>Lens"`, wher
141141

142142
| Target Component | Animated Field | Lens | Feature |
143143
|---|---|---|---|
144-
| [`Transform`](https://docs.rs/bevy/0.15.0/bevy/transform/components/struct.Transform.html) | [`translation`](https://docs.rs/bevy/0.15.0/bevy/transform/components/struct.Transform.html#structfield.translation) | [`TransformPositionLens`](https://docs.rs/bevy_tweening/5fca4fa0139121adef3cbf8187b31c63fd6273c7/bevy_tweening/lens/struct.TransformPositionLens.html) | |
145-
| | [`rotation`](https://docs.rs/bevy/0.15.0/bevy/transform/components/struct.Transform.html#structfield.rotation) (`Quat`| [`TransformRotationLens`](https://docs.rs/bevy_tweening/5fca4fa0139121adef3cbf8187b31c63fd6273c7/bevy_tweening/lens/struct.TransformRotationLens.html) | |
146-
| | [`rotation`](https://docs.rs/bevy/0.15.0/bevy/transform/components/struct.Transform.html#structfield.rotation) (angle)² | [`TransformRotateXLens`](https://docs.rs/bevy_tweening/5fca4fa0139121adef3cbf8187b31c63fd6273c7/bevy_tweening/lens/struct.TransformRotateXLens.html) | |
147-
| | [`rotation`](https://docs.rs/bevy/0.15.0/bevy/transform/components/struct.Transform.html#structfield.rotation) (angle)² | [`TransformRotateYLens`](https://docs.rs/bevy_tweening/5fca4fa0139121adef3cbf8187b31c63fd6273c7/bevy_tweening/lens/struct.TransformRotateYLens.html) | |
148-
| | [`rotation`](https://docs.rs/bevy/0.15.0/bevy/transform/components/struct.Transform.html#structfield.rotation) (angle)² | [`TransformRotateZLens`](https://docs.rs/bevy_tweening/5fca4fa0139121adef3cbf8187b31c63fd6273c7/bevy_tweening/lens/struct.TransformRotateZLens.html) | |
149-
| | [`rotation`](https://docs.rs/bevy/0.15.0/bevy/transform/components/struct.Transform.html#structfield.rotation) (angle)² | [`TransformRotateAxisLens`](https://docs.rs/bevy_tweening/5fca4fa0139121adef3cbf8187b31c63fd6273c7/bevy_tweening/lens/struct.TransformRotateAxisLens.html) | |
150-
| | [`scale`](https://docs.rs/bevy/0.15.0/bevy/transform/components/struct.Transform.html#structfield.scale) | [`TransformScaleLens`](https://docs.rs/bevy_tweening/5fca4fa0139121adef3cbf8187b31c63fd6273c7/bevy_tweening/lens/struct.TransformScaleLens.html) | |
151-
| [`Sprite`](https://docs.rs/bevy/0.15.0/bevy/sprite/struct.Sprite.html) | [`color`](https://docs.rs/bevy/0.15.0/bevy/sprite/struct.Sprite.html#structfield.color) | [`SpriteColorLens`](https://docs.rs/bevy_tweening/5fca4fa0139121adef3cbf8187b31c63fd6273c7/bevy_tweening/lens/struct.SpriteColorLens.html) | `bevy_sprite` |
152-
| [`Node`](https://docs.rs/bevy/0.15.0/bevy/ui/struct.Node.html) | [`position`](https://docs.rs/bevy/0.15.0/bevy/ui/struct.Node.html) | [`UiPositionLens`](https://docs.rs/bevy_tweening/5fca4fa0139121adef3cbf8187b31c63fd6273c7/bevy_tweening/lens/struct.UiPositionLens.html) | `bevy_ui` |
153-
| [`BackgroundColor`](https://docs.rs/bevy/0.15.0/bevy/ui/struct.BackgroundColor.html) | | [`UiBackgroundColorLens`](https://docs.rs/bevy_tweening/5fca4fa0139121adef3cbf8187b31c63fd6273c7/bevy_tweening/lens/struct.UiBackgroundColorLens.html) | `bevy_ui` |
154-
| [`TextColor`](https://docs.rs/bevy/0.15.0/bevy/text/struct.TextColor.html) | | [`TextColorLens`](https://docs.rs/bevy_tweening/5fca4fa0139121adef3cbf8187b31c63fd6273c7/bevy_tweening/lens/struct.TextColorLens.html) | `bevy_text` |
155-
156-
There are two ways to interpolate rotations. See the [comparison of rotation lenses](https://docs.rs/bevy_tweening/5fca4fa0139121adef3cbf8187b31c63fd6273c7/bevy_tweening/lens/index.html#rotations) for details:
144+
| [`Transform`](https://docs.rs/bevy/0.16/bevy/transform/components/struct.Transform.html) | [`translation`](https://docs.rs/bevy/0.16/bevy/transform/components/struct.Transform.html#structfield.translation) | [`TransformPositionLens`](https://docs.rs/bevy_tweening/8b3cad18a090078d9055d77a632be44e701aecc7/bevy_tweening/lens/struct.TransformPositionLens.html) | |
145+
| | [`rotation`](https://docs.rs/bevy/0.16/bevy/transform/components/struct.Transform.html#structfield.rotation) (`Quat`| [`TransformRotationLens`](https://docs.rs/bevy_tweening/8b3cad18a090078d9055d77a632be44e701aecc7/bevy_tweening/lens/struct.TransformRotationLens.html) | |
146+
| | [`rotation`](https://docs.rs/bevy/0.16/bevy/transform/components/struct.Transform.html#structfield.rotation) (angle)² | [`TransformRotateXLens`](https://docs.rs/bevy_tweening/8b3cad18a090078d9055d77a632be44e701aecc7/bevy_tweening/lens/struct.TransformRotateXLens.html) | |
147+
| | [`rotation`](https://docs.rs/bevy/0.16/bevy/transform/components/struct.Transform.html#structfield.rotation) (angle)² | [`TransformRotateYLens`](https://docs.rs/bevy_tweening/8b3cad18a090078d9055d77a632be44e701aecc7/bevy_tweening/lens/struct.TransformRotateYLens.html) | |
148+
| | [`rotation`](https://docs.rs/bevy/0.16/bevy/transform/components/struct.Transform.html#structfield.rotation) (angle)² | [`TransformRotateZLens`](https://docs.rs/bevy_tweening/8b3cad18a090078d9055d77a632be44e701aecc7/bevy_tweening/lens/struct.TransformRotateZLens.html) | |
149+
| | [`rotation`](https://docs.rs/bevy/0.16/bevy/transform/components/struct.Transform.html#structfield.rotation) (angle)² | [`TransformRotateAxisLens`](https://docs.rs/bevy_tweening/8b3cad18a090078d9055d77a632be44e701aecc7/bevy_tweening/lens/struct.TransformRotateAxisLens.html) | |
150+
| | [`scale`](https://docs.rs/bevy/0.16/bevy/transform/components/struct.Transform.html#structfield.scale) | [`TransformScaleLens`](https://docs.rs/bevy_tweening/8b3cad18a090078d9055d77a632be44e701aecc7/bevy_tweening/lens/struct.TransformScaleLens.html) | |
151+
| [`Sprite`](https://docs.rs/bevy/0.16/bevy/sprite/struct.Sprite.html) | [`color`](https://docs.rs/bevy/0.16/bevy/sprite/struct.Sprite.html#structfield.color) | [`SpriteColorLens`](https://docs.rs/bevy_tweening/8b3cad18a090078d9055d77a632be44e701aecc7/bevy_tweening/lens/struct.SpriteColorLens.html) | `bevy_sprite` |
152+
| [`Node`](https://docs.rs/bevy/0.16/bevy/ui/struct.Node.html) | [`position`](https://docs.rs/bevy/0.16/bevy/ui/struct.Node.html) | [`UiPositionLens`](https://docs.rs/bevy_tweening/8b3cad18a090078d9055d77a632be44e701aecc7/bevy_tweening/lens/struct.UiPositionLens.html) | `bevy_ui` |
153+
| [`BackgroundColor`](https://docs.rs/bevy/0.16/bevy/ui/struct.BackgroundColor.html) | | [`UiBackgroundColorLens`](https://docs.rs/bevy_tweening/8b3cad18a090078d9055d77a632be44e701aecc7/bevy_tweening/lens/struct.UiBackgroundColorLens.html) | `bevy_ui` |
154+
| [`TextColor`](https://docs.rs/bevy/0.16/bevy/text/struct.TextColor.html) | | [`TextColorLens`](https://docs.rs/bevy_tweening/8b3cad18a090078d9055d77a632be44e701aecc7/bevy_tweening/lens/struct.TextColorLens.html) | `bevy_text` |
155+
156+
There are two ways to interpolate rotations. See the [comparison of rotation lenses](https://docs.rs/bevy_tweening/8b3cad18a090078d9055d77a632be44e701aecc7/bevy_tweening/lens/index.html#rotations) for details:
157157

158158
- ¹ Shortest-path interpolation between two rotations, using `Quat::slerp()`.
159159
- ² Angle-based interpolation, valid for rotations over ½ turn.
@@ -164,7 +164,7 @@ Asset animation always requires the `bevy_asset` feature.
164164

165165
| Target Asset | Animated Field | Lens | Feature |
166166
|---|---|---|---|
167-
| [`ColorMaterial`](https://docs.rs/bevy/0.15.0/bevy/sprite/struct.ColorMaterial.html) | [`color`](https://docs.rs/bevy/0.15.0/bevy/sprite/struct.ColorMaterial.html#structfield.color) | [`ColorMaterialColorLens`](https://docs.rs/bevy_tweening/5fca4fa0139121adef3cbf8187b31c63fd6273c7/bevy_tweening/lens/struct.ColorMaterialColorLens.html) | `bevy_asset` + `bevy_sprite` |
167+
| [`ColorMaterial`](https://docs.rs/bevy/0.16/bevy/sprite/struct.ColorMaterial.html) | [`color`](https://docs.rs/bevy/0.16/bevy/sprite/struct.ColorMaterial.html#structfield.color) | [`ColorMaterialColorLens`](https://docs.rs/bevy_tweening/8b3cad18a090078d9055d77a632be44e701aecc7/bevy_tweening/lens/struct.ColorMaterialColorLens.html) | `bevy_asset` + `bevy_sprite` |
168168

169169
## Custom lens
170170

@@ -222,67 +222,67 @@ The process is similar to custom components, creating a custom lens for the cust
222222

223223
## Examples
224224

225-
See the [`examples/`](https://github.com/djeedai/bevy_tweening/tree/5fca4fa0139121adef3cbf8187b31c63fd6273c7/examples) folder.
225+
See the [`examples/`](https://github.com/djeedai/bevy_tweening/tree/8b3cad18a090078d9055d77a632be44e701aecc7/examples) folder.
226226

227227
### [`menu`](examples/menu.rs)
228228

229229
```rust
230230
cargo run --example menu --features="bevy/bevy_winit"
231231
```
232232

233-
![menu](https://raw.githubusercontent.com/djeedai/bevy_tweening/5fca4fa0139121adef3cbf8187b31c63fd6273c7/examples/menu.gif)
233+
![menu](https://raw.githubusercontent.com/djeedai/bevy_tweening/8b3cad18a090078d9055d77a632be44e701aecc7/examples/menu.gif)
234234

235235
### [`sprite_color`](examples/sprite_color.rs)
236236

237237
```rust
238238
cargo run --example sprite_color --features="bevy/bevy_winit"
239239
```
240240

241-
![sprite_color](https://raw.githubusercontent.com/djeedai/bevy_tweening/5fca4fa0139121adef3cbf8187b31c63fd6273c7/examples/sprite_color.gif)
241+
![sprite_color](https://raw.githubusercontent.com/djeedai/bevy_tweening/8b3cad18a090078d9055d77a632be44e701aecc7/examples/sprite_color.gif)
242242

243243
### [`transform_rotation`](examples/transform_rotation.rs)
244244

245245
```rust
246246
cargo run --example transform_rotation --features="bevy/bevy_winit"
247247
```
248248

249-
![sprite_color](https://raw.githubusercontent.com/djeedai/bevy_tweening/5fca4fa0139121adef3cbf8187b31c63fd6273c7/examples/transform_rotation.gif)
249+
![sprite_color](https://raw.githubusercontent.com/djeedai/bevy_tweening/8b3cad18a090078d9055d77a632be44e701aecc7/examples/transform_rotation.gif)
250250

251251
### [`transform_translation`](examples/transform_translation.rs)
252252

253253
```rust
254254
cargo run --example transform_translation --features="bevy/bevy_winit"
255255
```
256256

257-
![sprite_color](https://raw.githubusercontent.com/djeedai/bevy_tweening/5fca4fa0139121adef3cbf8187b31c63fd6273c7/examples/transform_translation.gif)
257+
![sprite_color](https://raw.githubusercontent.com/djeedai/bevy_tweening/8b3cad18a090078d9055d77a632be44e701aecc7/examples/transform_translation.gif)
258258

259259
### [`colormaterial_color`](examples/colormaterial_color.rs)
260260

261261
```rust
262262
cargo run --example colormaterial_color --features="bevy/bevy_winit"
263263
```
264264

265-
![colormaterial_color](https://raw.githubusercontent.com/djeedai/bevy_tweening/5fca4fa0139121adef3cbf8187b31c63fd6273c7/examples/colormaterial_color.gif)
265+
![colormaterial_color](https://raw.githubusercontent.com/djeedai/bevy_tweening/8b3cad18a090078d9055d77a632be44e701aecc7/examples/colormaterial_color.gif)
266266

267267
### [`ui_position`](examples/ui_position.rs)
268268

269269
```rust
270270
cargo run --example ui_position --features="bevy/bevy_winit"
271271
```
272272

273-
![ui_position](https://raw.githubusercontent.com/djeedai/bevy_tweening/5fca4fa0139121adef3cbf8187b31c63fd6273c7/examples/ui_position.gif)
273+
![ui_position](https://raw.githubusercontent.com/djeedai/bevy_tweening/8b3cad18a090078d9055d77a632be44e701aecc7/examples/ui_position.gif)
274274

275275
### [`sequence`](examples/sequence.rs)
276276

277277
```rust
278278
cargo run --example sequence --features="bevy/bevy_winit"
279279
```
280280

281-
![sequence](https://raw.githubusercontent.com/djeedai/bevy_tweening/5fca4fa0139121adef3cbf8187b31c63fd6273c7/examples/sequence.gif)
281+
![sequence](https://raw.githubusercontent.com/djeedai/bevy_tweening/8b3cad18a090078d9055d77a632be44e701aecc7/examples/sequence.gif)
282282

283283
## Ease Functions
284284

285-
Many [ease functions](https://docs.rs/bevy/0.15.0/bevy/math/curve/enum.EaseFunction.html) are available from `bevy_math`:
285+
Many [ease functions](https://docs.rs/bevy/0.16/bevy/math/curve/enum.EaseFunction.html) are available from `bevy_math`:
286286

287287
- Linear
288288
> `f(t) = t`
@@ -373,6 +373,17 @@ Compatibility of `bevy_tweening` versions:
373373

374374
Due to the fast-moving nature of Bevy and frequent breaking changes, and the limited resources to maintan 🍃 Bevy Tweening, the `main` (unreleased) Bevy branch is not supported. However the `bevy_tweening` crate is upgraded shortly after each new `bevy` release to support the newly released version.
375375

376+
## License
377+
378+
🍃 Bevy Tweening is dual-licensed under either:
379+
380+
- MIT License ([`LICENSE-MIT`](./LICENSE-MIT) or <http://opensource.org/licenses/MIT>)
381+
- Apache License, Version 2.0 ([`LICENSE-APACHE2`](./LICENSE-APACHE2) or <http://www.apache.org/licenses/LICENSE-2.0>)
382+
383+
at your option.
384+
385+
`SPDX-License-Identifier: MIT OR Apache-2.0`
386+
376387
## Comparison with `bevy_easings`
377388

378389
The `bevy_tweening` library started as a fork of [the `bevy_easings` library by François Mocker](https://github.com/vleue/bevy_easings), with the goals to:

benchmarks/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "bevy_tweening_bench"
3-
version = "0.12.0"
3+
version = "0.13.0"
44
authors = ["Jerome Humbert <[email protected]>"]
55
edition = "2021"
66
description = "Tweening plugin for Bevy -- Benchmarks"
@@ -18,7 +18,7 @@ criterion = { version = "0.5", features = ["html_reports"] }
1818
bevy_tweening = { path = "../" }
1919

2020
[dependencies.bevy]
21-
version = "0.16.0-rc"
21+
version = "0.16"
2222
default-features = false
2323
features = ["bevy_render", "bevy_sprite", "bevy_text", "bevy_ui"]
2424

src/tweenable.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -961,12 +961,12 @@ impl<T> Tweenable<T> for Sequence<T> {
961961
while self.index < self.tweens.len() {
962962
let tween = &mut self.tweens[self.index];
963963

964+
let tween_remaining = tween.duration().saturating_sub(tween.elapsed());
965+
964966
if let TweenState::Active = tween.tick(delta, target, entity, events, commands) {
965967
return TweenState::Active;
966968
}
967969

968-
let tween_remaining = tween.duration().saturating_sub(tween.elapsed());
969-
970970
tween.rewind();
971971
delta -= tween_remaining;
972972
self.index += 1;

0 commit comments

Comments
 (0)