[gnome-builder] animation: add ease-in-out-cubic
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] animation: add ease-in-out-cubic
- Date: Mon, 7 Mar 2016 23:38:39 +0000 (UTC)
commit 77be8605aa80f1671562fc2644bcc93097bdc93c
Author: Christian Hergert <christian hergert me>
Date: Mon Mar 7 15:36:39 2016 -0800
animation: add ease-in-out-cubic
contrib/egg/egg-animation.c | 23 +++++++++++++++++------
contrib/egg/egg-animation.h | 1 +
2 files changed, 18 insertions(+), 6 deletions(-)
---
diff --git a/contrib/egg/egg-animation.c b/contrib/egg/egg-animation.c
index efed567..276d6cd 100644
--- a/contrib/egg/egg-animation.c
+++ b/contrib/egg/egg-animation.c
@@ -138,6 +138,15 @@ egg_animation_alpha_ease_out_cubic (gdouble offset)
return p * p * p + 1.0;
}
+static gdouble
+egg_animation_alpha_ease_in_out_cubic (gdouble offset)
+{
+ if (offset < .5)
+ return egg_animation_alpha_ease_in_cubic (offset * 2.0) / 2.0;
+ else
+ return .5 + egg_animation_alpha_ease_out_cubic ((offset - .5) * 2.0) / 2.0;
+}
+
/**
* egg_animation_alpha_linear:
@@ -918,6 +927,7 @@ egg_animation_class_init (EggAnimationClass *klass)
SET_ALPHA (EASE_IN_OUT_QUAD, ease_in_out_quad);
SET_ALPHA (EASE_IN_CUBIC, ease_in_cubic);
SET_ALPHA (EASE_OUT_CUBIC, ease_out_cubic);
+ SET_ALPHA (EASE_IN_OUT_CUBIC, ease_in_out_cubic);
#define SET_TWEEN(_T, _t) \
G_STMT_START { \
@@ -965,12 +975,13 @@ egg_animation_mode_get_type (void)
{
static GType type_id = 0;
static const GEnumValue values[] = {
- { EGG_ANIMATION_LINEAR, "EGG_ANIMATION_LINEAR", "LINEAR" },
- { EGG_ANIMATION_EASE_IN_QUAD, "EGG_ANIMATION_EASE_IN_QUAD", "EASE_IN_QUAD" },
- { EGG_ANIMATION_EASE_IN_OUT_QUAD, "EGG_ANIMATION_EASE_IN_OUT_QUAD", "EASE_IN_OUT_QUAD" },
- { EGG_ANIMATION_EASE_OUT_QUAD, "EGG_ANIMATION_EASE_OUT_QUAD", "EASE_OUT_QUAD" },
- { EGG_ANIMATION_EASE_IN_CUBIC, "EGG_ANIMATION_EASE_IN_CUBIC", "EASE_IN_CUBIC" },
- { EGG_ANIMATION_EASE_OUT_CUBIC, "EGG_ANIMATION_EASE_OUT_CUBIC", "EASE_OUT_CUBIC" },
+ { EGG_ANIMATION_LINEAR, "EGG_ANIMATION_LINEAR", "linear" },
+ { EGG_ANIMATION_EASE_IN_QUAD, "EGG_ANIMATION_EASE_IN_QUAD", "ease-in-quad" },
+ { EGG_ANIMATION_EASE_IN_OUT_QUAD, "EGG_ANIMATION_EASE_IN_OUT_QUAD", "ease-in-out-quad" },
+ { EGG_ANIMATION_EASE_OUT_QUAD, "EGG_ANIMATION_EASE_OUT_QUAD", "ease-out-quad" },
+ { EGG_ANIMATION_EASE_IN_CUBIC, "EGG_ANIMATION_EASE_IN_CUBIC", "ease-in-cubic" },
+ { EGG_ANIMATION_EASE_OUT_CUBIC, "EGG_ANIMATION_EASE_OUT_CUBIC", "ease-out-cubic" },
+ { EGG_ANIMATION_EASE_IN_OUT_CUBIC, "EGG_ANIMATION_EASE_IN_OUT_CUBIC", "ease-in-out-cubic" },
{ 0 }
};
diff --git a/contrib/egg/egg-animation.h b/contrib/egg/egg-animation.h
index e4de9dc..62d979e 100644
--- a/contrib/egg/egg-animation.h
+++ b/contrib/egg/egg-animation.h
@@ -39,6 +39,7 @@ enum _EggAnimationMode
EGG_ANIMATION_EASE_IN_OUT_QUAD,
EGG_ANIMATION_EASE_IN_CUBIC,
EGG_ANIMATION_EASE_OUT_CUBIC,
+ EGG_ANIMATION_EASE_IN_OUT_CUBIC,
EGG_ANIMATION_LAST
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]