Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ickshonpe/bevy-animated-text
Basic animated text plugin for Bevy
https://github.com/ickshonpe/bevy-animated-text
Last synced: 24 days ago
JSON representation
Basic animated text plugin for Bevy
- Host: GitHub
- URL: https://github.com/ickshonpe/bevy-animated-text
- Owner: ickshonpe
- License: mit
- Created: 2024-07-12T13:26:47.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-07-12T14:25:35.000Z (5 months ago)
- Last Synced: 2024-11-24T19:44:44.629Z (29 days ago)
- Language: Rust
- Size: 8.79 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# bevy-animated-text
Basic animated text plugin for Bevy.
### Usage
Add the `AnimatedTextPlugin` to your app and spawn an entity with a `TextAnimationBundle` together with either a `TextBundle` or `Text2dBundle`:
```
use bevy::prelude::*;
use bevy_animated_text::*;fn setup(mut commands: Commands) {
commands.spawn(Camera2dBundle::default());
commands.spawn((
Text2dBundle {
text: Text::from_section(
"Hello, World!",
TextStyle {
font_size: 50.,
..Default::default()
},
),
..default()
},
TextAnimationBundle::from(|i: usize, _, p: Vec2, t: f32| p + 50. * (t + i as f32).sin() * Vec2::Y),
));
}fn main() {
App::new()
.add_plugins((DefaultPlugins, AnimatedTextPlugin))
.add_systems(Startup, setup)
.run();
}
```Unfortunately in order to work nicely with Bevy's existing text implementation it's limited to only animating glyph positions.
### Examples
* ```cargo run --example hello_world```
* ```cargo run --example text2d```
* ```cargo run --example ui```
The `text2d` example is the most complete.