-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
UI Node Gradients #18139
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
UI Node Gradients #18139
Conversation
… and added doc comments
…into linear-gradients
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thanks!
@alice-i-cecile is there any chance to get this still in for 0.16? Would love to see that - what can I do to help? |
This has two approvals so it's ready to merge but I'm reluctant to ship a feature after the initial release candidate has been cut. |
FWIW I tested the examples, works great for me. |
This has missed the deadline for 0.16 features but the changes here are only very loosely coupled to the rest of bevy_ui, it should (hopefully) be really simple to copy the gradients plugin module, the components, and the shader into your own project with minimal changes. The only sources of friction should be from this change: #18164 and maybe the shader imports. If you want to try that and have any problems, feel free to message me with any questions. I plan to release a third-party crate but got a couple of other things I'm working on I want to get finished first this week. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR was created before we implemented the new release notes process, and so hasn't gotten the right pings by the bot. I'm re-adding the tags so that you'll get the new instructions.
It looks like your PR has been selected for a highlight in the next release blog post, but you didn't provide a release note. Please review the instructions for writing release notes, then expand or revise the content in the release notes directory to showcase your changes. |
Objective
Allowing drawing of UI nodes with a gradient instead of a flat color.
Solution
The are three gradient structs corresponding to the three types of gradients supported:
LinearGradient
,ConicGradient
andRadialGradient
. These are then wrapped in aGradient
enum discriminator which hasLinear
,Conic
andRadial
variants.Each gradient type consists of the geometric properties for that gradient and a list of color stops.
Color stops consist of a color, a position or angle and an optional hint. If no position is specified for a stop, it's evenly spaced between the previous and following stops. Color stop postions are absolute, if you specify a list of stops:
vec