aboutsummaryrefslogtreecommitdiff
path: root/src/comet.c
diff options
context:
space:
mode:
authorFederico Angelilli <code@fedang.net>2024-03-17 15:20:03 +0100
committerFederico Angelilli <code@fedang.net>2024-03-17 15:20:03 +0100
commit44a9ccb0ca18314016ef10b4b1b1c7c958d9eabc (patch)
tree459cb397c045685a0fca59b1edf849965888f52f /src/comet.c
parent6e6992ec09edf79ef2cdcaf249e31809cf7d3145 (diff)
Add group grow animation
Diffstat (limited to 'src/comet.c')
-rw-r--r--src/comet.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/comet.c b/src/comet.c
index b417489..b6c40fd 100644
--- a/src/comet.c
+++ b/src/comet.c
@@ -210,16 +210,14 @@ static void menu_action(Button *btn)
button_simple_set_text(btn, g_strdup(menu_ctx->strings[to_open]), CAST(btn, ButtonSimple)->text_color);
- if (!to_open) {
- Animation *shrink = animation_group_shrink_create(MILLIS(600));
-
- if (button_set_animation((gpointer)menu_ctx->group, shrink))
- state_request_animation(menu_ctx->state);
- else
- animation_destroy(shrink);
- } else {
- state_request_redraw(menu_ctx->state, true);
- }
+ Animation *anim = to_open
+ ? animation_group_grow_create(MILLIS(600))
+ : animation_group_shrink_create(MILLIS(600));
+
+ if (button_set_animation((gpointer)menu_ctx->group, anim))
+ state_request_animation(menu_ctx->state);
+ else
+ animation_destroy(anim);
}
static void register_buttons(State *state, Color color, Color text_color, Color line_color, int line_w)