anim path reworked + minor changes

This commit is contained in:
Gabor Kiss-Vamosi
2017-12-17 01:54:09 +01:00
parent 7dad802981
commit f242eba9c1
23 changed files with 108 additions and 110 deletions

View File

@@ -135,7 +135,7 @@ void lv_bar_set_value_anim(lv_obj_t * bar, int16_t value, uint16_t anim_time)
a.start = ext->cur_value;
a.end = new_value;
a.fp = (lv_anim_fp_t)lv_bar_set_value;
a.path = lv_anim_get_path(LV_ANIM_PATH_LIN);
a.path = lv_anim_path_linear;
a.end_cb = NULL;
a.act_time = 0;
a.time = anim_time;

View File

@@ -613,7 +613,7 @@ static void lv_ddlist_refr_size(lv_obj_t * ddlist, uint16_t anim_time)
a.start = lv_obj_get_height(ddlist);
a.end = new_height;
a.fp = (lv_anim_fp_t)lv_obj_set_height;
a.path = lv_anim_get_path(LV_ANIM_PATH_LIN);
a.path = lv_anim_path_linear;
a.end_cb = (lv_anim_cb_t)lv_ddlist_pos_current_option;
a.act_time = 0;
a.time = ext->anim_time;

View File

@@ -744,7 +744,7 @@ static void lv_label_refr_text(lv_obj_t * label)
anim.start = lv_font_get_width_scale(font, ' ');
anim.act_time = 0;
anim.end_cb = NULL;
anim.path = lv_anim_get_path(LV_ANIM_PATH_LIN);
anim.path = lv_anim_path_linear;
anim.time = 3000;
anim.playback_pause = (((lv_font_get_width_scale(style->text.font, ' ') + style->text.letter_space) * 1000) /ext->anim_speed)
* ANIM_WAIT_CHAR_COUNT;
@@ -774,7 +774,7 @@ static void lv_label_refr_text(lv_obj_t * label)
anim.start = lv_font_get_width_scale(font, ' ');
anim.act_time = 0;
anim.end_cb = NULL;
anim.path = lv_anim_get_path(LV_ANIM_PATH_LIN);
anim.path = lv_anim_path_linear;
anim.playback_pause = (((lv_font_get_width_scale(style->text.font, ' ') + style->text.letter_space) * 1000) / ext->anim_speed) * ANIM_WAIT_CHAR_COUNT;;
anim.repeat_pause = anim.playback_pause;

View File

@@ -387,7 +387,7 @@ void lv_list_up(lv_obj_t * list)
a.start = lv_obj_get_y(scrl);
a.end = new_y;
a.fp = (lv_anim_fp_t)lv_obj_set_y;
a.path = lv_anim_get_path(LV_ANIM_PATH_LIN);
a.path = lv_anim_path_linear;
a.end_cb = NULL;
a.act_time = 0;
a.time = LV_LIST_FOCUS_TIME;
@@ -430,7 +430,7 @@ void lv_list_down(lv_obj_t * list)
a.start = lv_obj_get_y(scrl);
a.end = new_y;
a.fp = (lv_anim_fp_t)lv_obj_set_y;
a.path = lv_anim_get_path(LV_ANIM_PATH_LIN);
a.path = lv_anim_path_linear;
a.end_cb = NULL;
a.act_time = 0;
a.time = LV_LIST_FOCUS_TIME;

View File

@@ -323,7 +323,7 @@ void lv_page_focus(lv_obj_t * page, lv_obj_t * obj, uint16_t anim_time)
a.playback = 0;
a.repeat = 0;
a.var = ext->scrl;
a.path = lv_anim_get_path(LV_ANIM_PATH_LIN);
a.path = lv_anim_path_linear;
a.fp = (lv_anim_fp_t) lv_obj_set_y;
lv_anim_create(&a);
#endif

View File

@@ -435,7 +435,7 @@ static void refr_position(lv_obj_t *roller, bool anim_en)
a.start = lv_obj_get_y(roller_scrl);
a.end = new_y;
a.fp = (lv_anim_fp_t)lv_obj_set_y;
a.path = lv_anim_get_path(LV_ANIM_PATH_LIN);
a.path = lv_anim_path_linear;
a.end_cb = NULL;
a.act_time = 0;
a.time = ext->ddlist.anim_time;

View File

