1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-28 07:03:00 +08:00

chore(demo): switch scale animation objects (#4951)

Signed-off-by: lhdjply <lhdjply@126.com>
This commit is contained in:
lhdjply 2023-12-08 03:23:36 +08:00 committed by GitHub
parent 892eca9008
commit f717462532
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 8 deletions

View File

@ -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);
}

View File

@ -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);