Skip to content

Commit 2d0a957

Browse files
authored
Merge pull request #65 from Multirious/0.9.1_color_tween_patch
color tween patch and remove additional types in favor of flag
2 parents 55bc22f + cc932d4 commit 2d0a957

File tree

11 files changed

+198
-249
lines changed

11 files changed

+198
-249
lines changed

CHANGELOG.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
# Changelog
22

3-
## v0.8.1 - 2025-07-14
3+
## v0.9.1 - 2025-07-15
4+
5+
- Fix color delta interpolation
6+
7+
### Breaking Change
8+
9+
- Add a delta flag to the built-in tweens
10+
- This comes instead of the additional XDelta type so that one won't have to register so twice the types
11+
12+
## v0.9.0 - 2025-07-14
413

514
### Breaking Changes
615

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "bevy_tween"
33
description = "Flexible tweening plugin library for Bevy"
4-
version = "0.9.0"
4+
version = "0.9.1"
55
edition = "2024"
66
authors = ["Multirious", "Rabbival"]
77
license = "MIT OR Apache-2.0"
@@ -23,7 +23,7 @@ default-features = false
2323
features = ["std"]
2424

2525
[dependencies.bevy_math]
26-
version = "0.16.0"
26+
version = "0.16.1"
2727
default-features = false
2828
features = ["curve"]
2929

examples/demo/delta_tweens.rs

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@ use std::time::Duration;
22
use bevy::{
33
prelude::*,
44
};
5+
use bevy::color::palettes::basic::WHITE;
6+
use bevy::color::palettes::css::{BLUE, RED};
57
use bevy_tween::{
68
combinator::*, prelude::*,
79
tween::AnimationTarget,
810
};
11+
use bevy_tween::interpolate::{sprite_color_delta_to};
912

1013
fn secs(secs: f32) -> Duration {
1114
Duration::from_secs_f32(secs)
@@ -36,13 +39,14 @@ fn spawn_circle_with_tweens(
3639
let float_duration = secs(4.0);
3740
let circle = AnimationTarget.into_target();
3841
let mut circle_transform_state = circle.transform_state(circle_transform);
42+
let mut circle_sprite_state = circle.state(WHITE.into());
3943

4044
let mut circle_commands = commands
4145
.spawn((
42-
Sprite {
43-
image: circle_filled_image,
44-
..default()
45-
},
46+
Sprite {
47+
image: circle_filled_image,
48+
..default()
49+
},
4650
circle_transform,
4751
AnimationTarget,
4852
));
@@ -60,6 +64,16 @@ fn spawn_circle_with_tweens(
6064
float_duration,
6165
EaseKind::SineInOut,
6266
circle_transform_state.translation_delta_by(vertical_delta),
63-
)
67+
),
68+
tween(
69+
float_duration,
70+
EaseKind::Linear,
71+
circle_sprite_state.with(sprite_color_delta_to(BLUE.into())),
72+
),
73+
tween(
74+
float_duration,
75+
EaseKind::CubicIn,
76+
circle_sprite_state.with(sprite_color_delta_to(RED.into())),
77+
)
6478
)));
65-
}
79+
}

