Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementation overhaul #39

Draft
wants to merge 130 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
130 commits
Select commit Hold shift + click to select a range
d311146
Rename interpolation to curve
Multirious Jun 29, 2024
416ec75
Move TweenInterpolationValue to curve module
Multirious Jun 29, 2024
4cff635
Rename TweenInterpolationValue to CurveValue
Multirious Jun 29, 2024
3a149f9
Rename UpdateInterpolationValue to UpdateCurveValue
Multirious Jun 29, 2024
a9e9a7e
Add generic V to CurveValue
Multirious Jun 29, 2024
67a43ba
New setter module
Multirious Jun 29, 2024
45a8e62
Add some impls for setter
Multirious Jun 29, 2024
8bcd565
Monomize Interpolation trait
Multirious Jun 29, 2024
2799a1d
Add AToB curve then replace ease_function_system
Multirious Jun 29, 2024
58cc8f1
Make Target* types component
Multirious Jun 29, 2024
12d3e65
Improve Setter trait and add some test system
Multirious Jun 30, 2024
c37b8b7
Add None variant to TargetComponent and TargetAsset
Multirious Jun 30, 2024
4b3ab80
AnimationTarget as its own module and system
Multirious Jun 30, 2024
1934fd2
Add ResolveTarget variant to TweenSystemSet
Multirious Jun 30, 2024
67b4f52
Update getting TweenAppResource error message
Multirious Jun 30, 2024
5168f22
Add AnimationTargetPlugin
Multirious Jun 30, 2024
7d47689
Move utils to crate utils to prepare for user's utils
Multirious Jun 30, 2024
7904ef3
Create utils module and move animation_target module into it
Multirious Jun 30, 2024
ef6106c
Change set_component_from_curve_value_system to apply_component_tween…
Multirious Jun 30, 2024
8873c8c
Add more tween systems in setter module
Multirious Jun 30, 2024
e29713e
Remove SkipSetter and use SkipTween instead
Multirious Jun 30, 2024
a0869d0
Move setter::blanket_impl module to its own file
Multirious Jun 30, 2024
6eb1943
Move setter::sprite module to its own file
Multirious Jun 30, 2024
559a7ac
Move systems in setter into system module
Multirious Jun 30, 2024
49cde96
Add setter::plugin module with some content
Multirious Jun 30, 2024
89f9e50
Configure TweenSystemSet::ResolveTarget
Multirious Jun 30, 2024
9214a98
Remove test plugin in setter::sprite
Multirious Jun 30, 2024
a3399c4
Update bevy_time_runner
Multirious Jun 30, 2024
29ddbad
Remove TargetComponent::Marker variant and related impls
Multirious Jun 30, 2024
53fb873
Remove tween::systems module
Multirious Jun 30, 2024
5da1114
Remove `Tween` and related impls
Multirious Jun 30, 2024
f09f5e2
Move setter module into tween module
Multirious Jul 1, 2024
d644181
Remove TargetComponent::Marker impls
Multirious Jul 1, 2024
aec09ef
Comment out invalid and unused re-exports in lib
Multirious Jul 1, 2024
f358966
Rename plugins in tween::plugin
Multirious Jul 1, 2024
0c703a3
Update cfg attr
Multirious Jul 1, 2024
384ad51
Rename Setter to Set and add Setter component
Multirious Jul 1, 2024
b99da7c
Add Set impls from Interpolator impls
Multirious Jul 1, 2024
cd2d0c8
Move Set and Setter into tween module
Multirious Jul 1, 2024
8a86b1b
Rename setter module to items
Multirious Jul 1, 2024
73243b9
Register tween items
Multirious Jul 1, 2024
27d1537
Rename DefaultTweenSystemPlugin to DefaultTweenItemPlugin
Multirious Jul 1, 2024
f0ac94f
Comment out interpolate module
Multirious Jul 1, 2024
9819c08
Add items::reflect module with SetReflect and stuff but commented out
Multirious Jul 1, 2024
534c3ea
Remove AnimationTarget type registration from TweenCorePlugin
Multirious Jul 1, 2024
5b4156e
Rename DefaultTweenItemPlugin to DefaultTweenItemPlugins
Multirious Jul 1, 2024
26e9a31
Move items module to lib
Multirious Jul 2, 2024
4eaa85b
Move Target* types into its own module `targets`
Multirious Jul 2, 2024
f2bafef
Remove deprecated tween event stuff in tween module
Multirious Jul 2, 2024
bb74b43
Make Setter component derive reflect and reflect component
Multirious Jul 2, 2024
1dfafc7
Change Set to use associated type
Multirious Jul 2, 2024
b6fe11a
Update Set impl due to new Set definition
Multirious Jul 2, 2024
68455c2
Make register_items include Setter<T>
Multirious Jul 2, 2024
5d6121a
Remove Component derive from translation
Multirious Jul 2, 2024
dbc1659
Remove register_items and register within the plugin group instead
Multirious Jul 2, 2024
6482af1
Rename DefaultTweenItemPlugins to DefaultTweenSystemPlugins
Multirious Jul 2, 2024
ba98024
Replace old interpolator plugin inside DefaultTweenPlugins to Default…
Multirious Jul 2, 2024
33e7906
Move Set and Setter into items module and remove Setter::new method
Multirious Jul 2, 2024
91e29a6
Update tween module docs
Multirious Jul 2, 2024
78cbf09
Update paths
Multirious Jul 2, 2024
45cdb0b
Update tween module docs
Multirious Jul 3, 2024
6e3b0d2
Setter impls using macro
Multirious Jul 3, 2024
a3e5cbb
Remove BevyTweenRegisterSystems
Multirious Jul 3, 2024
9eb7759
Change TargetAsset default to None
Multirious Jul 4, 2024
2d86f96
Merge branch 'prep-bevy-0.14' into rewrite
Multirious Jul 5, 2024
461c348
Merge branch 'main' into rewrite
Multirious Jul 9, 2024
fbed840
Rename ease_functions module to ease_function
Multirious Jul 9, 2024
08f5be6
Remove unnecessary clamp in a_to_b_ease_function_system
Multirious Jul 9, 2024
751c25a
Rename a_to_b_ease_function_system to ease_function_a_to_b_system
Multirious Jul 9, 2024
5cec350
Move ease function stuffs into ease_function module
Multirious Jul 9, 2024
62373ea
Change EaseFunctionPlugin to EaseFunctionAToBPlugin
Multirious Jul 9, 2024
a71b99a
Commented out reexport of BevyTweenRegisterSystems in prelude
Multirious Jul 9, 2024
fc98818
Boxed setter impls and plugin
Multirious Jul 11, 2024
b3ea3d1
Merge branch 'main' into rewrite
Multirious Jul 11, 2024
b2f816b
Rename combinator module to builder
Multirious Jul 12, 2024
64f2f82
Rename AnimationBuilder::insert to add
Multirious Jul 12, 2024
7adb3d5
Add builder/tween module impls
Multirious Jul 12, 2024
9a0fd1a
Commented out builder/state module
Multirious Jul 12, 2024
49d470b
Remove `TransformTargetStateExt` from prelude
Multirious Jul 12, 2024
fb949a0
Commented out tween and tween_exact in animation_combinators
Multirious Jul 12, 2024
cf2ade4
Move event, event_at, event_for, event_exact to builder/event module
Multirious Jul 12, 2024
1726fa0
Rename builder/animation_combinator module to time
Multirious Jul 12, 2024
67f877d
Refactor re-export in builder module
Multirious Jul 12, 2024
cc76273
Commented out any impl of bevy_lookup_curve
Multirious Jul 12, 2024
d40f0af
Attempt to update event example
Multirious Jul 12, 2024
a51ded1
Remove `Setter` component and other renames and refactors
Multirious Jul 13, 2024
699b92d
Update and Merge all default plugins (It's just too much)
Multirious Jul 13, 2024
b5126a2
Fix event example
Multirious Jul 14, 2024
ee18308
Rename `set_with` to `set` and `with_state` to `state`
Multirious Jul 14, 2024
c7cbe0e
Silence clippy on `AnimationBuilder::add` method
Multirious Jul 14, 2024
07ce4ab
Update `AnimationBuilder::insert_tween_here` method
Multirious Jul 14, 2024
3f93582
Update click example
Multirious Jul 14, 2024
f69ff1c
Make curve the last argument in builder
Multirious Jul 14, 2024
99a2cc6
Update examples
Multirious Jul 14, 2024
a320aed
Add BuildAnimation trait
Multirious Jul 14, 2024
530d29e
Update `Parallel` and `Sequence` to use `BuildAnimation`
Multirious Jul 14, 2024
bc2ce70
Tween builder methods return `Tween` type instead of FnOnce
Multirious Jul 14, 2024
8c2f278
Rename SetWithExt to TargetSetExt
Multirious Jul 14, 2024
46fb5bb
Use S::Value instead of generic V
Multirious Jul 14, 2024
ccff735
Rename curve used in AToB to ease_curve
Multirious Jul 15, 2024
2d4b9d7
Update a few docs
Multirious Jul 15, 2024
22e32b4
Rename curve used in AToB to ease_curve
Multirious Jul 15, 2024
8493989
Make builder::tween::Tween fields public
Multirious Jul 15, 2024
b8854bd
Change insert_tween_here to use `Tween`
Multirious Jul 15, 2024
663cad5
Update follow example
Multirious Jul 15, 2024
304dd37
Rename Tween to BuildTween and make event build function return Build…
Multirious Jul 18, 2024
2b476d8
SetWorld plugin
Multirious Jul 18, 2024
30aa50a
Fix trait requirement
Multirious Jul 18, 2024
e3b4617
Pub SetWorld impls
Multirious Jul 18, 2024
0f93f66
Target SetWorld extension trait
Multirious Jul 18, 2024
01aa0d2
Improve SetWorld api
Multirious Jul 18, 2024
02bd4df
Add SetWorldPlugin to DefaultTweenPlugins
Multirious Jul 18, 2024
ce336a6
Add more stuff to prelude
Multirious Jul 18, 2024
9306c78
Changes to SetWorld builder api
Multirious Jul 18, 2024
628d3ec
set_world example
Multirious Jul 18, 2024
06c6604
Rename SetWorld to WorldSetter
Multirious Jul 18, 2024
c80fe11
Move BoxedSetter into its own module
Multirious Jul 18, 2024
38314f7
Make BoxedSetter Clone
Multirious Jul 18, 2024
3624e5f
Rename WorldSetter to DynamicSetter
Multirious Jul 21, 2024
2be5e4a
Use enum internally for DyanmicSetter
Multirious Jul 22, 2024
6fc050e
Implement general lerp trait
Multirious Jul 22, 2024
5d6d827
Implement ReflectLerp and make Lerp take reference
Multirious Jul 22, 2024
468cc73
Pub lerp module
Multirious Jul 22, 2024
1472fd7
Register ReflectLerp
Multirious Jul 22, 2024
9c68973
Implement Lerp for Quat using slerp method
Multirious Jul 22, 2024
c9c3fa5
Register SetterValues
Multirious Jul 22, 2024
43a30c2
Dynamic Setter Reflect impl
Multirious Jul 22, 2024
44199e5
Fix DynamicSetter Reflect system
Multirious Jul 22, 2024
e04cc8d
Add set_reflect example
Multirious Jul 22, 2024
5e39f4a
Improve builder for dyanmic setter and example
Multirious Jul 23, 2024
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
6 changes: 3 additions & 3 deletions examples/animation/banner_bounce.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
use std::f32::consts::PI;

use bevy::{
color::{Srgba, palettes::css::WHITE},
color::{palettes::css::WHITE, Srgba},
core_pipeline::{bloom::BloomSettings, tonemapping::Tonemapping},
prelude::*,
window,
};
use bevy_tween::{
combinator::{go, parallel, tween_exact, AnimationCommands},
builder::{go, parallel, tween_exact, AnimationCommands},
prelude::*,
};

Expand Down Expand Up @@ -223,7 +223,7 @@ fn animation(mut commands: Commands, asset_server: Res<AssetServer>) {
commands
.animation()
.repeat(Repeat::Infinitely)
.insert(parallel((
.add(parallel((
(
set_value(
bevy_tween_text_color.with(sprite_color_to(white_color)),
Expand Down
4 changes: 2 additions & 2 deletions examples/animation/banner_triangle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::f32::consts::TAU;

use bevy::prelude::*;
use bevy_tween::{
combinator::{parallel, tween_exact, AnimationCommands},
builder::{parallel, tween_exact, AnimationCommands},
interpolate::{angle_z, translation},
prelude::*,
tween::{AnimationTarget, TargetComponent},
Expand Down Expand Up @@ -65,7 +65,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
commands
.animation()
.repeat(Repeat::Infinitely)
.insert(parallel((
.add(parallel((
snap_rotate(triangles[4].clone(), secs, 7, 4., ease),
snap_rotate(triangles[3].clone(), secs, 7, 6., ease),
snap_rotate(triangles[2].clone(), secs, 7, 8., ease),
Expand Down
4 changes: 2 additions & 2 deletions examples/animation/thumbnail_triangle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::f32::consts::TAU;

use bevy::prelude::*;
use bevy_tween::{
combinator::{parallel, tween_exact, AnimationCommands},
builder::{parallel, tween_exact, AnimationCommands},
interpolate::angle_z,
prelude::*,
tween::TargetComponent,
Expand Down Expand Up @@ -68,7 +68,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
commands
.animation()
.repeat(Repeat::Infinitely)
.insert(parallel((
.add(parallel((
snap_rotate(triangles[4].clone(), secs, 7, 4., ease),
snap_rotate(triangles[3].clone(), secs, 7, 6., ease),
snap_rotate(triangles[2].clone(), secs, 7, 8., ease),
Expand Down
4 changes: 2 additions & 2 deletions examples/bevy_lookup_curve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use bevy_tween::{
editor::LookupCurveEditor, Knot, KnotInterpolation, LookupCurve,
LookupCurvePlugin,
},
combinator::tween,
builder::tween,
interpolate::translation,
prelude::*,
tween::{AnimationTarget, TargetComponent},
Expand Down Expand Up @@ -50,7 +50,7 @@ fn setup(mut commands: Commands, mut curves: ResMut<Assets<LookupCurve>>) {
.animation()
.repeat(Repeat::Infinitely)
.repeat_style(RepeatStyle::PingPong)
.insert(tween(
.add(tween(
Duration::from_secs(1),
(curve.clone(), LookupCurveEditor::new(curve)),
sprite.with(translation(
Expand Down
68 changes: 30 additions & 38 deletions examples/demo/click.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ use bevy::{
prelude::*,
};
use bevy_tween::{
bevy_time_runner::TimeRunnerEnded, combinator::*, prelude::*,
tween::AnimationTarget,
bevy_time_runner::TimeRunnerEnded, builder::parallel, items, prelude::*,
};
mod utils;

Expand Down Expand Up @@ -43,47 +42,40 @@ fn click_spawn_circle(
key: Res<ButtonInput<MouseButton>>,
asset_server: Res<AssetServer>,
) {
use interpolate::sprite_color;
let circle_filled_image = asset_server.load("circle_filled.png");
if let Some(coord) = coord.0 {
if key.just_pressed(MouseButton::Left)
|| key.pressed(MouseButton::Right)
{
let start = Vec3::new(coord.x, coord.y, 1.);
let end = Vec3::new(0., 0., 0.);
let transform = Transform::from_translation(start);
let circle = AnimationTarget.into_target();
let mut circle_transform = circle.transform_state(transform);
commands
.spawn((
SpriteBundle {
texture: circle_filled_image,
transform,
..Default::default()
},
AnimationTarget,
))
.animation()
.insert(parallel((
tween(
secs(2.),
EaseFunction::ExponentialOut,
circle_transform.translation_to(end),
),
tween(
secs(1.),
EaseFunction::BackIn,
circle_transform.scale_to(Vec3::ZERO),
),
tween(
secs(1.),
EaseFunction::Linear,
circle.with(sprite_color(
into_color(WHITE),
into_color(DEEP_PINK),
)),
),
)));
let cursor = Vec3::new(coord.x, coord.y, 1.);

let transform = Transform::from_translation(cursor);
let mut entity_commands = commands.spawn((SpriteBundle {
texture: circle_filled_image,
transform,
..Default::default()
},));
let circle = entity_commands.id().into_target();
entity_commands.animation().add(parallel((
circle.set(items::Translation).tween(
cursor,
Vec3::ZERO,
secs(2.),
EaseFunction::ExponentialOut,
),
circle.set(items::Scale).tween(
Vec3::ONE,
Vec3::ZERO,
secs(1.),
EaseFunction::BackIn,
),
circle.set(items::SpriteColor).tween(
into_color(WHITE),
into_color(DEEP_PINK),
secs(1.),
EaseFunction::Linear,
),
)));
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions examples/demo/entity_event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use bevy::prelude::*;
use bevy_eventlistener::prelude::*;
use bevy_tween::{
bevy_time_runner::TimeRunnerEnded,
combinator::{event, forward, sequence},
builder::{event, forward, sequence},
prelude::*,
};

Expand All @@ -26,7 +26,7 @@ fn setup(mut commands: Commands) {
))
.animation()
.repeat(Repeat::times(5))
.insert(forward(Duration::from_secs_f32(0.5)));
.add(forward(Duration::from_secs_f32(0.5)));

commands
.spawn(On::<TweenEvent<&'static str>>::run(
Expand All @@ -35,7 +35,7 @@ fn setup(mut commands: Commands) {
},
))
.animation()
.insert(sequence((
.add(sequence((
forward(Duration::from_secs_f32(3.)),
event("event"),
forward(Duration::from_secs_f32(0.5)),
Expand Down
Loading
Loading