pub struct Gradient {
pub kind: GradientKind,
pub stops: Vec<(f64, Color)>,
}Expand description
A gradient in the node’s local coordinates (origin at the node center).
Fields§
§kind: GradientKindLinear or radial, with its geometry.
stops: Vec<(f64, Color)>(offset in 0..=1, color), sorted by offset.
Implementations§
Source§impl Gradient
impl Gradient
Sourcepub fn linear(from: impl Into<Point>, to: impl Into<Point>) -> Gradient
pub fn linear(from: impl Into<Point>, to: impl Into<Point>) -> Gradient
Linear gradient from from to to; add colors with stops.
Sourcepub fn radial(center: impl Into<Point>, radius: f64) -> Gradient
pub fn radial(center: impl Into<Point>, radius: f64) -> Gradient
Radial gradient around center; add colors with stops.
Sourcepub fn stops(self, colors: impl IntoIterator<Item = Color>) -> Gradient
pub fn stops(self, colors: impl IntoIterator<Item = Color>) -> Gradient
Evenly spaced stops.
Sourcepub fn with_opacity(&self, opacity: f64) -> Gradient
pub fn with_opacity(&self, opacity: f64) -> Gradient
Multiplies every stop’s alpha (node opacity).
Sourcepub fn is_visible(&self) -> bool
pub fn is_visible(&self) -> bool
Whether any stop is not fully transparent.
Trait Implementations§
Source§impl Lerp for Gradient
Same kind and stop count: points, offsets and colors interpolate.
Otherwise the gradient switches at the midpoint.
impl Lerp for Gradient
Same kind and stop count: points, offsets and colors interpolate. Otherwise the gradient switches at the midpoint.
impl StructuralPartialEq for Gradient
Auto Trait Implementations§
impl Freeze for Gradient
impl RefUnwindSafe for Gradient
impl Send for Gradient
impl Sync for Gradient
impl Unpin for Gradient
impl UnsafeUnpin for Gradient
impl UnwindSafe for Gradient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more