[libadwaita/wip/exalm/spring-animation-swipes: 23/36] fix velocity




commit 1aa5d91023b0e97dd1c4fdb96dbe9d8a41762c1a
Author: Manuel Genovés <manuel genoves gmail com>
Date:   Sat Dec 4 20:42:34 2021 +0100

    fix velocity

 src/adw-spring-animation.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/src/adw-spring-animation.c b/src/adw-spring-animation.c
index 4bf28a88..717d16f8 100644
--- a/src/adw-spring-animation.c
+++ b/src/adw-spring-animation.c
@@ -78,8 +78,9 @@ oscillate (AdwAnimation *animation,
 
   double envelope = exp (-beta * t);
 
+  /* Transformation so the velocity is in the same units as value_from and value_to */
   if (!G_APPROX_VALUE (self->value_from, self->value_to, FLT_EPSILON))
-    v0 = self->initial_velocity / (ABS (self->value_from - self->value_to));
+    v0 = self->initial_velocity / (self->value_from - self->value_to);
 
   /*
    * Solutions of the form C1*e^(lambda1*x) + C2*e^(lambda2*x)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]