From 1d95f8676f22981a993b896c6027db58e7d3026c Mon Sep 17 00:00:00 2001 From: Weird Constructor Date: Tue, 9 Aug 2022 05:13:23 +0200 Subject: [PATCH] add method to Smoother --- src/util.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/util.rs b/src/util.rs index 64594ce..7669d70 100644 --- a/src/util.rs +++ b/src/util.rs @@ -42,6 +42,15 @@ impl Smoother { self.done = false; } + #[inline] + pub fn current(&self) -> f32 { + if self.done { + self.target + } else { + self.value + } + } + #[inline] pub fn next(&mut self) -> f32 { //d// println!("NEXT: count={}, value={:6.3} inc={:6.4}",