[gnome-control-center/wip/feborges/new-users-panel] user-accounts: Animate UmCarousel arrow
- From: Felipe Borges <felipeborges src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center/wip/feborges/new-users-panel] user-accounts: Animate UmCarousel arrow
- Date: Wed, 21 Dec 2016 10:19:33 +0000 (UTC)
commit ed967039f78bac32092003142623516906c5178b
Author: Felipe Borges <felipeborges gnome org>
Date: Tue Dec 20 19:48:07 2016 +0100
user-accounts: Animate UmCarousel arrow
panels/user-accounts/data/carousel.css | 3 +++
panels/user-accounts/um-carousel.c | 15 ++++++++++++---
2 files changed, 15 insertions(+), 3 deletions(-)
---
diff --git a/panels/user-accounts/data/carousel.css b/panels/user-accounts/data/carousel.css
index ac74c8c..ae000bc 100644
--- a/panels/user-accounts/data/carousel.css
+++ b/panels/user-accounts/data/carousel.css
@@ -12,6 +12,9 @@
.carousel-arrow {
border-bottom-color: @borders;
margin-bottom: -1px;
+ animation-duration: 0.3s;
+/* animation-timing-function: linear;*/
+ animation-fill-mode: forwards;
}
.carousel-inner-arrow {
diff --git a/panels/user-accounts/um-carousel.c b/panels/user-accounts/um-carousel.c
index c07dc39..bd266eb 100644
--- a/panels/user-accounts/um-carousel.c
+++ b/panels/user-accounts/um-carousel.c
@@ -57,6 +57,7 @@ struct _UmCarousel {
UmCarouselItem *selected_item;
GtkWidget *last_box;
GtkWidget *arrow;
+ gint arrow_start_x;
/* Widgets */
GtkStack *stack;
@@ -118,9 +119,14 @@ um_carousel_move_arrow (UmCarousel *self)
gtk_style_context_remove_provider (context, self->provider);
g_clear_object (&self->provider);
- css = g_strdup_printf ("* {\n"
- " margin-left: %dpx;\n"
- "}\n", end_x);
+ css = g_strdup_printf ("@keyframes arrow_keyframes-%d {\n"
+ " from { margin-left: %dpx; }\n"
+ " to { margin-left: %dpx; }\n"
+ "}\n"
+ "* {\n"
+ " animation-name: arrow_keyframes-%d;\n"
+ "}\n", end_x, self->arrow_start_x, end_x, end_x);
+
self->provider = GTK_STYLE_PROVIDER (gtk_css_provider_new ());
gtk_css_provider_load_from_data (GTK_CSS_PROVIDER (self->provider), css, -1, NULL);
@@ -183,6 +189,9 @@ on_item_toggled (UmCarouselItem *item,
{
UmCarousel *self = UM_CAROUSEL (user_data);
+ if (self->selected_item != NULL)
+ self->arrow_start_x = um_carousel_item_get_x (self->selected_item, self);
+
self->selected_item = item;
g_signal_emit (user_data, signals[ITEM_ACTIVATED], 0, item);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]