diff --git a/src/c/main.c b/src/c/main.c index 4fc19a3..ca3635c 100644 --- a/src/c/main.c +++ b/src/c/main.c @@ -67,7 +67,6 @@ static GRect s_bt_grect_b; // declare animation templates static const uint8_t s_animation_duration = 255; -static bool s_first_tick_occurred = false; static Animation *s_head_raise_template; static Animation *s_head_out_template; static Animation *s_head_in_template; @@ -198,7 +197,7 @@ static void minute_handler(struct tm *tick_time, TimeUnits units_changed) { //// calculate new positions s_date_grect_b = GRect(s_ones_offset[ones], s_date_pos_y, s_date_bt_width, s_date_height); s_bt_grect_b = GRect(s_bt_pos_x - s_ones_offset[ones], s_bt_pos_y, s_date_bt_width, s_bt_height); - if (s_first_tick_occurred) { // no need to animate before first tick, as positions are set in init() without animating + if (units_changed) { //// configure animations ////// date PropertyAnimation *date_center_prop = property_animation_create_layer_frame(text_layer_get_layer(s_date_layer), &s_date_grect_a, &s_date_grect_b); @@ -222,15 +221,13 @@ static void minute_handler(struct tm *tick_time, TimeUnits units_changed) { s_bt_grect_a = s_bt_grect_b; } - // animate swaps on half-hour boundaries - if (!s_first_tick_occurred) { - s_first_tick_occurred = true; - return; // do not animate part swaps on first tick - } - if (tick_time->tm_min % 60 == 0) { - schedule_guy_animation(s_head_raise_template, s_head_out_template, s_head_in_template, update_minute_60_out_handler); - } else if (tick_time->tm_min % 30 == 0) { - schedule_guy_animation(s_butt_raise_template, s_butt_out_template, s_butt_in_template, update_minute_30_out_handler); + // animate swaps on half-hour boundaries (but not on first tick) + if (units_changed) { + if (tick_time->tm_min % 60 == 0) { + schedule_guy_animation(s_head_raise_template, s_head_out_template, s_head_in_template, update_minute_60_out_handler); + } else if (tick_time->tm_min % 30 == 0) { + schedule_guy_animation(s_butt_raise_template, s_butt_out_template, s_butt_in_template, update_minute_30_out_handler); + } } }