Opacity style inheritance

Description

Opacitiy on the parent/child objects

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

NRF52840

What LVGL version are you using?

Version 7

What do you want to achieve?

I want to make some fading animation using LVGL. In order to execute this animation, I want to change the opacity of the parent container.

What have you tried so far?

static  void  changeOPA(lv_obj_t* obj, uint8_t  opa)
{
	lv_obj_set_style_local_opa_scale(obj,LV_OBJ_PART_MAIN,LV_STATE_DEFAULT,opa);
}

lv_obj_t* screen = lv_obj_create(NULL,NULL);
lv_obj_t* cont = lv_obj_create(screen,NULL);
lv_obj_t* cont_child = lv_obj_create(cont,NULL);
lv_obj_t* label = lv_label_create(cont_child,NULL);
 
lv_label_set_text(label,"Hello");
lv_scr_load(screen);

changeOPA(cont_child,LV_OPA_100);
changeOPA(cont,LV_OPA_0);

The result of this code is that the label is shown with an opacity of 100%, I don’t get why the opacity of 0% applied on the parent container is not taken in account there. I expect that in this case, the label is not shown.

My idea to make some fading is to change the opacity of the parent container, but doesn’t seems to work as I expect.

Do you have an idea of what happening here ? If it’s the expected behaviour, how can I make some fading animations ?

Best Regards