From 44a9ccb0ca18314016ef10b4b1b1c7c958d9eabc Mon Sep 17 00:00:00 2001 From: Federico Angelilli Date: Sun, 17 Mar 2024 15:20:03 +0100 Subject: Add group grow animation --- src/comet.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'src/comet.c') 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) -- cgit v1.2.3