introduce lv_anim_path_t to encapsulate the path cb
This commit is contained in:
@@ -193,6 +193,10 @@ lv_obj_t * lv_textarea_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
#if LV_USE_ANIMATION
|
||||
if(ext->cursor.blink_time) {
|
||||
/*Create a cursor blinker animation*/
|
||||
lv_anim_path_t path;
|
||||
lv_anim_path_init(&path);
|
||||
lv_anim_path_set_cb(&path, lv_anim_path_step);
|
||||
|
||||
lv_anim_t a;
|
||||
lv_anim_init(&a);
|
||||
lv_anim_set_var(&a, ta);
|
||||
@@ -200,8 +204,8 @@ lv_obj_t * lv_textarea_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
lv_anim_set_time(&a, ext->cursor.blink_time);
|
||||
lv_anim_set_playback_time(&a, ext->cursor.blink_time);
|
||||
lv_anim_set_values(&a, 0, 1);
|
||||
lv_anim_set_path_cb(&a, lv_anim_path_step);
|
||||
lv_anim_set_repeat_count(&a, LV_ANIM_REPEAT_INFINIT);
|
||||
lv_anim_set_path(&a, &path);
|
||||
lv_anim_set_repeat_count(&a, LV_ANIM_REPEAT_INFINITE);
|
||||
lv_anim_start(&a);
|
||||
}
|
||||
#endif
|
||||
@@ -281,13 +285,17 @@ void lv_textarea_add_char(lv_obj_t * ta, uint32_t c)
|
||||
|
||||
#if LV_USE_ANIMATION
|
||||
/*Auto hide characters*/
|
||||
lv_anim_path_t path;
|
||||
lv_anim_path_init(&path);
|
||||
lv_anim_path_set_cb(&path, lv_anim_path_step);
|
||||
|
||||
lv_anim_t a;
|
||||
lv_anim_init(&a);
|
||||
lv_anim_set_var(&a, ta);
|
||||
lv_anim_set_exec_cb(&a, (lv_anim_exec_xcb_t)pwd_char_hider_anim);
|
||||
lv_anim_set_time(&a, ext->pwd_show_time);
|
||||
lv_anim_set_values(&a, 0, 1);
|
||||
lv_anim_set_path_cb(&a, lv_anim_path_step);
|
||||
lv_anim_set_path(&a, &path);
|
||||
lv_anim_set_ready_cb(&a, pwd_char_hider_anim_ready);
|
||||
lv_anim_start(&a);
|
||||
|
||||
@@ -364,13 +372,16 @@ void lv_textarea_add_text(lv_obj_t * ta, const char * txt)
|
||||
|
||||
#if LV_USE_ANIMATION
|
||||
/*Auto hide characters*/
|
||||
lv_anim_path_t path;
|
||||
lv_anim_path_init(&path);
|
||||
lv_anim_path_set_cb(&path, lv_anim_path_step);
|
||||
lv_anim_t a;
|
||||
lv_anim_init(&a);
|
||||
lv_anim_set_var(&a, ta);
|
||||
lv_anim_set_exec_cb(&a, (lv_anim_exec_xcb_t)pwd_char_hider_anim);
|
||||
lv_anim_set_time(&a, ext->pwd_show_time);
|
||||
lv_anim_set_values(&a, 0, 1);
|
||||
lv_anim_set_path_cb(&a, lv_anim_path_step);
|
||||
lv_anim_set_path(&a, &path);
|
||||
lv_anim_set_ready_cb(&a, pwd_char_hider_anim_ready);
|
||||
lv_anim_start(&a);
|
||||
#else
|
||||
@@ -521,13 +532,17 @@ void lv_textarea_set_text(lv_obj_t * ta, const char * txt)
|
||||
|
||||
#if LV_USE_ANIMATION
|
||||
/*Auto hide characters*/
|
||||
lv_anim_path_t path;
|
||||
lv_anim_path_init(&path);
|
||||
lv_anim_path_set_cb(&path, lv_anim_path_step);
|
||||
|
||||
lv_anim_t a;
|
||||
lv_anim_init(&a);
|
||||
lv_anim_set_var(&a, ta);
|
||||
lv_anim_set_exec_cb(&a, (lv_anim_exec_xcb_t)pwd_char_hider_anim);
|
||||
lv_anim_set_time(&a, ext->pwd_show_time);
|
||||
lv_anim_set_values(&a, 0, 1);
|
||||
lv_anim_set_path_cb(&a, lv_anim_path_step);
|
||||
lv_anim_set_path(&a, &path);
|
||||
lv_anim_set_ready_cb(&a, pwd_char_hider_anim_ready);
|
||||
lv_anim_start(&a);
|
||||
#else
|
||||
@@ -640,6 +655,10 @@ void lv_textarea_set_cursor_pos(lv_obj_t * ta, int16_t pos)
|
||||
#if LV_USE_ANIMATION
|
||||
if(ext->cursor.blink_time) {
|
||||
/*Reset cursor blink animation*/
|
||||
lv_anim_path_t path;
|
||||
lv_anim_path_init(&path);
|
||||
lv_anim_path_set_cb(&path, lv_anim_path_step);
|
||||
|
||||
lv_anim_t a;
|
||||
lv_anim_init(&a);
|
||||
lv_anim_set_var(&a, ta);
|
||||
@@ -647,8 +666,8 @@ void lv_textarea_set_cursor_pos(lv_obj_t * ta, int16_t pos)
|
||||
lv_anim_set_time(&a, ext->cursor.blink_time);
|
||||
lv_anim_set_playback_time(&a, ext->cursor.blink_time);
|
||||
lv_anim_set_values(&a, 1, 0);
|
||||
lv_anim_set_path_cb(&a, lv_anim_path_step);
|
||||
lv_anim_set_repeat_count(&a, LV_ANIM_REPEAT_INFINIT);
|
||||
lv_anim_set_path(&a, &path);
|
||||
lv_anim_set_repeat_count(&a, LV_ANIM_REPEAT_INFINITE);
|
||||
lv_anim_start(&a);
|
||||
}
|
||||
#endif
|
||||
@@ -901,6 +920,10 @@ void lv_textarea_set_cursor_blink_time(lv_obj_t * ta, uint16_t time)
|
||||
#if LV_USE_ANIMATION
|
||||
if(ext->cursor.blink_time) {
|
||||
/*Reset cursor blink animation*/
|
||||
lv_anim_path_t path;
|
||||
lv_anim_path_init(&path);
|
||||
lv_anim_path_set_cb(&path, lv_anim_path_step);
|
||||
|
||||
lv_anim_t a;
|
||||
lv_anim_init(&a);
|
||||
lv_anim_set_var(&a, ta);
|
||||
@@ -908,7 +931,7 @@ void lv_textarea_set_cursor_blink_time(lv_obj_t * ta, uint16_t time)
|
||||
lv_anim_set_time(&a, ext->cursor.blink_time);
|
||||
lv_anim_set_playback_time(&a, ext->cursor.blink_time);
|
||||
lv_anim_set_values(&a, 1, 0);
|
||||
lv_anim_set_path_cb(&a, lv_anim_path_step);
|
||||
lv_anim_set_path(&a, &path);
|
||||
lv_anim_start(&a);
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user