refactor: lv_anim_set_playback_time -> lv_anim_set_playback_duration
This commit is contained in:
@@ -513,7 +513,7 @@ static void arc_anim(lv_obj_t * obj)
|
||||
lv_anim_set_exec_cb(&a, arc_anim_cb);
|
||||
lv_anim_set_values(&a, 0, 100);
|
||||
lv_anim_set_duration(&a, t1);
|
||||
lv_anim_set_playback_time(&a, t2);
|
||||
lv_anim_set_playback_duration(&a, t2);
|
||||
lv_anim_set_var(&a, obj);
|
||||
lv_anim_set_repeat_count(&a, LV_ANIM_REPEAT_INFINITE);
|
||||
lv_anim_start(&a);
|
||||
@@ -534,7 +534,7 @@ static void scroll_anim(lv_obj_t * obj, int32_t y_max)
|
||||
lv_anim_set_exec_cb(&a, scroll_anim_y_cb);
|
||||
lv_anim_set_values(&a, 0, y_max);
|
||||
lv_anim_set_duration(&a, t);
|
||||
lv_anim_set_playback_time(&a, t);
|
||||
lv_anim_set_playback_duration(&a, t);
|
||||
lv_anim_set_repeat_count(&a, LV_ANIM_REPEAT_INFINITE);
|
||||
lv_anim_start(&a);
|
||||
|
||||
@@ -555,7 +555,7 @@ static void shake_anim(lv_obj_t * obj, int32_t y_max)
|
||||
lv_anim_set_exec_cb(&a, shake_anim_y_cb);
|
||||
lv_anim_set_values(&a, 0, y_max);
|
||||
lv_anim_set_duration(&a, t1);
|
||||
lv_anim_set_playback_time(&a, t2);
|
||||
lv_anim_set_playback_duration(&a, t2);
|
||||
lv_anim_set_repeat_count(&a, LV_ANIM_REPEAT_INFINITE);
|
||||
lv_anim_start(&a);
|
||||
}
|
||||
|
||||
@@ -354,7 +354,7 @@ void _lv_demo_music_resume(void)
|
||||
lv_anim_set_exec_cb(&a, spectrum_anim_cb);
|
||||
lv_anim_set_var(&a, spectrum_obj);
|
||||
lv_anim_set_duration(&a, ((spectrum_len - spectrum_i) * 1000) / 30);
|
||||
lv_anim_set_playback_time(&a, 0);
|
||||
lv_anim_set_playback_duration(&a, 0);
|
||||
lv_anim_set_ready_cb(&a, spectrum_end_cb);
|
||||
lv_anim_start(&a);
|
||||
|
||||
|
||||
@@ -124,7 +124,7 @@ static void obj_test_task_cb(lv_timer_t * tmr)
|
||||
lv_anim_set_duration(&a, LV_DEMO_STRESS_TIME_STEP * 2);
|
||||
lv_anim_set_exec_cb(&a, set_width_anim);
|
||||
lv_anim_set_values(&a, 100, 200);
|
||||
lv_anim_set_playback_time(&a, LV_DEMO_STRESS_TIME_STEP * 2);
|
||||
lv_anim_set_playback_duration(&a, LV_DEMO_STRESS_TIME_STEP * 2);
|
||||
lv_anim_set_repeat_count(&a, LV_ANIM_REPEAT_INFINITE);
|
||||
lv_anim_start(&a);
|
||||
|
||||
@@ -227,7 +227,7 @@ static void obj_test_task_cb(lv_timer_t * tmr)
|
||||
lv_anim_set_values(&a, 180, 400);
|
||||
lv_anim_set_duration(&a, LV_DEMO_STRESS_TIME_STEP * 2);
|
||||
lv_anim_set_delay(&a, LV_DEMO_STRESS_TIME_STEP + 25);
|
||||
lv_anim_set_playback_time(&a, LV_DEMO_STRESS_TIME_STEP * 5);
|
||||
lv_anim_set_playback_duration(&a, LV_DEMO_STRESS_TIME_STEP * 5);
|
||||
lv_anim_set_repeat_count(&a, 3);
|
||||
lv_anim_set_exec_cb(&a, arc_set_end_angle_anim);
|
||||
lv_anim_start(&a);
|
||||
|
||||
@@ -230,7 +230,7 @@ void lv_demo_widgets_start_slideshow(void)
|
||||
lv_anim_init(&a);
|
||||
lv_anim_set_exec_cb(&a, scroll_anim_y_cb);
|
||||
lv_anim_set_duration(&a, t);
|
||||
lv_anim_set_playback_time(&a, t);
|
||||
lv_anim_set_playback_duration(&a, t);
|
||||
lv_anim_set_values(&a, 0, v);
|
||||
lv_anim_set_var(&a, tab);
|
||||
lv_anim_set_ready_cb(&a, slideshow_anim_ready_cb);
|
||||
@@ -697,7 +697,7 @@ static void analytics_create(lv_obj_t * parent)
|
||||
lv_anim_set_exec_cb(&a, scale1_indic1_anim_cb);
|
||||
lv_anim_set_var(&a, arc);
|
||||
lv_anim_set_duration(&a, 4100);
|
||||
lv_anim_set_playback_time(&a, 2700);
|
||||
lv_anim_set_playback_duration(&a, 2700);
|
||||
lv_anim_start(&a);
|
||||
|
||||
arc = lv_arc_create(scale1);
|
||||
@@ -713,7 +713,7 @@ static void analytics_create(lv_obj_t * parent)
|
||||
lv_anim_set_exec_cb(&a, scale1_indic1_anim_cb);
|
||||
lv_anim_set_var(&a, arc);
|
||||
lv_anim_set_duration(&a, 2600);
|
||||
lv_anim_set_playback_time(&a, 3200);
|
||||
lv_anim_set_playback_duration(&a, 3200);
|
||||
lv_anim_start(&a);
|
||||
|
||||
arc = lv_arc_create(scale1);
|
||||
@@ -729,7 +729,7 @@ static void analytics_create(lv_obj_t * parent)
|
||||
lv_anim_set_exec_cb(&a, scale1_indic1_anim_cb);
|
||||
lv_anim_set_var(&a, arc);
|
||||
lv_anim_set_duration(&a, 2800);
|
||||
lv_anim_set_playback_time(&a, 1800);
|
||||
lv_anim_set_playback_duration(&a, 1800);
|
||||
lv_anim_start(&a);
|
||||
|
||||
/*Scale 2*/
|
||||
@@ -860,7 +860,7 @@ static void analytics_create(lv_obj_t * parent)
|
||||
lv_anim_set_exec_cb(&a, scale3_anim_cb);
|
||||
lv_anim_set_var(&a, scale3);
|
||||
lv_anim_set_duration(&a, 4100);
|
||||
lv_anim_set_playback_time(&a, 800);
|
||||
lv_anim_set_playback_duration(&a, 800);
|
||||
lv_anim_start(&a);
|
||||
|
||||
lv_obj_align(mbps_label, LV_ALIGN_TOP_MID, 10, lv_pct(55));
|
||||
@@ -1658,7 +1658,7 @@ static void slideshow_anim_ready_cb(lv_anim_t * a_old)
|
||||
lv_anim_init(&a);
|
||||
lv_anim_set_exec_cb(&a, scroll_anim_y_cb);
|
||||
lv_anim_set_duration(&a, t);
|
||||
lv_anim_set_playback_time(&a, t);
|
||||
lv_anim_set_playback_duration(&a, t);
|
||||
lv_anim_set_values(&a, 0, v);
|
||||
lv_anim_set_var(&a, tab);
|
||||
lv_anim_set_ready_cb(&a, slideshow_anim_ready_cb);
|
||||
|
||||
@@ -29,7 +29,7 @@ void lv_example_anim_2(void)
|
||||
lv_anim_set_values(&a, 10, 50);
|
||||
lv_anim_set_duration(&a, 1000);
|
||||
lv_anim_set_playback_delay(&a, 100);
|
||||
lv_anim_set_playback_time(&a, 300);
|
||||
lv_anim_set_playback_duration(&a, 300);
|
||||
lv_anim_set_repeat_delay(&a, 500);
|
||||
lv_anim_set_repeat_count(&a, LV_ANIM_REPEAT_INFINITE);
|
||||
lv_anim_set_path_cb(&a, lv_anim_path_ease_in_out);
|
||||
|
||||
@@ -20,7 +20,7 @@ a1.set_var(obj)
|
||||
a1.set_values(10, 50)
|
||||
a1.set_time(1000)
|
||||
a1.set_playback_delay(100)
|
||||
a1.set_playback_time(300)
|
||||
a1.set_playback_duration(300)
|
||||
a1.set_repeat_delay(500)
|
||||
a1.set_repeat_count(lv.ANIM_REPEAT_INFINITE)
|
||||
a1.set_path_cb(lv.anim_t.path_ease_in_out)
|
||||
@@ -33,7 +33,7 @@ a2.set_var(obj)
|
||||
a2.set_values(10, 240)
|
||||
a2.set_time(1000)
|
||||
a2.set_playback_delay(100)
|
||||
a2.set_playback_time(300)
|
||||
a2.set_playback_duration(300)
|
||||
a2.set_repeat_delay(500)
|
||||
a2.set_repeat_count(lv.ANIM_REPEAT_INFINITE)
|
||||
a2.set_path_cb(lv.anim_t.path_ease_in_out)
|
||||
|
||||
@@ -39,12 +39,12 @@ void lv_example_flex_5(void)
|
||||
|
||||
lv_anim_set_exec_cb(&a, row_gap_anim);
|
||||
lv_anim_set_duration(&a, 500);
|
||||
lv_anim_set_playback_time(&a, 500);
|
||||
lv_anim_set_playback_duration(&a, 500);
|
||||
lv_anim_start(&a);
|
||||
|
||||
lv_anim_set_exec_cb(&a, column_gap_anim);
|
||||
lv_anim_set_duration(&a, 3000);
|
||||
lv_anim_set_playback_time(&a, 3000);
|
||||
lv_anim_set_playback_duration(&a, 3000);
|
||||
lv_anim_start(&a);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ a_row.set_values(0, 10)
|
||||
a_row.set_repeat_count(lv.ANIM_REPEAT_INFINITE)
|
||||
|
||||
a_row.set_time(500)
|
||||
a_row.set_playback_time(500)
|
||||
a_row.set_playback_duration(500)
|
||||
a_row.set_custom_exec_cb(lambda a,val: row_gap_anim(cont,val))
|
||||
lv.anim_t.start(a_row)
|
||||
|
||||
@@ -40,7 +40,7 @@ a_col.set_values(0, 10)
|
||||
a_col.set_repeat_count(lv.ANIM_REPEAT_INFINITE)
|
||||
|
||||
a_col.set_time(3000)
|
||||
a_col.set_playback_time(3000)
|
||||
a_col.set_playback_duration(3000)
|
||||
a_col.set_custom_exec_cb(lambda a,val: column_gap_anim(cont,val))
|
||||
|
||||
lv.anim_t.start(a_col)
|
||||
|
||||
@@ -50,12 +50,12 @@ void lv_example_grid_5(void)
|
||||
|
||||
lv_anim_set_exec_cb(&a, row_gap_anim);
|
||||
lv_anim_set_duration(&a, 500);
|
||||
lv_anim_set_playback_time(&a, 500);
|
||||
lv_anim_set_playback_duration(&a, 500);
|
||||
lv_anim_start(&a);
|
||||
|
||||
lv_anim_set_exec_cb(&a, column_gap_anim);
|
||||
lv_anim_set_duration(&a, 3000);
|
||||
lv_anim_set_playback_time(&a, 3000);
|
||||
lv_anim_set_playback_duration(&a, 3000);
|
||||
lv_anim_start(&a);
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ for i in range(9):
|
||||
a_row.set_values(0, 10)
|
||||
a_row.set_repeat_count(lv.ANIM_REPEAT_INFINITE)
|
||||
a_row.set_time(500)
|
||||
a_row.set_playback_time(500)
|
||||
a_row.set_playback_duration(500)
|
||||
a_row. set_custom_exec_cb(lambda a,val: row_gap_anim(cont,val))
|
||||
lv.anim_t.start(a_row)
|
||||
|
||||
@@ -45,7 +45,7 @@ for i in range(9):
|
||||
a_col.set_values(0, 10)
|
||||
a_col.set_repeat_count(lv.ANIM_REPEAT_INFINITE)
|
||||
a_col.set_time(500)
|
||||
a_col.set_playback_time(500)
|
||||
a_col.set_playback_duration(500)
|
||||
a_col. set_custom_exec_cb(lambda a,val: column_gap_anim(cont,val))
|
||||
lv.anim_t.start(a_col)
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ void lv_example_bar_3(void)
|
||||
lv_anim_init(&a);
|
||||
lv_anim_set_exec_cb(&a, set_temp);
|
||||
lv_anim_set_duration(&a, 3000);
|
||||
lv_anim_set_playback_time(&a, 3000);
|
||||
lv_anim_set_playback_duration(&a, 3000);
|
||||
lv_anim_set_var(&a, bar);
|
||||
lv_anim_set_values(&a, -20, 40);
|
||||
lv_anim_set_repeat_count(&a, LV_ANIM_REPEAT_INFINITE);
|
||||
|
||||
@@ -23,7 +23,7 @@ bar.set_range(-20, 40)
|
||||
a = lv.anim_t()
|
||||
a.init()
|
||||
a.set_time(3000)
|
||||
a.set_playback_time(3000)
|
||||
a.set_playback_duration(3000)
|
||||
a.set_var(bar)
|
||||
a.set_values(-20, 40)
|
||||
a.set_repeat_count(lv.ANIM_REPEAT_INFINITE)
|
||||
|
||||
@@ -62,7 +62,7 @@ void lv_example_bar_6(void)
|
||||
lv_anim_set_values(&a, 0, 100);
|
||||
lv_anim_set_exec_cb(&a, set_value);
|
||||
lv_anim_set_duration(&a, 4000);
|
||||
lv_anim_set_playback_time(&a, 4000);
|
||||
lv_anim_set_playback_duration(&a, 4000);
|
||||
lv_anim_set_repeat_count(&a, LV_ANIM_REPEAT_INFINITE);
|
||||
lv_anim_start(&a);
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ void lv_example_image_3(void)
|
||||
|
||||
lv_anim_set_exec_cb(&a, set_zoom);
|
||||
lv_anim_set_values(&a, 128, 256);
|
||||
lv_anim_set_playback_time(&a, 3000);
|
||||
lv_anim_set_playback_duration(&a, 3000);
|
||||
lv_anim_start(&a);
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ a2.set_var(image)
|
||||
a2.set_custom_exec_cb(lambda a,val: set_zoom(image,val))
|
||||
a2.set_values(128, 256)
|
||||
a2.set_time(5000)
|
||||
a2.set_playback_time(3000)
|
||||
a2.set_playback_duration(3000)
|
||||
a2.set_repeat_count(lv.ANIM_REPEAT_INFINITE)
|
||||
lv.anim_t.start(a2)
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ void lv_example_image_4(void)
|
||||
lv_anim_set_exec_cb(&a, ofs_y_anim);
|
||||
lv_anim_set_values(&a, 0, 100);
|
||||
lv_anim_set_duration(&a, 3000);
|
||||
lv_anim_set_playback_time(&a, 500);
|
||||
lv_anim_set_playback_duration(&a, 500);
|
||||
lv_anim_set_repeat_count(&a, LV_ANIM_REPEAT_INFINITE);
|
||||
lv_anim_start(&a);
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ a.init()
|
||||
a.set_var(image)
|
||||
a.set_values(0, 100)
|
||||
a.set_time(3000)
|
||||
a.set_playback_time(500)
|
||||
a.set_playback_duration(500)
|
||||
a.set_repeat_count(lv.ANIM_REPEAT_INFINITE)
|
||||
a.set_custom_exec_cb(lambda a,val: ofs_y_anim(image,val))
|
||||
lv.anim_t.start(a)
|
||||
|
||||
@@ -54,7 +54,7 @@ void lv_example_scale_3(void)
|
||||
lv_anim_set_exec_cb(&anim_scale_line, set_needle_line_value);
|
||||
lv_anim_set_duration(&anim_scale_line, 1000);
|
||||
lv_anim_set_repeat_count(&anim_scale_line, LV_ANIM_REPEAT_INFINITE);
|
||||
lv_anim_set_playback_time(&anim_scale_line, 1000);
|
||||
lv_anim_set_playback_duration(&anim_scale_line, 1000);
|
||||
lv_anim_set_values(&anim_scale_line, 10, 40);
|
||||
lv_anim_start(&anim_scale_line);
|
||||
|
||||
@@ -92,7 +92,7 @@ void lv_example_scale_3(void)
|
||||
lv_anim_set_exec_cb(&anim_scale_img, set_needle_img_value);
|
||||
lv_anim_set_duration(&anim_scale_img, 1000);
|
||||
lv_anim_set_repeat_count(&anim_scale_img, LV_ANIM_REPEAT_INFINITE);
|
||||
lv_anim_set_playback_time(&anim_scale_img, 1000);
|
||||
lv_anim_set_playback_duration(&anim_scale_img, 1000);
|
||||
lv_anim_set_values(&anim_scale_img, 10, 40);
|
||||
lv_anim_start(&anim_scale_img);
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ uint32_t lv_anim_get_playtime(lv_anim_t * a)
|
||||
uint32_t repeate_cnt = a->repeat_cnt;
|
||||
if(repeate_cnt < 1) repeate_cnt = 1;
|
||||
|
||||
uint32_t playtime = a->repeat_delay + a->duration + a->playback_delay + a->playback_time;
|
||||
uint32_t playtime = a->repeat_delay + a->duration + a->playback_delay + a->playback_duration;
|
||||
playtime = playtime * a->repeat_cnt;
|
||||
return playtime;
|
||||
}
|
||||
@@ -414,7 +414,7 @@ static void anim_ready_handler(lv_anim_t * a)
|
||||
/*Delete the animation if
|
||||
* - no repeat left and no play back (simple one shot animation)
|
||||
* - no repeat, play back is enabled and play back is ready*/
|
||||
if(a->repeat_cnt == 0 && (a->playback_time == 0 || a->playback_now == 1)) {
|
||||
if(a->repeat_cnt == 0 && (a->playback_duration == 0 || a->playback_now == 1)) {
|
||||
|
||||
/*Delete the animation from the list.
|
||||
* This way the `ready_cb` will see the animations like it's animation is ready deleted*/
|
||||
@@ -431,7 +431,7 @@ static void anim_ready_handler(lv_anim_t * a)
|
||||
else {
|
||||
a->act_time = -(int32_t)(a->repeat_delay); /*Restart the animation*/
|
||||
/*Swap the start and end values in play back mode*/
|
||||
if(a->playback_time != 0) {
|
||||
if(a->playback_duration != 0) {
|
||||
/*If now turning back use the 'playback_pause*/
|
||||
if(a->playback_now == 0) a->act_time = -(int32_t)(a->playback_delay);
|
||||
|
||||
@@ -441,10 +441,10 @@ static void anim_ready_handler(lv_anim_t * a)
|
||||
int32_t tmp = a->start_value;
|
||||
a->start_value = a->end_value;
|
||||
a->end_value = tmp;
|
||||
/*Swap the time and playback_time*/
|
||||
/*Swap the time and playback_duration*/
|
||||
tmp = a->duration;
|
||||
a->duration = a->playback_time;
|
||||
a->playback_time = tmp;
|
||||
a->duration = a->playback_duration;
|
||||
a->playback_duration = tmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -489,7 +489,7 @@ static uint32_t convert_speed_to_time(uint32_t speed_or_time, int32_t start, int
|
||||
static void resolve_time(lv_anim_t * a)
|
||||
{
|
||||
a->duration = convert_speed_to_time(a->duration, a->start_value, a->end_value);
|
||||
a->playback_time = convert_speed_to_time(a->playback_time, a->start_value, a->end_value);
|
||||
a->playback_duration = convert_speed_to_time(a->playback_duration, a->start_value, a->end_value);
|
||||
a->playback_delay = convert_speed_to_time(a->playback_delay, a->start_value, a->end_value);
|
||||
a->repeat_delay = convert_speed_to_time(a->repeat_delay, a->start_value, a->end_value);
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@ typedef struct _lv_anim_t {
|
||||
int32_t duration; /**< Animation time in ms*/
|
||||
int32_t act_time; /**< Current time in animation. Set to negative to make delay.*/
|
||||
uint32_t playback_delay; /**< Wait before play back*/
|
||||
uint32_t playback_time; /**< Duration of playback animation*/
|
||||
uint32_t playback_duration; /**< Duration of playback animation*/
|
||||
uint32_t repeat_delay; /**< Wait before repeat*/
|
||||
uint16_t repeat_cnt; /**< Repeat count for the animation*/
|
||||
union _lv_anim_path_para_t {
|
||||
@@ -323,9 +323,17 @@ static inline void lv_anim_set_deleted_cb(lv_anim_t * a, lv_anim_deleted_cb_t de
|
||||
* @param a pointer to an initialized `lv_anim_t` variable
|
||||
* @param time the duration of the playback animation in milliseconds. 0: disable playback
|
||||
*/
|
||||
static inline void lv_anim_set_playback_time(lv_anim_t * a, uint32_t time)
|
||||
static inline void lv_anim_set_playback_duration(lv_anim_t * a, uint32_t duration)
|
||||
{
|
||||
a->playback_time = time;
|
||||
a->playback_duration = duration;
|
||||
}
|
||||
|
||||
/**
|
||||
* Legacy `lv_anim_set_playback_time` API will be removed soon, use `lv_anim_set_playback_duration` instead.
|
||||
*/
|
||||
static inline void lv_anim_set_playback_time(lv_anim_t * a, uint32_t duration)
|
||||
{
|
||||
lv_anim_set_playback_duration(a, duration);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -925,7 +925,7 @@ static void lv_label_refr_text(lv_obj_t * obj)
|
||||
}
|
||||
|
||||
lv_anim_set_duration(&a, anim_time);
|
||||
lv_anim_set_playback_time(&a, a.duration);
|
||||
lv_anim_set_playback_duration(&a, a.duration);
|
||||
|
||||
/*If a template animation exists, overwrite some property*/
|
||||
if(anim_template)
|
||||
@@ -964,7 +964,7 @@ static void lv_label_refr_text(lv_obj_t * obj)
|
||||
}
|
||||
|
||||
lv_anim_set_duration(&a, anim_time);
|
||||
lv_anim_set_playback_time(&a, a.duration);
|
||||
lv_anim_set_playback_duration(&a, a.duration);
|
||||
|
||||
/*If a template animation exists, overwrite some property*/
|
||||
if(anim_template)
|
||||
|
||||
@@ -1050,7 +1050,7 @@ static void start_cursor_blink(lv_obj_t * obj)
|
||||
lv_anim_set_var(&a, ta);
|
||||
lv_anim_set_exec_cb(&a, cursor_blink_anim_cb);
|
||||
lv_anim_set_duration(&a, blink_time);
|
||||
lv_anim_set_playback_time(&a, blink_time);
|
||||
lv_anim_set_playback_duration(&a, 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_INFINITE);
|
||||
|
||||
@@ -28,7 +28,7 @@ void test_gradient_vertical_misalignment(void)
|
||||
lv_anim_set_var(&a, obj);
|
||||
lv_anim_set_exec_cb(&a, obj_set_height_helper);
|
||||
lv_anim_set_duration(&a, 1000);
|
||||
lv_anim_set_playback_time(&a, 1000);
|
||||
lv_anim_set_playback_duration(&a, 1000);
|
||||
lv_anim_set_repeat_count(&a, 100);
|
||||
lv_anim_set_values(&a, 0, 300);
|
||||
lv_anim_start(&a);
|
||||
|
||||
Reference in New Issue
Block a user