pub enum Gradient {
Linear(LinearGradient),
Radial(RadialGradient),
Sweep(SweepGradient),
}Expand description
Any of the three.
Variants§
Linear(LinearGradient)
Along a line.
Radial(RadialGradient)
Round a centre.
Sweep(SweepGradient)
Turning round a centre.
Implementations§
Source§impl Gradient
impl Gradient
Sourcepub fn resolved_stops(&self) -> Vec<f32>
pub fn resolved_stops(&self) -> Vec<f32>
The stops in use: the ones given when there is one per colour, otherwise the
colours spread evenly from 0 to 1 (gradient.dart’s _impliedStops).
Sourcepub fn sample(&self, t: f32) -> Color
pub fn sample(&self, t: f32) -> Color
The colour at t, between the colours either side of it, the end colours held
past the stops. What the renderer bakes into its ramp; t is already tiled.
Sourcepub fn resolve(&self, direction: TextDirection) -> Gradient
pub fn resolve(&self, direction: TextDirection) -> Gradient
The same gradient with its start and end made physical for direction.
Sourcepub fn scale(&self, factor: f32) -> Gradient
pub fn scale(&self, factor: f32) -> Gradient
Every colour’s opacity times factor — the reference’s Gradient.scale, which is
how a gradient on one side of a transition arrives or leaves.
Sourcepub fn lerp(
a: Option<&Gradient>,
b: Option<&Gradient>,
t: f32,
) -> Option<Gradient>
pub fn lerp( a: Option<&Gradient>, b: Option<&Gradient>, t: f32, ) -> Option<Gradient>
The gradient t of the way to other (gradient.dart’s Gradient.lerp): two of
the same kind with as many colours travel colour by colour, stop by stop and point
by point; anything else fades one out and the other in.