Skip to content

Commit

Permalink
animation: Scale initial velocity by slowdown
Browse files Browse the repository at this point in the history
  • Loading branch information
YaLTeR committed Apr 18, 2024
1 parent 0fcd981 commit 0b93c46
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/animation/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 0b93c46

Please sign in to comment.