Skip to content

Commit 531c116

Browse files
djeedaiazarmadr
authored andcommitted
Revert "Support running an animation N times (djeedai#19)"
This reverts commit 6a87157.
1 parent 657e4a7 commit 531c116

File tree

11 files changed

+252
-292
lines changed

11 files changed

+252
-292
lines changed

CHANGELOG.md

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
### Added
99

10-
- Added `is_forward()` and `is_backward()` convenience helpers to `TweeningDirection`.
11-
- 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.
12-
- Added support for dynamically changing an animation's speed with `Animator::set_speed`.
13-
- Added `AnimationSystem` label to tweening tick systems.
14-
- Added `BoxedTweenable` type to make working with `Box<dyn Tweenable + ...>` easier.
15-
- Added `RepeatCount` and `RepeatStrategy` for more granular control over animation looping.
16-
- Added `with_repeat_count()` and `with_repeat_strategy()` builder methods to `Tween<T>`.
10+
- Add `is_forward()` and `is_backward()` convenience helpers to `TweeningDirection`.
11+
- Add `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.
12+
- Support dynamically changing an animation's speed with `Animator::set_speed`
13+
- Add `AnimationSystem` label to tweening tick systems
14+
- A `BoxedTweenable` type to make working with `Box<dyn Tweenable + ...>` easier
1715

1816
### Changed
1917

20-
- Double boxing in `Sequence` and `Tracks` was fixed. As a result, any custom tweenables.
18+
- Double boxing in `Sequence` and `Tracks` was fixed. As a result, any custom tweenables
2119
should implement `From` for `BoxedTweenable` to make those APIs easier to use.
22-
- Removed the `tweening_type` parameter from the signature of `Tween<T>::new()`; use `with_repeat_count()` and `with_repeat_strategy()` instead.
23-
24-
### Removed
25-
26-
- Removed `Tweenable::is_looping()`, which was not implemented for most tweenables.
27-
- Removed `TweeningType` in favor of `RepeatCount` and `RepeatStrategy`.
2820

2921
## [0.4.0] - 2022-04-16
3022

examples/colormaterial_color.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,13 @@ fn setup(
7777

7878
let tween = Tween::new(
7979
*ease_function,
80+
TweeningType::PingPong,
8081
Duration::from_secs(1),
8182
ColorMaterialColorLens {
8283
start: Color::RED,
8384
end: Color::BLUE,
8485
},
85-
)
86-
.with_repeat_count(RepeatCount::Infinite)
87-
.with_repeat_strategy(RepeatStrategy::MirroredRepeat);
86+
);
8887

8988
commands
9089
.spawn_bundle(MaterialMesh2dBundle {

examples/menu.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
5050
start_time_ms += 500;
5151
let tween_scale = Tween::new(
5252
EaseFunction::BounceOut,
53+
TweeningType::Once,
5354
Duration::from_secs(2),
5455
TransformScaleLens {
5556
start: Vec3::splat(0.01),

examples/sequence.rs

Lines changed: 16 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
use std::time::Duration;
2-
31
use bevy::prelude::*;
4-
52
use bevy_tweening::{lens::*, *};
3+
use std::time::Duration;
64

75
fn main() {
86
App::default()
@@ -109,31 +107,19 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
109107
Vec3::new(margin, screen_y - margin, 0.),
110108
Vec3::new(margin, margin, 0.),
111109
];
112-
// Build a sequence from an iterator over a Tweenable (here, a
113-
// Tracks<Transform>)
110+
// Build a sequence from an iterator over a Tweenable (here, a Tween<Transform>)
114111
let seq = Sequence::new(dests.windows(2).enumerate().map(|(index, pair)| {
115-
Tracks::new([
116-
Tween::new(
117-
EaseFunction::QuadraticInOut,
118-
Duration::from_millis(250),
119-
TransformRotateZLens {
120-
start: 0.,
121-
end: 180_f32.to_radians(),
122-
},
123-
)
124-
.with_repeat_count(RepeatCount::Finite(4))
125-
.with_repeat_strategy(RepeatStrategy::MirroredRepeat),
126-
Tween::new(
127-
EaseFunction::QuadraticInOut,
128-
Duration::from_secs(1),
129-
TransformPositionLens {
130-
start: pair[0] - center,
131-
end: pair[1] - center,
132-
},
133-
)
134-
// Get an event after each segment
135-
.with_completed_event(index as u64),
136-
])
112+
Tween::new(
113+
EaseFunction::QuadraticInOut,
114+
TweeningType::Once,
115+
Duration::from_secs(1),
116+
TransformPositionLens {
117+
start: pair[0] - center,
118+
end: pair[1] - center,
119+
},
120+
)
121+
// Get an event after each segment
122+
.with_completed_event(index as u64)
137123
}));
138124

139125
commands
@@ -152,6 +138,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
152138
// scaling size at the same time.
153139
let tween_move = Tween::new(
154140
EaseFunction::QuadraticInOut,
141+
TweeningType::Once,
155142
Duration::from_secs(1),
156143
TransformPositionLens {
157144
start: Vec3::new(-200., 100., 0.),
@@ -161,6 +148,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
161148
.with_completed_event(99); // Get an event once move completed
162149
let tween_rotate = Tween::new(
163150
EaseFunction::QuadraticInOut,
151+
TweeningType::Once,
164152
Duration::from_secs(1),
165153
TransformRotationLens {
166154
start: Quat::IDENTITY,
@@ -169,6 +157,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
169157
);
170158
let tween_scale = Tween::new(
171159
EaseFunction::QuadraticInOut,
160+
TweeningType::Once,
172161
Duration::from_secs(1),
173162
TransformScaleLens {
174163
start: Vec3::ONE,

examples/sprite_color.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,13 @@ fn setup(mut commands: Commands) {
6161
] {
6262
let tween = Tween::new(
6363
*ease_function,
64+
TweeningType::PingPong,
6465
std::time::Duration::from_secs(1),
6566
SpriteColorLens {
6667
start: Color::RED,
6768
end: Color::BLUE,
6869
},
69-
)
70-
.with_repeat_count(RepeatCount::Infinite)
71-
.with_repeat_strategy(RepeatStrategy::MirroredRepeat);
70+
);
7271

7372
commands
7473
.spawn_bundle(SpriteBundle {

examples/text_color.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,14 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
6868
] {
6969
let tween = Tween::new(
7070
*ease_function,
71+
TweeningType::PingPong,
7172
std::time::Duration::from_secs(1),
7273
TextColorLens {
7374
start: Color::RED,
7475
end: Color::BLUE,
7576
section: 0,
7677
},
77-
)
78-
.with_repeat_count(RepeatCount::Infinite)
79-
.with_repeat_strategy(RepeatStrategy::MirroredRepeat);
78+
);
8079

8180
commands
8281
.spawn_bundle(TextBundle {

examples/transform_rotation.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,13 @@ fn setup(mut commands: Commands) {
7777
] {
7878
let tween = Tween::new(
7979
*ease_function,
80+
TweeningType::PingPong,
8081
std::time::Duration::from_secs(1),
8182
TransformRotationLens {
8283
start: Quat::IDENTITY,
8384
end: Quat::from_axis_angle(Vec3::Z, std::f32::consts::PI / 2.),
8485
},
85-
)
86-
.with_repeat_count(RepeatCount::Infinite)
87-
.with_repeat_strategy(RepeatStrategy::MirroredRepeat);
86+
);
8887

8988
commands
9089
.spawn_bundle((

examples/transform_translation.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,13 @@ fn setup(mut commands: Commands) {
7676
] {
7777
let tween = Tween::new(
7878
*ease_function,
79+
TweeningType::PingPong,
7980
std::time::Duration::from_secs(1),
8081
TransformPositionLens {
8182
start: Vec3::new(x, screen_y, 0.),
8283
end: Vec3::new(x, -screen_y, 0.),
8384
},
84-
)
85-
.with_repeat_count(RepeatCount::Infinite)
86-
.with_repeat_strategy(RepeatStrategy::MirroredRepeat);
85+
);
8786

8887
commands
8988
.spawn_bundle(SpriteBundle {

examples/ui_position.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ fn setup(mut commands: Commands) {
7676
] {
7777
let tween = Tween::new(
7878
*ease_function,
79+
TweeningType::PingPong,
7980
std::time::Duration::from_secs(1),
8081
UiPositionLens {
8182
start: Rect {
@@ -91,9 +92,7 @@ fn setup(mut commands: Commands) {
9192
bottom: Val::Auto,
9293
},
9394
},
94-
)
95-
.with_repeat_count(RepeatCount::Infinite)
96-
.with_repeat_strategy(RepeatStrategy::MirroredRepeat);
95+
);
9796

9897
commands
9998
.spawn_bundle(NodeBundle {

0 commit comments

Comments
 (0)