feat(animimg): backport add getter function for underlying animation (#6923)
This commit is contained in:
@@ -33,6 +33,16 @@ Image sources
|
||||
To set the image in a state, use the
|
||||
:cpp:expr:`lv_animimg_set_src(imagebutton, dsc[], num)`.
|
||||
|
||||
Using the inner animation
|
||||
-------------------------
|
||||
|
||||
For more advanced use cases, the animation internally used by the image can be
|
||||
retrieved using the :cpp:expr:`lv_animimg_get_anim(image)`. This way, the
|
||||
:ref:`Animation <animations>` functions can be used, for example to
|
||||
override the animation values using the
|
||||
:cpp:expr:`lv_anim_set_values(anim, start, end)` or to set a callback
|
||||
on the animation completed event.
|
||||
|
||||
.. _lv_animimg_events:
|
||||
|
||||
Events
|
||||
|
||||
@@ -134,6 +134,13 @@ uint32_t lv_animimg_get_repeat_count(lv_obj_t * obj)
|
||||
return lv_anim_get_repeat_count(&animimg->anim);
|
||||
}
|
||||
|
||||
lv_anim_t * lv_animimg_get_anim(lv_obj_t * obj)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, MY_CLASS);
|
||||
lv_animimg_t * animimg = (lv_animimg_t *)obj;
|
||||
return &animimg->anim;
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
@@ -14,6 +14,7 @@ extern "C" {
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "../image/lv_image.h"
|
||||
#include "../../misc/lv_types.h"
|
||||
|
||||
#if LV_USE_ANIMIMG != 0
|
||||
|
||||
@@ -112,6 +113,13 @@ uint32_t lv_animimg_get_duration(lv_obj_t * img);
|
||||
*/
|
||||
uint32_t lv_animimg_get_repeat_count(lv_obj_t * img);
|
||||
|
||||
/**
|
||||
* Get the image animation underlying animation.
|
||||
* @param img pointer to an animation image object
|
||||
* @return the animation reference
|
||||
*/
|
||||
lv_anim_t * lv_animimg_get_anim(lv_obj_t * img);
|
||||
|
||||
#endif /*LV_USE_ANIMIMG*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
Reference in New Issue
Block a user