mirror of
https://github.com/lvgl/lvgl.git
synced 2026-05-27 11:57:48 +08:00
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:
@@ -272,6 +272,18 @@ static inline void lv_anim_set_early_apply(lv_anim_t * a, bool en)
|
|||||||
a->early_apply = 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
|
* Create an animation
|
||||||
* @param a an initialized 'anim_t' variable. Not required after call.
|
* @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;
|
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
|
* Delete an animation of a variable with a given animator function
|
||||||
* @param var pointer to variable
|
* @param var pointer to variable
|
||||||
|
|||||||
Reference in New Issue
Block a user