We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
ColorStop
1 parent 83305af commit 63dd8b6Copy full SHA for 63dd8b6
crates/bevy_ui/src/gradients.rs
@@ -44,6 +44,24 @@ impl ColorStop {
44
}
45
46
47
+ /// A color stop with its position in logical pixels.
48
+ pub fn px(color: impl Into<Color>, px: f32) -> Self {
49
+ Self {
50
+ color: color.into(),
51
+ point: Val::Px(px),
52
+ hint: 0.5,
53
+ }
54
55
+
56
+ /// A color stop with a percentage position.
57
+ pub fn percent(color: impl Into<Color>, percent: f32) -> Self {
58
59
60
+ point: Val::Percent(percent),
61
62
63
64
65
// Set the interpolation midpoint between this and the following stop
66
pub fn with_hint(mut self, hint: f32) -> Self {
67
self.hint = hint;
0 commit comments