diff options
Diffstat (limited to 'src/utils')
| -rw-r--r-- | src/utils/mod.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/utils/mod.rs b/src/utils/mod.rs index c1e57b7b..2ac37721 100644 --- a/src/utils/mod.rs +++ b/src/utils/mod.rs @@ -1,4 +1,5 @@ use std::cmp::{max, min}; +use std::f64; use std::ffi::{CString, OsStr}; use std::io::Write; use std::os::unix::prelude::OsStrExt; @@ -396,6 +397,12 @@ pub fn center_preferring_top_left_in_area( area.loc + offset } +pub fn baba_is_float_offset(now: Duration, view_height: f64) -> f64 { + let now = now.as_secs_f64(); + let amplitude = view_height / 96.; + amplitude * ((f64::consts::TAU * now / 3.6).sin() - 1.) +} + #[cfg(feature = "dbus")] pub fn show_screenshot_notification(image_path: Option<PathBuf>) -> anyhow::Result<()> { use std::collections::HashMap; |
