[libdazzle] animation: cleanup ease in/out cubic
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libdazzle] animation: cleanup ease in/out cubic
- Date: Fri, 4 Aug 2017 17:05:13 +0000 (UTC)
commit 6adad4c4c5c245cfc8e8add1f7656317f059bb60
Author: Christian Hergert <chergert redhat com>
Date: Fri Aug 4 10:04:35 2017 -0700
animation: cleanup ease in/out cubic
src/animation/dzl-animation.c | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/src/animation/dzl-animation.c b/src/animation/dzl-animation.c
index 7e74bf0..aa0d1c5 100644
--- a/src/animation/dzl-animation.c
+++ b/src/animation/dzl-animation.c
@@ -143,10 +143,12 @@ dzl_animation_alpha_ease_out_cubic (gdouble offset)
static gdouble
dzl_animation_alpha_ease_in_out_cubic (gdouble offset)
{
- if (offset < .5)
- return dzl_animation_alpha_ease_in_cubic (offset * 2.0) / 2.0;
- else
- return .5 + dzl_animation_alpha_ease_out_cubic ((offset - .5) * 2.0) / 2.0;
+ gdouble p = offset * 2.0;
+
+ if (p < 1.0)
+ return 0.5 * p * p * p;
+ p -= 2.0;
+ return 0.5 * (p * p * p + 2.0);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]