examples/demo/follow.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@ fn main() {
2121
.add_plugins((
2222
DefaultPlugins,
2323
DefaultTweenPlugins,
24-
EguiPlugin {
25-
enable_multipass_for_primary_context: false,
26-
},
24+
EguiPlugin::default(),
2725
ResourceInspectorPlugin::<Config>::new(),
2826
))
2927
.add_systems(Startup, setup)

examples/entity_structure.rs

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use bevy::prelude::*;
2-
use bevy_tween::interpolate::{AngleZ, Translation};
2+
use bevy_tween::interpolate::{translation, AngleZ, Translation};
33
use bevy_tween::prelude::*;
44
use bevy_tween::{
55
bevy_time_runner::{TimeRunner, TimeSpan},
@@ -52,16 +52,14 @@ fn setup(mut commands: Commands) {
5252
EaseKind::QuadraticInOut,
5353
ComponentTween::new_target(
5454
TargetComponent::marker(),
55-
Translation {
56-
start: Vec3::new(start_x, y, 0.),
57-
end: Vec3::new(end_x, y, 0.),
58-
},
55+
translation(Vec3::new(start_x, y, 0.), Vec3::new(end_x, y, 0.))
5956
),
6057
ComponentTween::new_target(
6158
TargetComponent::marker(),
6259
AngleZ {
6360
start: angle_start,
6461
end: angle_end,
62+
delta: false
6563
},
6664
),
6765
));
@@ -93,16 +91,14 @@ fn setup(mut commands: Commands) {
9391
EaseKind::QuadraticInOut,
9492
ComponentTween::new_target(
9593
TargetComponent::marker(),
96-
Translation {
97-
start: Vec3::new(start_x, y, 0.),
98-
end: Vec3::new(end_x, y, 0.),
99-
},
94+
translation(Vec3::new(start_x, y, 0.), Vec3::new(end_x, y, 0.))
10095
),
10196
ComponentTween::new_target(
10297
TargetComponent::marker(),
10398
AngleZ {
10499
start: angle_start,
105100
end: angle_end,
101+
delta: false
106102
},
107103
),
108104
));
@@ -132,16 +128,14 @@ fn setup(mut commands: Commands) {
132128
EaseKind::QuadraticInOut,
133129
ComponentTween::new_target(
134130
TargetComponent::marker(),
135-
Translation {
136-
start: Vec3::new(start_x, y, 0.),
137-
end: Vec3::new(end_x, y, 0.),
138-
},
131+
translation(Vec3::new(start_x, y, 0.), Vec3::new(end_x, y, 0.))
139132
),
140133
ComponentTween::new_target(
141134
TargetComponent::marker(),
142135
AngleZ {
143136
start: angle_start,
144137
end: angle_end,
138+
delta: false
145139
},
146140
),
147141
));
@@ -176,13 +170,15 @@ fn setup(mut commands: Commands) {
176170
Translation {
177171
start: Vec3::new(start_x, y, 0.),
178172
end: Vec3::new(end_x, y, 0.),
173+
delta: false
179174
},
180175
),
181176
ComponentTween::new_target(
182177
TargetComponent::marker(),
183178
AngleZ {
184179
start: angle_start,
185180
end: angle_end,
181+
delta: false
186182
},
187183
),
188184
));
@@ -216,16 +212,14 @@ fn setup(mut commands: Commands) {
216212
EaseKind::QuadraticInOut,
217213
ComponentTween::new_target(
218214
sprite,
219-
Translation {
220-
start: Vec3::new(start_x, y, 0.),
221-
end: Vec3::new(end_x, y, 0.),
222-
},
215+
translation(Vec3::new(start_x, y, 0.), Vec3::new(end_x, y, 0.))
223216
),
224217
ComponentTween::new_target(
225218
sprite,
226219
AngleZ {
227220
start: angle_start,
228221
end: angle_end,
222+
delta: false
229223
},
230224
),
231225
));

src/combinator/state.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,17 +172,17 @@ impl TransformTargetState {
172172
}
173173

