Skip to content

Commit 7554af9

Browse files
authored
Action commands API overhaul (#59)
* Rename bevy_motiongfx to motiongfx * Changed action generics' location * Remove color_palette * Use smallvec & changed ActionMeta to ActionSpan * Add new api for creating animation sequences * Removed unused interp files * Remove unused ActionSpan methods * Fix docs * Add stringify_field for consistent output * Fix action builder test
1 parent b9a0c2c commit 7554af9

32 files changed

+2764
-2166
lines changed

Cargo.lock

Lines changed: 682 additions & 510 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,27 @@ members = ["crates/*", ]
66
version = "0.1.0"
77
edition = "2021"
88
license = "MIT OR Apache-2.0"
9-
repository = "https://github.com/nixon-voxell/bevy_motiongfx"
9+
repository = "https://github.com/nixon-voxell/motiongfx"
1010
readme = "README.md"
1111

1212
[workspace.dependencies]
13-
bevy = { version = "0.16.0", default-features = false , features = ["bevy_color", "bevy_asset", "bevy_pbr", "bevy_sprite"]}
13+
bevy = { version = "0.16.1", default-features = false }
1414
smallvec = "1"
1515

1616
[package]
17-
name = "bevy_motiongfx"
18-
categories = ["graphics", "gui", "rendering", "motion-graphics", "vector-graphics"]
17+
name = "motiongfx"
1918
description = "Motion graphics creation tool in Bevy. (Highly inspired by Motion Canvas and Manim)"
2019
exclude = ["/assets/", "/.github/", "/examples/"]
2120
keywords = ["motion-graphics", "game", "gamedev", "graphics", "bevy"]
21+
categories = ["graphics", "gui", "rendering", "motion-graphics", "vector-graphics"]
2222
version.workspace = true
2323
edition.workspace = true
2424
license.workspace = true
2525
repository.workspace = true
2626
readme.workspace = true
2727

2828
[dependencies]
29-
motiongfx_core = { version = "0.1.0", path = "crates/motiongfx_core" }
29+
motiongfx_engine = { version = "0.1.0", path = "crates/motiongfx_engine" }
3030
motiongfx_common = { version = "0.1.0", path = "crates/motiongfx_common", optional = true }
3131
bevy = { workspace = true }
3232

@@ -35,7 +35,7 @@ default = ["common"]
3535
common = ["dep:motiongfx_common"]
3636

3737
[dev-dependencies]
38-
bevy = "0.16.0"
38+
bevy = "0.16.1"
3939

4040
[workspace.lints.clippy]
4141
redundant_type_annotations = "warn"

crates/motiongfx_common/Cargo.toml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@ repository.workspace = true
77

88
[dependencies]
99
bevy = { workspace = true }
10-
motiongfx_core = { version = "0.1.0", path = "../motiongfx_core" }
10+
motiongfx_engine = { version = "0.1.0", path = "../motiongfx_engine" }
1111

1212
[lints]
1313
workspace = true
14+
15+
[features]
16+
default = ["bevy_sprite", "bevy_pbr"]
17+
bevy_sprite = ["bevy/bevy_sprite"]
18+
bevy_pbr = ["bevy/bevy_pbr"]

crates/motiongfx_common/src/lib.rs

Lines changed: 63 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,71 @@
11
use bevy::prelude::*;
2-
use motiongfx_core::prelude::*;
3-
4-
pub mod motion;
5-
6-
pub mod prelude {
7-
pub use crate::{
8-
motion::{
9-
standard_material_motion::StandardMaterialMotion,
10-
transform_motion::TransformMotion,
11-
},
12-
MotionGfxCommonPlugin,
13-
};
14-
}
2+
use motiongfx_engine::prelude::*;
153

164
pub struct MotionGfxCommonPlugin;
175

186
impl Plugin for MotionGfxCommonPlugin {
197
fn build(&self, app: &mut App) {
20-
app.animate_component::<Transform, Vec3>()
21-
.animate_component::<Transform, Quat>()
22-
.animate_component::<Transform, f32>()
23-
.animate_component::<Sprite, Color>()
24-
.animate_component::<Sprite, f32>()
25-
.animate_asset::<MeshMaterial3d<StandardMaterial>, Color>()
26-
.animate_asset::<MeshMaterial3d<StandardMaterial>, LinearRgba>()
27-
.animate_asset::<MeshMaterial3d<StandardMaterial>, f32>()
28-
.animate_asset::<MeshMaterial2d<ColorMaterial>, Color>()
29-
.animate_asset::<MeshMaterial2d<ColorMaterial>, f32>();
8+
app.animate_component(field_bundle!(<Transform>))
9+
.animate_component(field_bundle!(
10+
<Transform>::translation
11+
))
12+
.animate_component(field_bundle!(<Transform>::scale))
13+
.animate_component(field_bundle!(<Transform>::rotation))
14+
.animate_component(field_bundle!(
15+
<Transform>::translation::x
16+
))
17+
.animate_component(field_bundle!(
18+
<Transform>::translation::y
19+
))
20+
.animate_component(field_bundle!(
21+
<Transform>::translation::z
22+
))
23+
.animate_component(field_bundle!(<Transform>::scale::x))
24+
.animate_component(field_bundle!(<Transform>::scale::y))
25+
.animate_component(field_bundle!(<Transform>::scale::z));
26+
27+
#[cfg(feature = "bevy_sprite")]
28+
app.animate_component(field_bundle!(<Sprite>::color))
29+
.animate_asset::<MeshMaterial2d<_>, _>(field_bundle!(
30+
<ColorMaterial>::color
31+
));
32+
33+
#[cfg(feature = "bevy_pbr")]
34+
app.animate_asset::<MeshMaterial3d<_>, _>(field_bundle!(
35+
<StandardMaterial>::base_color
36+
))
37+
.animate_asset::<MeshMaterial3d<_>, _>(field_bundle!(
38+
<StandardMaterial>::emissive
39+
))
40+
.animate_asset::<MeshMaterial3d<_>, _>(field_bundle!(
41+
<StandardMaterial>::perceptual_roughness
42+
))
43+
.animate_asset::<MeshMaterial3d<_>, _>(field_bundle!(
44+
<StandardMaterial>::metallic
45+
))
46+
.animate_asset::<MeshMaterial3d<_>, _>(field_bundle!(
47+
<StandardMaterial>::reflectance
48+
))
49+
.animate_asset::<MeshMaterial3d<_>, _>(field_bundle!(
50+
<StandardMaterial>::specular_tint
51+
))
52+
.animate_asset::<MeshMaterial3d<_>, _>(field_bundle!(
53+
<StandardMaterial>::diffuse_transmission
54+
))
55+
.animate_asset::<MeshMaterial3d<_>, _>(field_bundle!(
56+
<StandardMaterial>::specular_transmission
57+
))
58+
.animate_asset::<MeshMaterial3d<_>, _>(field_bundle!(
59+
<StandardMaterial>::thickness
60+
))
61+
.animate_asset::<MeshMaterial3d<_>, _>(field_bundle!(
62+
<StandardMaterial>::ior
63+
))
64+
.animate_asset::<MeshMaterial3d<_>, _>(field_bundle!(
65+
<StandardMaterial>::attenuation_distance
66+
))
67+
.animate_asset::<MeshMaterial3d<_>, _>(
68+
field_bundle!(<StandardMaterial>::attenuation_color),
69+
);
3070
}
3171
}

crates/motiongfx_common/src/motion.rs

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

crates/motiongfx_common/src/motion/standard_material_motion.rs

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

crates/motiongfx_common/src/motion/transform_motion.rs

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

crates/motiongfx_core/macros/Cargo.toml

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

0 commit comments

Comments
 (0)