feat(anim) add interface for handling lv_anim user data. (#2415)

* fix(animation) add interface for setting user data.

Signed-off-by: wangxuedong <wangxuedong@xiaomi.com>

* fix(animation) add interface for getting user data.

Signed-off-by: wangxuedong <wangxuedong@xiaomi.com>

* fix(animation) resolve parameter errors

Signed-off-by: wangxuedong <wangxuedong@xiaomi.com>

Co-authored-by: wangxuedong <wangxuedong@xiaomi.com>
This commit is contained in:
xaowang96
2021-07-29 18:32:46 +08:00
committed by GitHub
parent 524f8dd50b
commit 65475a75ba
+24
View File
@@ -272,6 +272,18 @@ static inline void lv_anim_set_early_apply(lv_anim_t * a, bool en)
a->early_apply = en;
}
/**
* Set the custom user data field of the animation.
* @param a pointer to an initialized `lv_anim_t` variable
* @param user_data pointer to the new user_data.
*/
#if LV_USE_USER_DATA
static inline void lv_anim_set_user_data(lv_anim_t * a, void * user_data)
{
a->user_data = user_data;
}
#endif
/**
* Create an animation
* @param a an initialized 'anim_t' variable. Not required after call.
@@ -289,6 +301,18 @@ static inline uint32_t lv_anim_get_delay(lv_anim_t * a)
return -a->act_time;
}
/**
* Get the user_data field of the animation
* @param a pointer to an initialized `lv_anim_t` variable
* @return the pointer to the costom user_data of the animation
*/
#if LV_USE_USER_DATA
static inline void * lv_anim_get_user_data(lv_anim_t * a)
{
return a->user_data;
}
#endif
/**
* Delete an animation of a variable with a given animator function
* @param var pointer to variable