diff --git a/crates/client/src/gui/parts.rs b/crates/client/src/gui/parts.rs index ee5346e..ddbce1f 100644 --- a/crates/client/src/gui/parts.rs +++ b/crates/client/src/gui/parts.rs @@ -368,7 +368,7 @@ pub enum Voice { const STILL: f32 = 0.02; const EDGE: f32 = 16.; -const PEAK_SPACING: f32 = 3.; +const PEAK_SPACING: f32 = 5.; const MIN_PEAKS: usize = 6; pub fn voice_line(bands: Option<&VecDeque>, voice: Voice, t: Tokens) -> AnyElement { @@ -402,21 +402,16 @@ pub fn voice_line(bands: Option<&VecDeque>, voice: Voice, t: Tokens) -> Any if frayed { path = path.dash_array(&[px(4.), px(3.)]); } - let crest = |index: usize, side: f32| { - let along = (index as f32 + 0.5) / count; - let edge = (along.min(1. - along) * EDGE).min(1.); - let x = bounds.origin.x + bounds.size.width * along; - point(x, middle + px(side * peaks[index] * edge * half)) - }; path.move_to(point(bounds.origin.x, middle)); - for index in 0..peaks.len() { - path.line_to(crest(index, -1.)); + for (index, level) in peaks.iter().enumerate() { + for (quarter, side) in [(0.25, -1.), (0.75, 1.)] { + let along = (index as f32 + quarter) / count; + let edge = (along.min(1. - along) * EDGE).min(1.); + let x = bounds.origin.x + bounds.size.width * along; + path.line_to(point(x, middle + px(side * level * edge * half))); + } } path.line_to(point(bounds.origin.x + bounds.size.width, middle)); - for index in (0..peaks.len()).rev() { - path.line_to(crest(index, 1.)); - } - path.line_to(point(bounds.origin.x, middle)); if let Ok(path) = path.build() { window.paint_path(path, color); }