Description
How to solve the problem of animation lag caused by excessive cupping in animation
What MCU/Processor/Board and compiler are you using?
Xilinx mpsoc
What LVGL version are you using?
8.3.3
What do you want to achieve?
What have you tried so far?
Change the function writing lv_obj_set_style and lv_obj_add_style There is not much difference in style
Code to reproduce
Add a code snippet which can run in the simulator. It should contain only the relevant code that compiles without errors when separated from your main code base.
The code block(s) should be formatted like:
void my_runway(RUNWAY *runway,int x,int y)
{
// static lv_style_t style_bg_arc;
// lv_style_init(&style_bg_arc);
// lv_style_set_arc_color(&style_bg_arc,lv_color_white());
// lv_style_set_arc_width(&style_bg_arc,2);
// static lv_style_t style_indicator_arc;
// lv_style_init(&style_indicator_arc);
// lv_style_set_arc_color(&style_indicator_arc,lv_color_make(0xff,0,0));
// lv_style_set_arc_width(&style_indicator_arc,2);
// static lv_style_t style_bg_slider;
// lv_style_init(&style_bg_slider);
// lv_style_set_bg_opa(&style_bg_slider, LV_OPA_COVER);
// lv_style_set_bg_color(&style_bg_slider, lv_color_white());
// lv_style_set_radius(&style_bg_slider, 0);
// static lv_style_t style_indicator_slider;
// lv_style_init(&style_indicator_slider);
// lv_style_set_bg_opa(&style_indicator_slider, LV_OPA_COVER);
// lv_style_set_bg_color(&style_indicator_slider, lv_color_make(0xff,0,0));
// lv_style_set_radius(&style_indicator_slider, 0);
// static lv_style_t style_bg_slider_1;
// lv_style_init(&style_bg_slider_1);
// lv_style_set_bg_opa(&style_bg_slider_1, LV_OPA_COVER);
// lv_style_set_bg_color(&style_bg_slider_1, lv_color_make(0xff,0,0));
// lv_style_set_radius(&style_bg_slider_1, 0);
// static lv_style_t style_indicator_slider_1;
// lv_style_init(&style_indicator_slider_1);
// lv_style_set_bg_opa(&style_indicator_slider_1, LV_OPA_COVER);
// lv_style_set_bg_color(&style_indicator_slider_1, lv_color_white());
// lv_style_set_radius(&style_indicator_slider_1, 0);
// static lv_style_t style_btn;
// lv_style_init(&style_btn);
// lv_style_set_radius(&style_btn, 100);
// lv_style_set_bg_opa(&style_btn, 160);
// lv_style_set_bg_color(&style_btn, lv_color_black());
// lv_style_set_outline_width(&style_btn, 0);
// lv_style_set_shadow_opa(&style_btn, 0);
// lv_style_set_outline_color(&style_btn, lv_palette_main(LV_PALETTE_BLUE));
// lv_style_set_outline_pad(&style_btn, 8);
lv_obj_set_size(runway->btn_1,x,y);
lv_obj_set_style_radius(runway->btn_1,100,0);
lv_obj_set_style_bg_opa(runway->btn_1,160,0);
lv_obj_set_style_bg_color(runway->btn_1,lv_color_black(),0);
lv_obj_set_style_shadow_opa(runway->btn_1,0,0);
lv_obj_set_style_outline_width(runway->btn_1,0,LV_STATE_FOCUS_KEY);
lv_obj_set_size(runway->arc_1,(y+5), (y+5));
lv_arc_set_rotation(runway->arc_1, 90);
lv_arc_set_bg_angles(runway->arc_1, 0, 180);
lv_arc_set_value(runway->arc_1, 100);
lv_obj_align_to(runway->arc_1,runway->btn_1,LV_ALIGN_OUT_LEFT_MID,(y+5),0);
lv_obj_remove_style(runway->arc_1,NULL,LV_PART_KNOB);
lv_arc_set_range(runway->arc_1,0,50);
lv_arc_set_value(runway->arc_1,8);
lv_obj_set_style_arc_color(runway->arc_1,lv_color_white(),LV_PART_MAIN);
lv_obj_set_style_arc_width(runway->arc_1,2,LV_PART_MAIN);
lv_obj_set_style_arc_color(runway->arc_1,lv_color_make(0xff,0,0),LV_PART_INDICATOR);
lv_obj_set_style_arc_width(runway->arc_1,2,LV_PART_INDICATOR);
lv_obj_set_style_radius(runway->arc_1,0,0);
lv_obj_set_style_radius(runway->arc_1,0,LV_PART_INDICATOR);
lv_obj_clear_flag(runway->arc_1,LV_OBJ_FLAG_CLICKABLE);
lv_obj_set_size(runway->arc_2, (y+5), (y+5));
lv_arc_set_rotation(runway->arc_2, 270);
lv_arc_set_bg_angles(runway->arc_2, 0, 180);
lv_obj_align_to(runway->arc_2,runway->btn_1,LV_ALIGN_OUT_RIGHT_MID,-(y+5),0);
lv_obj_remove_style(runway->arc_2,NULL,LV_PART_KNOB);
lv_arc_set_range(runway->arc_2,200,250);
lv_obj_set_style_arc_color(runway->arc_2,lv_color_white(),LV_PART_MAIN);
lv_obj_set_style_arc_width(runway->arc_2,2,LV_PART_MAIN);
lv_obj_set_style_arc_color(runway->arc_2,lv_color_make(0xff,0,0),LV_PART_INDICATOR);
lv_obj_set_style_arc_width(runway->arc_2,2,LV_PART_INDICATOR);
lv_obj_set_style_radius(runway->arc_2,0,0);
lv_obj_set_style_radius(runway->arc_2,0,LV_PART_INDICATOR);
lv_obj_clear_flag(runway->arc_2,LV_OBJ_FLAG_CLICKABLE);
lv_obj_remove_style_all(runway->slider_1); /*Remove the styles coming from the theme*/
//lv_slider_set_value(runway->slider_1,50,0);
lv_obj_set_height(runway->slider_1,2);
lv_obj_set_width(runway->slider_1,(x-y));
lv_obj_align_to(runway->slider_1,runway->btn_1,LV_ALIGN_OUT_TOP_MID,0,0);
lv_slider_set_range(runway->slider_1,50,200);
lv_obj_set_style_bg_color(runway->slider_1,lv_color_white(),LV_PART_MAIN);
lv_obj_set_style_radius(runway->slider_1,0,LV_PART_MAIN);
lv_obj_set_style_bg_opa(runway->slider_1,LV_OPA_COVER,LV_PART_MAIN);
lv_obj_set_style_bg_color(runway->slider_1,lv_color_make(0xff,0,0),LV_PART_INDICATOR);
lv_obj_set_style_radius(runway->slider_1,0,LV_PART_INDICATOR);
lv_obj_set_style_bg_opa(runway->slider_1,LV_OPA_COVER,LV_PART_INDICATOR);
lv_obj_clear_flag(runway->slider_1,LV_OBJ_FLAG_CLICKABLE);
lv_obj_remove_style_all(runway->slider_2); /*Remove the styles coming from the theme*/
lv_obj_set_height(runway->slider_2,2);
lv_obj_set_width(runway->slider_2,(x-y));
lv_obj_align_to(runway->slider_2,runway->btn_1,LV_ALIGN_OUT_BOTTOM_MID,0,0);
lv_slider_set_range(runway->slider_2,250,400);
lv_slider_set_value(runway->slider_2,400,0);
lv_obj_set_style_bg_color(runway->slider_2,lv_color_make(0xff,0,0),LV_PART_MAIN);
lv_obj_set_style_radius(runway->slider_2,0,LV_PART_MAIN);
lv_obj_set_style_bg_opa(runway->slider_2,LV_OPA_COVER,LV_PART_MAIN);
lv_obj_set_style_bg_color(runway->slider_2,lv_color_white(),LV_PART_INDICATOR);
lv_obj_set_style_radius(runway->slider_2,0,LV_PART_INDICATOR);
lv_obj_set_style_bg_opa(runway->slider_2,LV_OPA_COVER,LV_PART_INDICATOR);
lv_obj_clear_flag(runway->slider_2,LV_OBJ_FLAG_CLICKABLE);
lv_obj_set_style_text_color(runway->label_1,lv_color_white(),0);
lv_obj_set_style_text_font(runway->label_1,&lv_open_sans_28,0);
lv_label_set_text(runway->label_1,"AaBbCc");
lv_obj_set_style_text_color(runway->label_2,lv_palette_main(LV_PALETTE_RED),0);
lv_obj_set_style_text_font(runway->label_2,&lv_open_sans_28,0);
lv_label_set_text(runway->label_2,"xxx");
lv_obj_align(runway->label_2,LV_ALIGN_RIGHT_MID,-25,0);
}
static void creat_btn_ex(int i,lv_align_t align,lv_coord_t x_ofs, lv_coord_t y_ofs)
{
b[i] = NULL;
b[i] = (RUNWAY*)malloc(sizeof(RUNWAY));
if (b[i] == NULL){return;}
memset(b[i], 0, sizeof(RUNWAY));
b[i]->btn_1=lv_btn_create(cur_scr_act);
b[i]->label_1=lv_label_create(b[i]->btn_1);
b[i]->label_2=lv_label_create(b[i]->btn_1);
b[i]->arc_1=lv_arc_create(cur_scr_act);
b[i]->arc_2=lv_arc_create(cur_scr_act);
b[i]->slider_1=lv_slider_create(cur_scr_act);
b[i]->slider_2=lv_slider_create(cur_scr_act);
lv_obj_remove_style_all(b[i]->btn_1);
lv_obj_align(b[i]->btn_1,align,x_ofs,y_ofs);
my_runway(b[i],460,70);
lv_obj_align(b[i]->label_1,LV_ALIGN_LEFT_MID,20,0);
}
void anim_x_s(RUNWAY *runways,const char *text)
{
runways->initial_label=lv_label_create(runways->btn_1);
lv_obj_set_style_text_color(runways->initial_label,lv_color_white(),0);
lv_obj_set_style_text_font(runways->initial_label,&lv_open_sans_28,0);
lv_label_set_text(runways->initial_label,text);
lv_obj_align(runways->initial_label,LV_ALIGN_CENTER,0,0);
lv_anim_t a1;
lv_anim_init(&a1);
lv_anim_set_var(&a1, runways->arc_2);
lv_anim_set_values(&a1, 400, 12);
lv_anim_set_path_cb(&a1, lv_anim_path_linear);
lv_anim_set_exec_cb(&a1, anim_x_cb);
lv_anim_set_time(&a1, 500);
lv_anim_start(&a1);
lv_anim_init(&a1);
lv_anim_set_var(&a1, runways->btn_1);
lv_anim_set_values(&a1, 470, 75);
lv_anim_set_early_apply(&a1, false);
lv_anim_set_exec_cb(&a1, (lv_anim_exec_xcb_t)set_width);
lv_anim_set_path_cb(&a1, lv_anim_path_linear);
lv_anim_set_time(&a1, 500);
lv_anim_start(&a1);
lv_anim_init(&a1);
lv_anim_set_var(&a1, runways->slider_1);
lv_anim_set_values(&a1, 400, 0);
lv_anim_set_early_apply(&a1, false);
lv_anim_set_exec_cb(&a1, (lv_anim_exec_xcb_t)set_width);
lv_anim_set_path_cb(&a1, lv_anim_path_linear);
lv_anim_set_time(&a1, 500);
lv_anim_start(&a1);
lv_anim_init(&a1);
lv_anim_set_var(&a1, runways->slider_2);
lv_anim_set_values(&a1, 400, 0);
lv_anim_set_early_apply(&a1, false);
lv_anim_set_exec_cb(&a1, (lv_anim_exec_xcb_t)set_width);
lv_anim_set_path_cb(&a1, lv_anim_path_linear);
lv_anim_set_time(&a1, 500);
lv_anim_start(&a1);
}
typedef struct MY_RUNWAY{
unsigned int i_1;
unsigned int i_2;
unsigned int i_3;
unsigned int i_4;
void *p;
lv_obj_t *btn_1;
lv_obj_t *arc_1;
lv_obj_t *arc_2;
lv_obj_t *label_1;
lv_obj_t *label_2;
lv_obj_t *initial_label;
lv_obj_t *slider_1;
lv_obj_t *slider_2;
}RUNWAY;
static RUNWAY *b[100];
void live_view(lv_disp_t * disp)
{
// pull_result_flag=0;
cur_scr_act = lv_disp_get_scr_act(disp);
lv_obj_clean(cur_scr_act);
lv_obj_set_style_bg_opa(cur_scr_act,0,0);
lv_obj_clear_flag(cur_scr_act,LV_OBJ_FLAG_SCROLLABLE);
// lv_obj_set_style_bg_color(cur_scr_act,lv_color_make(64,64,64),0);
creat_btn_ex(1,LV_ALIGN_TOP_LEFT,10,55);
creat_btn_ex(2,LV_ALIGN_TOP_LEFT,10,55+180);
creat_btn_ex(3,LV_ALIGN_TOP_LEFT,10,55+180*2);
creat_btn_ex(4,LV_ALIGN_TOP_LEFT,10,55+180*3);
creat_btn_ex(5,LV_ALIGN_TOP_RIGHT,-10,55);
creat_btn_ex(6,LV_ALIGN_TOP_RIGHT,-10,55+180);
creat_btn_ex(7,LV_ALIGN_TOP_RIGHT,-10,55+180*2);
creat_btn_ex(8,LV_ALIGN_TOP_RIGHT,-10,55+180*3);
lv_label_set_text(b[1]->label_1,"Exp. Mode");
b[1]->i_1=0;
b[1]->i_2=10;
b[1]->i_4=0;
b[1]->p=&(SHUTTER_LIMIT);
lv_label_set_text(b[1]->label_2,"Auto");
lv_obj_add_event_cb(b[1]->btn_1,event_handler_ex_q1,46,b[1]);
lv_obj_add_event_cb(b[1]->btn_1,event_handler_ex_q1,47,b[1]);
lv_label_set_text(b[2]->label_1,"WB Mode");
b[2]->i_1=0;
b[2]->i_2=47;
b[2]->i_4=1;
char buf[50];
lv_label_set_recolor(b[2]->label_2, true);
// lv_snprintf(buf,sizeof(buf),"#ff0000 %d# #ffffff / %s#",b[2]->i_1,"48");
// lv_label_set_text(b[2]->label_2,buf);
lv_label_set_text(b[2]->label_2,"OPW");
lv_obj_add_event_cb(b[2]->btn_1,event_handler_ex_q2,46,b[2]);
lv_obj_add_event_cb(b[2]->btn_1,event_handler_ex_q2,47,b[2]);
lv_label_set_text(b[3]->label_1,"GAMMA");
b[3]->i_1=0;
b[3]->i_2=3;
b[3]->i_4=1;
b[3]->p=&(GAIN_LIMIT);
lv_label_set_recolor(b[3]->label_2, true);
// lv_snprintf(buf,sizeof(buf),"#ff0000 %s# #ffffff / %s#",*(GAIN_LIMIT+b[3]->i_1),"36dB");
// lv_label_set_text(b[3]->label_2,buf);
lv_label_set_text(b[3]->label_2,"STD");
lv_obj_add_event_cb(b[3]->btn_1,event_handler_ex_q1,46,b[3]);
lv_obj_add_event_cb(b[3]->btn_1,event_handler_ex_q1,47,b[3]);
lv_label_set_text(b[4]->label_1,"Black. Level");
b[4]->i_1=0;
b[4]->i_2=9;
b[4]->i_4=1;
b[4]->p=&(POINT_POSITION);
lv_label_set_recolor(b[4]->label_2, true);
// lv_snprintf(buf,sizeof(buf),"#ff0000 %s# #ffffff / %s#",*(POINT_POSITION+b[4]->i_1),"27dB");
// lv_label_set_text(b[4]->label_2,buf);
lv_label_set_text(b[4]->label_2,"5");
lv_obj_add_event_cb(b[4]->btn_1,event_handler_ex_q1,46,b[4]);
lv_obj_add_event_cb(b[4]->btn_1,event_handler_ex_q1,47,b[4]);
lv_label_set_text(b[5]->label_1,"HDMI Output");
b[5]->i_1=0;
b[5]->i_2=13;
b[5]->i_4=0;
b[5]->p=&(MAX_SPEED);
// lv_snprintf(buf,sizeof(buf),"%s / %s",*(MAX_SPEED+b[5]->i_1),"1/10k");
// lv_label_set_text(b[5]->label_2,buf);
lv_label_set_text(b[5]->label_2,"2160P60");
// lv_label_set_text(b[5]->label_3,"1/10k");
// anim_value(b[5]->slider_1,b[5]->slider_2,b[5]->arc_2,(b[5]->i_1*(100/13)));
lv_obj_add_event_cb(b[5]->btn_1,event_handler_ex_q1,46,b[5]);
lv_obj_add_event_cb(b[5]->btn_1,event_handler_ex_q1,47,b[5]);
lv_label_set_text(b[6]->label_1,"SDI Output");
b[6]->i_1=0;
b[6]->i_2=9;
b[6]->i_4=0;
b[6]->p=&(MIN_SPEED);
// lv_snprintf(buf,sizeof(buf),"%s / %s",*(MIN_SPEED+b[6]->i_1),"1/500");
// lv_label_set_text(b[6]->label_2,buf);
lv_label_set_text(b[6]->label_2,"1080P60");
// lv_label_set_text(b[6]->label_3,"1/500");
// anim_value(b[6]->slider_1,b[6]->slider_2,b[6]->arc_2,(b[6]->i_1*(100/9)));
lv_obj_add_event_cb(b[6]->btn_1,event_handler_ex_q1,46,b[6]);
lv_obj_add_event_cb(b[6]->btn_1,event_handler_ex_q1,47,b[6]);
lv_label_set_text(b[7]->label_1,"Audio");
b[7]->i_1=10;
b[7]->i_2=13;
b[7]->i_4=0;
b[7]->p=&(MAX_SPEED);
// lv_snprintf(buf,sizeof(buf),"%s / %s",*(MAX_SPEED+b[7]->i_1),c);
// lv_label_set_text(b[7]->label_2,buf);
lv_label_set_text(b[7]->label_2,"12dB");
// lv_label_set_text(b[7]->label_3,"1/10k");
// anim_value(b[7]->slider_1,b[7]->slider_2,b[7]->arc_2,(b[7]->i_1*(100/13)));
lv_obj_add_event_cb(b[7]->btn_1,event_handler_ex_q1,46,b[7]);
lv_obj_add_event_cb(b[7]->btn_1,event_handler_ex_q1,47,b[7]);
lv_label_set_text(b[8]->label_1,"Preset Speed");
b[8]->i_1=8;
b[8]->i_2=9;
b[8]->i_4=0;
b[8]->p=&(MIN_SPEED);
// lv_snprintf(buf,sizeof(buf),"%s / %s",*(MIN_SPEED+b[8]->i_1),"1/500");
// lv_label_set_text(b[8]->label_2,buf);
lv_label_set_text(b[8]->label_2,"5");
// lv_label_set_text(b[8]->label_3,"1/500");
// anim_value(b[8]->slider_1,b[8]->slider_2,b[8]->arc_2,(b[8]->i_1*(100/9)));
lv_obj_add_event_cb(b[8]->btn_1,event_handler_ex_q1,46,b[8]);
lv_obj_add_event_cb(b[8]->btn_1,event_handler_ex_q1,47,b[8]);
lv_obj_add_flag(b[1]->label_1,LV_OBJ_FLAG_HIDDEN);
lv_obj_add_flag(b[1]->label_2,LV_OBJ_FLAG_HIDDEN);
b[1]->i_3=0;
anim_x_s(b[1],"S");
lv_obj_add_event_cb(b[1]->btn_1,left_spread_event_handler,47,b[1]);
lv_obj_add_flag(b[2]->label_1,LV_OBJ_FLAG_HIDDEN);
lv_obj_add_flag(b[2]->label_2,LV_OBJ_FLAG_HIDDEN);
b[2]->i_3=1;
anim_x_s(b[2],"A");
lv_obj_add_event_cb(b[2]->btn_1,left_spread_event_handler,47,b[2]);
lv_obj_add_flag(b[3]->label_1,LV_OBJ_FLAG_HIDDEN);
lv_obj_add_flag(b[3]->label_2,LV_OBJ_FLAG_HIDDEN);
b[3]->i_3=1;
anim_x_s(b[3],"G");
lv_obj_add_event_cb(b[3]->btn_1,left_spread_event_handler,47,b[3]);
lv_obj_add_flag(b[4]->label_1,LV_OBJ_FLAG_HIDDEN);
lv_obj_add_flag(b[4]->label_2,LV_OBJ_FLAG_HIDDEN);
b[4]->i_3=1;
anim_x_s(b[4],"P");
lv_obj_add_event_cb(b[4]->btn_1,left_spread_event_handler,47,b[4]);
lv_obj_add_flag(b[5]->label_1,LV_OBJ_FLAG_HIDDEN);
lv_obj_add_flag(b[5]->label_2,LV_OBJ_FLAG_HIDDEN);
b[5]->i_3=1;
anim_x_s_1(b[5],"H");
lv_obj_add_event_cb(b[5]->btn_1,right_spread_event_handler,47,b[5]);
lv_obj_add_flag(b[6]->label_1,LV_OBJ_FLAG_HIDDEN);
lv_obj_add_flag(b[6]->label_2,LV_OBJ_FLAG_HIDDEN);
b[6]->i_3=1;
anim_x_s_1(b[6],"S");
lv_obj_add_event_cb(b[6]->btn_1,right_spread_event_handler,47,b[6]);
lv_obj_add_flag(b[7]->label_1,LV_OBJ_FLAG_HIDDEN);
lv_obj_add_flag(b[7]->label_2,LV_OBJ_FLAG_HIDDEN);
b[7]->i_3=1;
anim_x_s_1(b[7],"A");
lv_obj_add_event_cb(b[7]->btn_1,right_spread_event_handler,47,b[7]);
lv_obj_add_flag(b[8]->label_1,LV_OBJ_FLAG_HIDDEN);
lv_obj_add_flag(b[8]->label_2,LV_OBJ_FLAG_HIDDEN);
b[8]->i_3=1;
anim_x_s_1(b[8],"P");
lv_obj_add_event_cb(b[8]->btn_1,right_spread_event_handler,47,b[8]);
}
The coordinates of the print button before and after screen rotation are the same, and they are the first entity button used.How many coordinates should I set in points_array
Screenshot and/or video
If possible, add screenshots and/or videos about the current state.
Normal
@embeddedt @kisvegabor
Can give me some advice? Thank in advance