Description
I want to place events for animation and arc value change.
What MCU/Processor/Board and compiler are you using?
Simulator Code Blocks
What LVGL version are you using?
V8
What do you want to achieve?
Change screen in animation finish time.
Code to reproduce
static void set_angle(void * obj, int32_t v)
{
lv_arc_set_value(obj, v);
}
static void arc_event_cb(lv_event_t * e)
{
lv_event_code_t code = lv_event_get_code(e);
if (code == LV_EVENT_READY)
CreateScreenMain();
}
static void button_event_cb(lv_event_t * e)
{
lv_event_code_t code = lv_event_get_code(e);
if(code == LV_EVENT_CLICKED)
CreateScreenMain();
}
lv_obj_t* CreateScreenLoading(void)
{
lv_obj_t *Screenloading = lv_obj_create(NULL);
lv_scr_load(Screenloading);
lv_obj_t * btn = lv_btn_create(Screenloading);
lv_obj_set_size(btn, 100, 50);
lv_obj_center(btn);
lv_obj_add_event_cb(btn, button_event_cb, LV_EVENT_CLICKED, NULL);
lv_obj_t * label = lv_label_create(btn);
lv_label_set_text(label, "Load Page");
lv_obj_center(label);
lv_obj_t * arc = lv_arc_create(Screenloading);
lv_arc_set_rotation(arc, 270);
lv_arc_set_bg_angles(arc, 0, 360);
lv_obj_remove_style(arc, NULL, LV_PART_KNOB);
lv_obj_clear_flag(arc, LV_OBJ_FLAG_CLICKABLE);
lv_obj_center(arc);
lv_obj_set_size(arc,400,400);
lv_anim_t a;
lv_anim_init(&a);
lv_anim_set_var(&a, arc);
lv_anim_set_exec_cb(&a, set_angle);
lv_anim_set_time(&a, 1000);
lv_anim_start(&a);
lv_obj_add_event_cb(&a,arc_event_cb,LV_EVENT_ALL,NULL);
return Screenloading;
}
The event for the button is working, but the other event doesn’t. Where is the problem?