[libadwaita/wip/exalm/tabs: 4/12] animation: Add adw_ease_in_out_cubic()




commit 6c386098c9e5966b9e362c44c6390a8187c853d3
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Tue Jan 26 20:54:54 2021 +0500

    animation: Add adw_ease_in_out_cubic()

 src/adw-animation-private.h |  1 +
 src/adw-animation.c         | 13 +++++++++++++
 2 files changed, 14 insertions(+)
---
diff --git a/src/adw-animation-private.h b/src/adw-animation-private.h
index c273580..3e0591a 100644
--- a/src/adw-animation-private.h
+++ b/src/adw-animation-private.h
@@ -47,5 +47,6 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (AdwAnimation, adw_animation_unref)
 
 double adw_lerp (double a, double b, double t);
 double adw_ease_in_cubic (double t);
+double adw_ease_in_out_cubic (double t);
 
 G_END_DECLS
diff --git a/src/adw-animation.c b/src/adw-animation.c
index fcddea1..0ec6bad 100644
--- a/src/adw-animation.c
+++ b/src/adw-animation.c
@@ -282,3 +282,16 @@ adw_ease_in_cubic (gdouble t)
 {
   return t * t * t;
 }
+
+double
+adw_ease_in_out_cubic (double t)
+{
+  double p = t * 2;
+
+  if (p < 1)
+    return 0.5 * p * p * p;
+
+  p -= 2;
+
+  return 0.5 * (p * p * p + 2);
+}


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