Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
Bevy Tweening
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Microhacks
Bevy Forks
Bevy Tweening
Commits
5e3ed117
Commit
5e3ed117
authored
3 years ago
by
Jerome Humbert
Browse files
Options
Downloads
Patches
Plain Diff
Fix missing pub export on systems
Export publicly the asset and component system to allow an app to manually add them.
parent
2d7285c9
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
CHANGELOG
+6
-0
6 additions, 0 deletions
CHANGELOG
README.md
+3
-3
3 additions, 3 deletions
README.md
src/lib.rs
+1
-1
1 addition, 1 deletion
src/lib.rs
src/plugin.rs
+33
-1
33 additions, 1 deletion
src/plugin.rs
with
43 additions
and
5 deletions
CHANGELOG
+
6
−
0
View file @
5e3ed117
...
...
@@ -3,6 +3,12 @@
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
### Fixed
- Fix missing public export of `component_animator_system()` and `asset_animator_system()` preventing the animation of all but the built-in items.
## [0.3.0] - 2022-01-28
### Added
...
...
This diff is collapsed.
Click to expand it.
README.md
+
3
−
3
View file @
5e3ed117
...
...
@@ -10,9 +10,9 @@ Tweening animation plugin for the Bevy game engine.
## Features
-
[x]
Versatile customizable lens system to a
nimate any field of any component or asset.
-
[x]
Sequence of
tween
ing
animations
chained together, running one after the other, to create complex animations
.
-
[x]
M
ultiple tween
ing
animations
per component, running in parallel, to animate different fields with different parameter
s.
-
[x]
A
nimate any field of any component or asset
, including custom ones
.
-
[x]
Run multiple
tween
s (
animations
) per component/asset in parallel
.
-
[x]
Chain m
ultiple tween
s (
animations
) one after the other for complex animation
s.
## Usage
...
...
This diff is collapsed.
Click to expand it.
src/lib.rs
+
1
−
1
View file @
5e3ed117
...
...
@@ -119,7 +119,7 @@ pub use lens::{
ColorMaterialColorLens
,
Lens
,
SpriteColorLens
,
TextColorLens
,
TransformPositionLens
,
TransformRotationLens
,
TransformScaleLens
,
UiPositionLens
,
};
pub
use
plugin
::
TweeningPlugin
;
pub
use
plugin
::
{
asset_animator_system
,
component_animator_system
,
TweeningPlugin
}
;
/// How should this easing loop repeat
#[derive(Clone,
Copy)]
...
...
This diff is collapsed.
Click to expand it.
src/plugin.rs
+
33
−
1
View file @
5e3ed117
...
...
@@ -2,7 +2,32 @@ use bevy::{asset::Asset, ecs::component::Component, prelude::*};
use
crate
::{
Animator
,
AnimatorState
,
AssetAnimator
};
/// Plugin to add systems related to tweening
/// Plugin to add systems related to tweening of common components and assets.
///
/// This plugin adds systems for a predefined set of components and assets, to allow their
/// respective animators to be updated each frame:
/// - [`Transform`]
/// - [`Text`]
/// - [`Style`]
/// - [`Sprite`]
/// - [`ColorMaterial`]
///
/// This ensures that all predefined lenses work as intended, as well as any custom lens
/// animating the same component or asset type.
///
/// For other components and assets, including custom ones, the relevant system needs to be
/// added manually by the application:
/// - For components, add [`component_animator_system::<T>`] where `T: Component`
/// - For assets, add [`asset_animator_system::<T>`] where `T: Asset`
///
/// This plugin is entirely optional. If you want more control, you can instead add manually
/// the relevant systems for the exact set of components and assets actually animated.
///
/// [`Transform`]: https://docs.rs/bevy/0.6.0/bevy/transform/components/struct.Transform.html
/// [`Text`]: https://docs.rs/bevy/0.6.0/bevy/text/struct.Text.html
/// [`Style`]: https://docs.rs/bevy/0.6.0/bevy/ui/struct.Style.html
/// [`Sprite`]: https://docs.rs/bevy/0.6.0/bevy/sprite/struct.Sprite.html
/// [`ColorMaterial`]: https://docs.rs/bevy/0.6.0/bevy/sprite/struct.ColorMaterial.html
#[derive(Debug,
Clone,
Copy)]
pub
struct
TweeningPlugin
;
...
...
@@ -16,6 +41,10 @@ impl Plugin for TweeningPlugin {
}
}
/// Animator system for components.
///
/// This system extracts all components of type `T` with an `Animator<T>` attached to the same entity,
/// and tick the animator to animate the component.
pub
fn
component_animator_system
<
T
:
Component
>
(
time
:
Res
<
Time
>
,
mut
query
:
Query
<
(
&
mut
T
,
&
mut
Animator
<
T
>
)
>
,
...
...
@@ -31,6 +60,9 @@ pub fn component_animator_system<T: Component>(
}
}
/// Animator system for assets.
///
/// This system ticks all `AssetAnimator<T>` components to animate their associated asset.
pub
fn
asset_animator_system
<
T
:
Asset
>
(
time
:
Res
<
Time
>
,
mut
assets
:
ResMut
<
Assets
<
T
>>
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment