Bevy Easings
Easings on Bevy components using interpolation.
Usage
System setup
Add the plugin to your app:
use *;
use EasingsPlugin;
Easing a component to a new value
And then just ease your components to their new state!
use *;
use *;
If the component being eased is not already a component of the entity, the component should first be inserted for the target entity.
Chaining easing
You can chain easings, if they are not set to repeat they will happen in sequence.
use *;
use *;
Bundle Supported
Custom component support
To be able to ease a component, it needs to implement the traits Default
and Lerp
. This trait is re-exported by beavy_easings
.
use *;
use *;
;
The basic formula for lerp (linear interpolation) is self + (other - self) * scalar
.
Then, the system custom_ease_system::<CustomComponent>
needs to be added to the application.
Examples
See examples
Ease Functions
Many ease functions are available:
- QuadraticIn
- QuadraticOut
- QuadraticInOut
- CubicIn
- CubicOut
- CubicInOut
- QuarticIn
- QuarticOut
- QuarticInOut
- QuinticIn
- QuinticOut
- QuinticInOut
- SineIn
- SineOut
- SineInOut
- CircularIn
- CircularOut
- CircularInOut
- ExponentialIn
- ExponentialOut
- ExponentialInOut
- ElasticIn
- ElasticOut
- ElasticInOut
- BackIn
- BackOut
- BackInOut
- BounceIn
- BounceOut
- BounceInOut
Bevy | bevy_easings |
---|---|
main | main |
0.9 | 0.9 |
0.8 | 0.8 |
0.7 | 0.7 |
0.6 | 0.6 |
0.5 | 0.4 |