@@ -420,14 +420,16 @@ static lv_res_t lv_slider_signal(lv_obj_t * slider, lv_signal_t sign, void * par
lv_style_t *knob_style = lv_slider_get_style(slider, LV_SLIDER_STYLE_KNOB);
lv_coord_t shadow_w = knob_style->body.shadow.width;
if(ext->knob_in == 0) {
lv_coord_t x = LV_MATH_MIN(w / 2 + 1 + shadow_w, h / 2 + 1 + shadow_w); /*The smaller size is the knob diameter*/
/* The smaller size is the knob diameter
* +2 for the possible rounding error*/
lv_coord_t x = LV_MATH_MIN(w / 2 + 2 + shadow_w, h / 2 + 2 + shadow_w);
if(slider->ext_size < x) slider->ext_size = x;
} else {
lv_coord_t pad = LV_MATH_MIN(style->body.padding.hor, style->body.padding.ver);
if(pad < 0) {
pad = -pad;
if(slider->ext_size < pad) slider->ext_size = pad;
}
if(pad < 0) pad = -pad;
if(pad < 1) pad = 1; /*For possible rounding errors*/
if(slider->ext_size < pad) slider->ext_size = pad;
if(slider->ext_size < shadow_w) slider->ext_size = shadow_w;
}
} else if(sign == LV_SIGNAL_CONTROLL) {

View File

@@ -73,10 +73,10 @@ lv_obj_t * lv_sw_create(lv_obj_t * par, lv_obj_t * copy)
/*Set the default styles*/
lv_theme_t *th = lv_theme_get_current();
if(th) {
lv_slider_set_style(new_sw, LV_SW_STYLE_BG, th->sw.bg);
lv_slider_set_style(new_sw, LV_SW_STYLE_INDIC, th->sw.indic);
lv_slider_set_style(new_sw, LV_SW_STYLE_KNOB_OFF, th->sw.knob_off);
lv_slider_set_style(new_sw, LV_SW_STYLE_KNOB_ON, th->sw.knob_on);
lv_sw_set_style(new_sw, LV_SW_STYLE_BG, th->sw.bg);
lv_sw_set_style(new_sw, LV_SW_STYLE_INDIC, th->sw.indic);
lv_sw_set_style(new_sw, LV_SW_STYLE_KNOB_OFF, th->sw.knob_off);
lv_sw_set_style(new_sw, LV_SW_STYLE_KNOB_ON, th->sw.knob_on);
} else {
/*Let the slider' style*/
}

View File

@@ -153,7 +153,7 @@ lv_obj_t * lv_ta_create(lv_obj_t * par, lv_obj_t * copy)
a.repeat_pause = 0;
a.playback = 1;
a.playback_pause = 0;
a.path = lv_anim_get_path(LV_ANIM_PATH_STEP);
a.path = lv_anim_path_step;
lv_anim_create(&a);
#endif
@@ -200,7 +200,7 @@ void lv_ta_add_char(lv_obj_t * ta, char c)
a.repeat_pause = 0;
a.playback = 0;
a.playback_pause = 0;
a.path = lv_anim_get_path(LV_ANIM_PATH_STEP);
a.path = lv_anim_path_step;
lv_anim_create(&a);
#endif
}
@@ -243,7 +243,7 @@ void lv_ta_add_text(lv_obj_t * ta, const char * txt)
a.repeat_pause = 0;
a.playback = 0;
a.playback_pause = 0;
a.path = lv_anim_get_path(LV_ANIM_PATH_STEP);
a.path = lv_anim_path_step;
lv_anim_create(&a);
#endif
}
@@ -329,7 +329,7 @@ void lv_ta_set_text(lv_obj_t * ta, const char * txt)
a.repeat_pause = 0;
a.playback = 0;
a.playback_pause = 0;
a.path = lv_anim_get_path(LV_ANIM_PATH_STEP);
a.path = lv_anim_path_step;
lv_anim_create(&a);
#endif
}
@@ -402,7 +402,7 @@ void lv_ta_set_cursor_pos(lv_obj_t * ta, int16_t pos)
a.repeat_pause = 0;
a.playback = 1;
a.playback_pause = 0;
a.path = lv_anim_get_path(LV_ANIM_PATH_STEP);
a.path = lv_anim_path_step;
lv_anim_create(&a);
#endif

View File

@@ -185,7 +185,7 @@ lv_obj_t * lv_tabview_add_tab(lv_obj_t * tabview, const char * name)
lv_obj_set_size(h, lv_obj_get_width(tabview), lv_obj_get_height(ext->content));
lv_page_set_sb_mode(h, LV_SB_MODE_AUTO);
lv_page_set_style(h, LV_PAGE_STYLE_BG, &lv_style_transp);
lv_page_set_style(h, LV_PAGE_STYLE_SCRL, &lv_style_transp_tight);
lv_page_set_style(h, LV_PAGE_STYLE_SCRL, &lv_style_transp);
if(page_signal == NULL) page_signal = lv_obj_get_signal_func(h);
if(page_scrl_signal == NULL) page_scrl_signal = lv_obj_get_signal_func(lv_page_get_scrl(h));
@@ -255,7 +255,7 @@ void lv_tabview_set_tab_act(lv_obj_t * tabview, uint16_t id, bool anim_en)
a.start = lv_obj_get_x(ext->content);
a.end = cont_x;
a.fp = (lv_anim_fp_t)lv_obj_set_x;
a.path = lv_anim_get_path(LV_ANIM_PATH_LIN);
a.path = lv_anim_path_linear;
a.end_cb = NULL;
a.act_time = 0;
a.time = ext->anim_time;
@@ -281,7 +281,7 @@ void lv_tabview_set_tab_act(lv_obj_t * tabview, uint16_t id, bool anim_en)
a.start = lv_obj_get_x(ext->indic);
a.end = indic_x;
a.fp = (lv_anim_fp_t)lv_obj_set_x;
a.path = lv_anim_get_path(LV_ANIM_PATH_LIN);
a.path = lv_anim_path_linear;
a.end_cb = NULL;
a.act_time = 0;
a.time = ext->anim_time;