[libhandy] animation: Add hdy_ease_in_out_cubic()



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

    animation: Add hdy_ease_in_out_cubic()

 src/hdy-animation-private.h |  1 +
 src/hdy-animation.c         | 13 +++++++++++++
 2 files changed, 14 insertions(+)
---
diff --git a/src/hdy-animation-private.h b/src/hdy-animation-private.h
index a24f3daa..6cbc198e 100644
--- a/src/hdy-animation-private.h
+++ b/src/hdy-animation-private.h
@@ -46,5 +46,6 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (HdyAnimation, hdy_animation_unref)
 
 gdouble hdy_lerp (gdouble a, gdouble b, gdouble t);
 gdouble hdy_ease_in_cubic (gdouble t);
+gdouble hdy_ease_in_out_cubic (gdouble t);
 
 G_END_DECLS
diff --git a/src/hdy-animation.c b/src/hdy-animation.c
index db71612a..01065e59 100644
--- a/src/hdy-animation.c
+++ b/src/hdy-animation.c
@@ -254,3 +254,16 @@ hdy_ease_in_cubic (gdouble t)
 {
   return t * t * t;
 }
+
+gdouble
+hdy_ease_in_out_cubic (gdouble 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]