diff --git a/demos/widgets/lv_demo_widgets.c b/demos/widgets/lv_demo_widgets.c index 690b3f710..df3dc1f56 100644 --- a/demos/widgets/lv_demo_widgets.c +++ b/demos/widgets/lv_demo_widgets.c @@ -857,7 +857,7 @@ static void analytics_create(lv_obj_t * parent) lv_anim_set_values(&a, 10, 60); lv_anim_set_repeat_count(&a, LV_ANIM_REPEAT_INFINITE); lv_anim_set_exec_cb(&a, scale3_anim_cb); - lv_anim_set_var(&a, needle); + lv_anim_set_var(&a, scale3); lv_anim_set_time(&a, 4100); lv_anim_set_playback_time(&a, 800); lv_anim_start(&a); @@ -1615,12 +1615,10 @@ static void scale2_timer_cb(lv_timer_t * timer) static void scale3_anim_cb(void * var, int32_t v) { - LV_UNUSED(var); + lv_obj_t * needle = lv_obj_get_child(var, 0); + lv_scale_set_image_needle_value(var, needle, v); - lv_obj_t * needle = lv_obj_get_child(scale3, 0); - lv_scale_set_image_needle_value(scale3, needle, v); - - lv_obj_t * label = lv_obj_get_child(scale3, 1); + lv_obj_t * label = lv_obj_get_child(var, 1); lv_label_set_text_fmt(label, "%"LV_PRId32, v); } diff --git a/examples/widgets/scale/lv_example_scale_3.c b/examples/widgets/scale/lv_example_scale_3.c index fa53093b0..59b84803f 100644 --- a/examples/widgets/scale/lv_example_scale_3.c +++ b/examples/widgets/scale/lv_example_scale_3.c @@ -29,7 +29,7 @@ void lv_example_scale_3(void) lv_obj_set_style_bg_color(scale_line, lv_palette_lighten(LV_PALETTE_RED, 5), 0); lv_obj_set_style_radius(scale_line, LV_RADIUS_CIRCLE, 0); lv_obj_set_style_clip_corner(scale_line, true, 0); - lv_obj_align(scale_line, LV_ALIGN_LEFT_MID, LV_PCT(5), 0); + lv_obj_align(scale_line, LV_ALIGN_LEFT_MID, LV_PCT(2), 0); lv_scale_set_label_show(scale_line, true); @@ -65,7 +65,7 @@ void lv_example_scale_3(void) lv_obj_set_style_bg_color(scale_img, lv_palette_lighten(LV_PALETTE_RED, 5), 0); lv_obj_set_style_radius(scale_img, LV_RADIUS_CIRCLE, 0); lv_obj_set_style_clip_corner(scale_img, true, 0); - lv_obj_align(scale_img, LV_ALIGN_RIGHT_MID, LV_PCT(-5), 0); + lv_obj_align(scale_img, LV_ALIGN_RIGHT_MID, LV_PCT(-2), 0); lv_scale_set_label_show(scale_img, true);