diff --git a/lv_misc/lv_anim.c b/lv_misc/lv_anim.c index 2bfbf788ed..ca0d4b63db 100644 --- a/lv_misc/lv_anim.c +++ b/lv_misc/lv_anim.c @@ -115,6 +115,19 @@ bool lv_anim_del(void * var, lv_anim_fp_t fp) return del; } +/** + * Get the number of currently running animations + * @return the number of running animations + */ +uint16_t lv_anim_count_running(void) +{ + uint16_t cnt = 0; + lv_anim_t * a; + LL_READ(anim_ll, a) cnt++; + + return cnt++; +} + /** * Calculate the time of an animation with a given speed and the start and end values * @param speed speed of animation in unit/sec diff --git a/lv_misc/lv_anim.h b/lv_misc/lv_anim.h index 544f50d9dc..aaf1c6bff9 100644 --- a/lv_misc/lv_anim.h +++ b/lv_misc/lv_anim.h @@ -99,6 +99,12 @@ void lv_anim_create(lv_anim_t * anim_p); */ bool lv_anim_del(void * var, lv_anim_fp_t fp); +/** + * Get the number of currently running animations + * @return the number of running animations + */ +uint16_t lv_anim_count_running(void); + /** * Calculate the time of an animation with a given speed and the start and end values * @param speed speed of animation in unit/sec