https://github.com/mintlu8/bevy_mod_opacity
Hierarchical opacity for bevy.
https://github.com/mintlu8/bevy_mod_opacity
Last synced: 11 months ago
JSON representation
Hierarchical opacity for bevy.
- Host: GitHub
- URL: https://github.com/mintlu8/bevy_mod_opacity
- Owner: mintlu8
- License: mit
- Created: 2024-10-04T00:03:30.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-04-25T04:19:52.000Z (about 1 year ago)
- Last Synced: 2025-06-28T12:46:45.868Z (12 months ago)
- Language: Rust
- Homepage:
- Size: 124 KB
- Stars: 10
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# bevy_mod_opacity
Hierarchical opacity for bevy.
## The `Opacity` component
When `Opacity` is inserted to an entity, the entity and all its descendants
will be affected by the opacity value. Unlike bevy components like `Visibility`
`Opacity` does not need to be put on every entity in the tree.
Entities with no `Opacity` ancestor will not be affected by this crate.
## Support for native types
We innately support `2d`, `3d` and `ui`, this includes `Sprite`, `TextColor`, `StandardMaterial`,
`ColorMaterial`, `Image`, `BackgroundColor` and `ForegroundColor`.
Additionally you can implement `OpacityQuery` or derive `Opacity` to make your own types
and materials work with this crate. Combining `OpacityQuery` with custom `QueryData` can
add support for third party types.
## `FadeIn` and `FadeOut`
These components adds a quick way to add and remove entities from your scenes smoothly.
You should add a `FadeIn` during the `spawn` call and use `entity.insert(FadeOut)` instead
of `entity.despawn_recursive()`
## FAQ
* My 3d scene is not fading correctly
Ensure materials are duplicated and unique, since we write to the underlying material directly.
Also make sure `AlphaMode` is set to `Blend` if applicable.
## Versions
| bevy | bevy_mod_opacity |
|------|--------------------|
| 0.14 | 0.1 |
| 0.15 | 0.2 |
| 0.16 | 0.3 |
## License
License under either of
Apache License, Version 2.0 (LICENSE-APACHE or )
MIT license (LICENSE-MIT or )
at your option.
## Contribution
Contributions are welcome!
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.