diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2024-04-18 21:53:45 +0400 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2024-04-18 21:55:01 +0400 |
| commit | 0b93c46ce80acbca086f3d9588e5ec83a48f2745 (patch) | |
| tree | 3c9504ac283c717470be74f0dbb4bd3a14e077ed /src | |
| parent | 0fcd981b86029ce4a554bf4805221a104a9228a7 (diff) | |
| download | niri-0b93c46ce80acbca086f3d9588e5ec83a48f2745.tar.gz niri-0b93c46ce80acbca086f3d9588e5ec83a48f2745.tar.bz2 niri-0b93c46ce80acbca086f3d9588e5ec83a48f2745.zip | |
animation: Scale initial velocity by slowdown
Diffstat (limited to 'src')
| -rw-r--r-- | src/animation/mod.rs | 6 |
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, |
