From 3c430cd784211e25292fbb3263bc7c36291001e2 Mon Sep 17 00:00:00 2001 From: Themba Dube Date: Sun, 5 Jan 2020 12:57:15 -0500 Subject: [PATCH] Patch case where animation end frame is smaller than start frame --- src/lv_objx/lv_bar.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/lv_objx/lv_bar.c b/src/lv_objx/lv_bar.c index ef5cdbb5d..07db53239 100644 --- a/src/lv_objx/lv_bar.c +++ b/src/lv_objx/lv_bar.c @@ -519,6 +519,9 @@ static void draw_indic(lv_obj_t * bar, const lv_area_t * clip_area, lv_design_mo (int32_t)((int32_t)anim_length * (ext->start_value_anim.anim_end - ext->min_value)) / range; anim_start_value_x = (((anim_start_value_end_x - anim_start_value_start_x) * ext->start_value_anim.anim_state) >> LV_BAR_ANIM_STATE_NORM); + + if(anim_start_value_x < 0) + anim_start_value_x += anim_start_value_start_x; } else #endif { @@ -533,6 +536,9 @@ static void draw_indic(lv_obj_t * bar, const lv_area_t * clip_area, lv_design_mo (int32_t)((int32_t)anim_length * (ext->cur_value_anim.anim_end - ext->min_value)) / range; anim_cur_value_x = (((anim_cur_value_end_x - anim_cur_value_start_x) * ext->cur_value_anim.anim_state) >> LV_BAR_ANIM_STATE_NORM); + + if(anim_cur_value_x < 0) + anim_cur_value_x += anim_cur_value_start_x; } else #endif {