pub struct Dash {
pub intervals: Vec<f32>,
pub phase: f32,
}Expand description
A dash pattern: alternating drawn and skipped lengths, and where to start.
Fields§
§intervals: Vec<f32>Alternating drawn and skipped lengths, starting with a drawn one.
In the same space the path is in, so a pattern travels through the canvas transform with the geometry rather than staying fixed on screen.
phase: f32How far into the pattern the path starts.
Wrapped into one period, so any value is meaningful and an animation can simply keep adding to it.
Implementations§
Source§impl Dash
impl Dash
pub fn new(intervals: Vec<f32>, phase: f32) -> Dash
Sourcepub fn is_usable(&self) -> bool
pub fn is_usable(&self) -> bool
Whether this pattern describes something that can be walked.
A pattern of nothing, of negative lengths, or of lengths that sum to zero has no period to advance through, and walking one would not terminate. Such a pattern is treated as no pattern at all: the path is drawn whole, which is the one behavior that cannot surprise anybody who got here by computing an interval that came out zero.