How does the animation variable work?


I can’t really figure out how the animation->variable works

What MCU/Processor/Board and compiler are you using?


What LVGL version are you using?

The newest I’m pretty certain

What do you want to achieve?

I would just like an understanding of how to use the animation->variable


Why can the lv_obj_del_anim_ready_cb do this:

void lv_obj_del_anim_ready_cb(lv_anim_t * a)

but I get errors if I try and do the same:


//demo.cpp(2257): error C2664: 'lv_res_t lv_obj_del(lv_obj_t *)': cannot convert argument 1 from 'void *' to 'lv_obj_t *'
//demo.cpp(2257): note: Conversion from 'void*' to pointer to non-'void' requires an explicit cast

and how would i get the children from the animated object?
I tried this:

        child = lv_obj_get_child_back(a->var, NULL);
        while(child != NULL) {
            child = lv_obj_get_child_back(, child);

the idea was copied from lv_win.c in the design callback.
I have probably misunderstood the function of a->var

Thanks in advance!

C v.s. C++. C allows an implicit cast from void * to another pointer; C++ does not.

I see.
As you can guess I’m quite inexperienced.
That wouldn’t affect to “result” would it? Couldn’t I technically just do this (lv_obj_t*) and it should work right?

Yes; it’s more of a pedantic thing than an actual restriction. C and C++ are basically the same language under the hood.