aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2024-04-18 21:53:45 +0400
committerIvan Molodetskikh <yalterz@gmail.com>2024-04-18 21:55:01 +0400
commit0b93c46ce80acbca086f3d9588e5ec83a48f2745 (patch)
tree3c9504ac283c717470be74f0dbb4bd3a14e077ed
parent0fcd981b86029ce4a554bf4805221a104a9228a7 (diff)
downloadniri-0b93c46ce80acbca086f3d9588e5ec83a48f2745.tar.gz
niri-0b93c46ce80acbca086f3d9588e5ec83a48f2745.tar.bz2
niri-0b93c46ce80acbca086f3d9588e5ec83a48f2745.zip
animation: Scale initial velocity by slowdown
-rw-r--r--src/animation/mod.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/animation/mod.rs b/src/animation/mod.rs
index 7ab0c585..2319c00b 100644
--- a/src/animation/mod.rs
+++ b/src/animation/mod.rs
@@ -48,6 +48,9 @@ pub enum Curve {
impl Animation {
pub fn new(from: f64, to: f64, initial_velocity: f64, config: niri_config::Animation) -> Self {
+ // Scale the velocity by slowdown to keep the touchpad gestures feeling right.
+ let initial_velocity = initial_velocity * ANIMATION_SLOWDOWN.load(Ordering::Relaxed);
+
let mut rv = Self::ease(from, to, initial_velocity, 0, Curve::EaseOutCubic);
if config.off {
rv.is_off = true;
@@ -102,6 +105,9 @@ impl Animation {
return self;
}
+ // Scale the velocity by slowdown to keep the touchpad gestures feeling right.
+ let initial_velocity = initial_velocity * ANIMATION_SLOWDOWN.load(Ordering::Relaxed);
+
match self.kind {
Kind::Easing { curve } => Self::ease(
from,