174174
/// Create delta [`ComponentTween`] of transform's translation tweening by provided input
175-
pub fn translation_delta_by(&mut self, by: Vec3) -> ComponentTween<TranslationDelta> {
175+
pub fn translation_delta_by(&mut self, by: Vec3) -> ComponentTween<Translation> {
176176
self.translation_with(translation_delta_by(by))
177177
}
178178

179179
/// Create delta [`ComponentTween`] of transform's rotation tweening by provided input
180-
pub fn rotation_delta_by(&mut self, by: Quat) -> ComponentTween<RotationDelta> {
180+
pub fn rotation_delta_by(&mut self, by: Quat) -> ComponentTween<Rotation> {
181181
self.rotation_with(rotation_delta_by(by))
182182
}
183183

184184
/// Create delta [`ComponentTween`] of scale's rotation tweening by provided input
185-
pub fn scale_delta_by(&mut self, by: Vec3) -> ComponentTween<ScaleDelta> {
185+
pub fn scale_delta_by(&mut self, by: Vec3) -> ComponentTween<Scale> {
186186
self.scale_with(scale_delta_by(by))
187187
}
188188
}

src/interpolate.rs

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
//! - [`AngleZ`]
1212
//! - [`SpriteColor`]
1313
//! - [`ColorMaterial`]
14-
//! - All their delta variants (such as [`TranslationDelta`])
1514
//!
1615
//! # Your own [`Interpolator`]
1716
//!
@@ -218,47 +217,31 @@ impl Plugin for DefaultInterpolatorsPlugin {
218217
tween::component_tween_system::<Rotation>(),
219218
tween::component_tween_system::<Scale>(),
220219
tween::component_tween_system::<AngleZ>(),
221-
tween::component_tween_system::<TranslationDelta>(),
222-
tween::component_tween_system::<RotationDelta>(),
223-
tween::component_tween_system::<ScaleDelta>(),
224-
tween::component_tween_system::<AngleZDelta>()
225220
))
226221
.register_type::<tween::ComponentTween<Translation>>()
227222
.register_type::<tween::ComponentTween<Rotation>>()
228223
.register_type::<tween::ComponentTween<Scale>>()
229-
.register_type::<tween::ComponentTween<AngleZ>>()
230-
.register_type::<tween::ComponentTween<TranslationDelta>>()
231-
.register_type::<tween::ComponentTween<RotationDelta>>()
232-
.register_type::<tween::ComponentTween<ScaleDelta>>()
233-
.register_type::<tween::ComponentTween<AngleZDelta>>();
224+
.register_type::<tween::ComponentTween<AngleZ>>();
234225

235226
#[cfg(feature = "bevy_sprite")]
236227
app.add_tween_systems((
237228
tween::component_tween_system::<SpriteColor>(),
238-
tween::component_tween_system::<SpriteColorDelta>(),
239229
))
240-
.register_type::<tween::ComponentTween<SpriteColor>>()
241-
.register_type::<tween::ComponentTween<SpriteColorDelta>>();
230+
.register_type::<tween::ComponentTween<SpriteColor>>();
242231

243232
#[cfg(feature = "bevy_ui")]
244233
app.add_tween_systems((
245234
tween::component_tween_system::<ui::BackgroundColor>(),
246235
tween::component_tween_system::<ui::BorderColor>(),
247-
tween::component_tween_system::<BackgroundColorDelta>(),
248-
tween::component_tween_system::<BorderColorDelta>(),
249236
))
250237
.register_type::<tween::ComponentTween<ui::BackgroundColor>>()
251-
.register_type::<tween::ComponentTween<ui::BorderColor>>()
252-
.register_type::<tween::ComponentTween<BackgroundColorDelta>>()
253-
.register_type::<tween::ComponentTween<BorderColorDelta>>();
238+
.register_type::<tween::ComponentTween<ui::BorderColor>>();
254239

255240
#[cfg(all(feature = "bevy_sprite", feature = "bevy_asset",))]
256241
app.add_tween_systems((
257242
tween::asset_tween_system::<sprite::ColorMaterial>(),
258-
tween::asset_tween_system::<ColorMaterialDelta>(),
259243
))
260-
.register_type::<tween::AssetTween<sprite::ColorMaterial>>()
261-
.register_type::<tween::ComponentTween<ColorMaterialDelta>>();
244+
.register_type::<tween::AssetTween<sprite::ColorMaterial>>();
262245
}
263246
}
264247

0 commit comments

Comments
 (0)