diff --git a/src/extra/widgets/animimg/lv_animimg.c b/src/extra/widgets/animimg/lv_animimg.c index 78531c19f1..8dc309b41b 100644 --- a/src/extra/widgets/animimg/lv_animimg.c +++ b/src/extra/widgets/animimg/lv_animimg.c @@ -54,24 +54,12 @@ const lv_obj_class_t lv_animimg_class = { * GLOBAL FUNCTIONS **********************/ -/** - * Create an animation image objects - * @param par pointer to an object, it will be the parent of the new animation image - * @param copy pointer to a image object, if not NULL then the new object will be copied from it - * @return pointer to the created animation image - */ lv_obj_t * lv_animimg_create(lv_obj_t * parent) { LV_LOG_INFO("begin") - return lv_obj_create_from_class(&lv_animimg_class, parent); + return lv_obj_class_create_obj(&lv_animimg_class, parent, NULL); } -/** - * Set the animation images source. - * @param img pointer to an animation image object - * @param dsc pointer to a series images - * @param num images' number - */ void lv_animimg_set_src(lv_obj_t * obj, lv_img_dsc_t ** dsc, uint8_t num) { lv_animimg_t * animimg = (lv_animimg_t *)obj; @@ -80,10 +68,6 @@ void lv_animimg_set_src(lv_obj_t * obj, lv_img_dsc_t ** dsc, uint8_t num) lv_anim_set_values(&animimg->anim, 0 , num); } -/** - * Startup the image animation. - * @param img pointer to an animation image object - */ void lv_animimg_start(lv_obj_t * obj) { lv_animimg_t * animimg = (lv_animimg_t *)obj; @@ -94,31 +78,13 @@ void lv_animimg_start(lv_obj_t * obj) * Setter functions *====================*/ -/** - * Set the image animation wait before repeat. unit:ms - * @param img pointer to an animation image object - */ -void lv_animimg_set_repeat_delay(lv_obj_t * obj, uint32_t delay) -{ - lv_animimg_t * animimg = (lv_animimg_t *)obj; - animimg->anim.repeat_delay = delay; -} - -/** - * Set the image animation duration time. unit:ms - * @param img pointer to an animation image object - */ void lv_animimg_set_duration(lv_obj_t * obj, uint32_t duration) { lv_animimg_t * animimg = (lv_animimg_t *)obj; lv_anim_set_time(&animimg->anim, duration); - lv_anim_set_playback_time(&animimg->anim, duration); + lv_anim_set_playback_delay(&animimg->anim, duration); } -/** - * Set the image animation reapeatly play times. - * @param img pointer to an animation image object - */ void lv_animimg_set_repeat_count(lv_obj_t * obj, uint16_t count) { lv_animimg_t * animimg = (lv_animimg_t *)obj; @@ -148,21 +114,9 @@ static void lv_animimg_constructor(const lv_obj_class_t * class_p, lv_obj_t * ob lv_anim_set_time(&animimg->anim, 30); lv_anim_set_exec_cb(&animimg->anim, (lv_anim_exec_xcb_t)index_change); lv_anim_set_values(&animimg->anim, 0 , 1); - lv_anim_set_playback_time(&animimg->anim, 100); lv_anim_set_repeat_count(&animimg->anim, LV_ANIM_REPEAT_INFINITE); } -/** - * Handle the drawing related tasks of the images - * @param img pointer to an image animationobject - * @param clip_area the object will be drawn only in this area - * @param mode LV_DESIGN_COVER_CHK: only check if the object fully covers the 'mask_p' area - * (return 'true' if yes) - * LV_DESIGN_DRAW: draw the object (always return 'true') - * LV_DESIGN_DRAW_POST: drawing after every children are drawn - * @param return an element of `lv_design_res_t` - */ - static void index_change(lv_obj_t * obj, int32_t index) { lv_coord_t idx; diff --git a/src/extra/widgets/animimg/lv_animimg.h b/src/extra/widgets/animimg/lv_animimg.h index 14f5cb58ab..ce4461b555 100644 --- a/src/extra/widgets/animimg/lv_animimg.h +++ b/src/extra/widgets/animimg/lv_animimg.h @@ -54,29 +54,10 @@ typedef uint8_t lv_animimg_part_t; */ lv_obj_t * lv_animimg_create(lv_obj_t * parent); -/** - * Startup the image animation. - * @param img pointer to an animation image object - */ -void lv_animimg_start(lv_obj_t * obj); - - /*===================== * Setter functions *====================*/ -/** - * Set the image animation duration time. unit:ms - * @param img pointer to an animation image object - */ -void lv_animimg_set_duration(lv_obj_t * img, uint32_t duration); - -/** - * Set the image animation wait before repeat. unit:ms - * @param img pointer to an animation image object - */ -void lv_animimg_set_repeat_delay(lv_obj_t * img, uint32_t delay); - /** * Set the image animation images source. * @param img pointer to an animation image object @@ -85,6 +66,18 @@ void lv_animimg_set_repeat_delay(lv_obj_t * img, uint32_t delay); */ void lv_animimg_set_src(lv_obj_t * img, lv_img_dsc_t ** dsc, uint8_t num); +/** + * Startup the image animation. + * @param img pointer to an animation image object + */ +void lv_animimg_start(lv_obj_t * obj); + +/** + * Set the image animation duration time. unit:ms + * @param img pointer to an animation image object + */ +void lv_animimg_set_duration(lv_obj_t * img, uint32_t duration); + /** * Set the image animation reapeatly play times. * @param img pointer to an animation image object