# Stopping One Animation in LVGL 9.5 Also Stops All Other Running Animations

**URL:** <http://forum.squareline.io/t/stopping-one-animation-in-lvgl-9-5-also-stops-all-other-running-animations/6502>\
**Category:** Bugs\
**Created:** [November 6, 2026, 1:39pm UTC](http://forum.squareline.io/t/stopping-one-animation-in-lvgl-9-5-also-stops-all-other-running-animations/6502 "2026-11-06T13:39:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rezajavahery](http://forum.squareline.io/letter_avatar_proxy/v4/letter/r/3bc359/32.png) [@Rezajavahery](http://forum.squareline.io/u/Rezajavahery)\
**Post date:** [November 6, 2026, 1:39pm UTC](http://forum.squareline.io/t/stopping-one-animation-in-lvgl-9-5-also-stops-all-other-running-animations/6502/1 "2026-11-06T13:39:01Z")

</div>

- Hello,

---

<div class="post-metadata">

**Author:** ![SquareLine\_Support](http://forum.squareline.io/user_avatar/forum.squareline.io/squareline_support/32/47_2.png) [@SquareLine\_Support](http://forum.squareline.io/u/SquareLine_Support)\
**Post date:** [November 10, 2026, 12:23pm UTC](http://forum.squareline.io/t/stopping-one-animation-in-lvgl-9-5-also-stops-all-other-running-animations/6502/2 "2026-11-10T12:23:04Z")

</div>

Hi, thanks for the detailed report and the video. What you’re seeing comes from how `lv_anim_delete()` matches animations in LVGL 9.5:

```c
if((a->var == var || var == NULL) && (a->exec_cb == exec_cb || exec_cb == NULL))  

```

`NULL` acts as a wildcard, so `lv_anim_delete(NULL, NULL)` deletes **every** running animation. `lv_anim_custom_delete(a, cb)` is just `lv_anim_delete(a ? a->var : NULL, cb)`.

Animations generated by SquareLine Studio keep their target object in `user_data` and use a custom exec callback, so their `var` is `NULL`. That means:

- `lv_anim_custom_delete(detect_anim, NULL)` ends up as `lv_anim_delete(NULL, NULL)` and stops everything (answer to Q3: yes).
- `lv_anim_delete(ui_detectgif, NULL)` only deletes animations whose `var` is that object, such as an Animated Image’s own animation. If it stops everything, `ui_detectgif` was most likely `NULL` at that moment (screen not created yet, or already deleted).

**Deleting one specific animation (Q1, Q2):** LVGL has a built-in way. Set the animation’s `var` to the descriptor itself; `lv_anim_start()` then replaces it with the running copy, which makes it a unique key:

```c
static lv_anim_t * detect_anim = NULL;  
 
static void detect_anim_deleted(lv_anim_t * a) { detect_anim = NULL; }  
 
void start_detect_anim(void)  
{  
    lv_anim_t a;  
    lv_anim_init(&a);  
    lv_anim_set_var(&a, &a); /* becomes the running anim's own pointer */  
    lv_anim_set_custom_exec_cb(&a, my_exec_cb);  
    lv_anim_set_values(&a, 0, 100);  
    lv_anim_set_duration(&a, 1000);  
    lv_anim_set_repeat_count(&a, LV_ANIM_REPEAT_INFINITE);  
    lv_anim_set_deleted_cb(&a, detect_anim_deleted);  
    detect_anim = lv_anim_start(&a);  
}  
 
void stop_detect_anim(void)  
{  
    if(detect_anim) lv_anim_delete(detect_anim, NULL); /* deletes only this one */  
}  

```

Always check the pointer for `NULL` before deleting. The `deleted_cb` clears it when the animation ends on its own, so you never pass a stale pointer or a `NULL` wildcard.

**Managing several animations (Q4):** give each animation a unique `var`: either the target object together with `lv_anim_set_exec_cb()`, deleted with `lv_anim_delete(obj, cb)`, or the self-pointer pattern above. Never call `lv_anim_delete()` / `lv_anim_custom_delete()` with a value that may be `NULL`. Animations created from Studio’s Animation panel can’t be stopped one by one, because the generated function doesn’t return the animation pointer. Write the ones you need to stop yourself, e.g. in `ui_events.c`, which isn’t overwritten on export. If `ui_detectgif` is an Animated Image widget, `lv_anim_delete(ui_detectgif, NULL)` (with a valid pointer) stops only that widget’s own animation.
