Profile
What problem does this crate solve?
A crate with very simple API to implement everything you could wish for regarding parallax backgrounds! Bidirectional and flexible.
Features
- Horizontal and vertical parallax
- Offset settings
- Repeat settings
- Independent speed settings
- Animation support (flipping atlas indices at defined timing)
- Clamping for world bounds
- Can be set on any camera
Showcase
Check out the GIF at Github!
Get started
The API is excellently easy to work with. Just add a few lines to your game camera to give it a go.
fn setup(mut commands: Commands) {
commands.spawn((
Camera2d,
ParallaxCamera::default(),
children![
ParallaxLayer::new("sky.png", 0.9)
.with_tile_size(UVec2::new(384, 216))
.with_repeat(LayerRepeat::horizontal())
.with_z(-2.0),
ParallaxLayer::new("mountains.png", 0.5)
.with_tile_size(UVec2::new(320, 240))
.with_repeat(LayerRepeat::horizontally(RepeatStrategy::MirrorHorizontally))
.with_z(-1.0),
ParallaxLayer::new("ground.png", 0.0)
.with_tile_size(UVec2::new(640, 360))
.with_repeat(LayerRepeat::horizontal())
.with_z(0.0),
],
));
}
Screenshots
Reviews
No reviews yet. Be the first to review this crate!
Downloads
65
Cages
0
Rating
Unrated
License
MIT
Added by
ffmulks
Owner
GianlucaFrongia