[libadwaita/wip/exalm/tabs: 11/19] animation: Add adw_ease_in_out_cubic()




commit 4f377fc1ccfc97584e6d4b7ea9e0f627620fe1e9
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 4554a4a..66d97bf 100644
--- a/src/adw-animation-private.h
+++ b/src/adw-animation-private.h
@@ -46,5 +46,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 d3cd1ab..7db291b 100644
--- a/src/adw-animation.c
+++ b/src/adw-animation.c
@@ -274,3 +274,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]