animation: Scale initial velocity by slowdown
Browse files at this commit0b93c46ce80acbca086f3d9588e5ec83a48f2745Parent: 0fcd9811 changed file +6 -0
- src/animation/mod.rs +6 -0
src/animation/mod.rsmodified+6 -0
| @@ -48,6 +48,9 @@ pub enum Curve { | |||
| 48 | 48 | ||
| 49 | impl Animation { | 49 | impl Animation { |
| 50 | pub fn new(from: f64, to: f64, initial_velocity: f64, config: niri_config::Animation) -> Self { | 50 | pub fn new(from: f64, to: f64, initial_velocity: f64, config: niri_config::Animation) -> Self { |
| 51 | + // Scale the velocity by slowdown to keep the touchpad gestures feeling right. | ||
| 52 | + let initial_velocity = initial_velocity * ANIMATION_SLOWDOWN.load(Ordering::Relaxed); | ||
| 53 | + | ||
| 51 | let mut rv = Self::ease(from, to, initial_velocity, 0, Curve::EaseOutCubic); | 54 | let mut rv = Self::ease(from, to, initial_velocity, 0, Curve::EaseOutCubic); |
| 52 | if config.off { | 55 | if config.off { |
| 53 | rv.is_off = true; | 56 | rv.is_off = true; |
| @@ -102,6 +105,9 @@ impl Animation { | |||
| 102 | return self; | 105 | return self; |
| 103 | } | 106 | } |
| 104 | 107 | ||
| 108 | + // Scale the velocity by slowdown to keep the touchpad gestures feeling right. | ||
| 109 | + let initial_velocity = initial_velocity * ANIMATION_SLOWDOWN.load(Ordering::Relaxed); | ||
| 110 | + | ||
| 105 | match self.kind { | 111 | match self.kind { |
| 106 | Kind::Easing { curve } => Self::ease( | 112 | Kind::Easing { curve } => Self::ease( |
| 107 | from, | 113 | from, |