Linear horizontal transparent gradient

Hello,
I would like to achieve a linear horizontal transparent gradient effect like in this picture:
image

I was not able to achieve it using gradients functions.
Anyone has suggestions on how to do it?
Thanks

What have you tried so far?

After trying unsuccesfully the solutions proposed here:

The solution proposed uses animations that applies to the whole object.
I was able to make it using a simple linear gradient that melts with the background color, i was complicating things too much trying to make the gradient transparent.

static void apply_gradient_in(lv_obj_t *obj)
{
    lv_obj_set_style_bg_color(obj, <bg_color>, 0);
    lv_obj_set_style_bg_grad_color(obj, <obj_color>, 0);
    lv_obj_set_style_bg_grad_dir(obj, LV_GRAD_DIR_HOR, 0);
}

static void apply_gradient_out(lv_obj_t *obj)
{
    lv_obj_set_style_bg_color(obj, <obj_color>, 0);
    lv_obj_set_style_bg_grad_color(obj, <bg_color>, 0);
    lv_obj_set_style_bg_grad_dir(obj, LV_GRAD_DIR_HOR, 0);
}

<bg_color> is backgroung color;
<obj_color> is the color of the static object to fade in/out;

Complex gradients can be achieved using images and bars

as far as I understand in lvgl v9 this effect could be realized with bg_grad_opa & bg-main-opa

//While executing this method, I am sending object which I want to give gradient (ptrObj); GradientStopInfo which is struct type which contains color, fraction & opacity; gradientDirection which can be horizontal or vertical; and gradientStopCount which contains total number of gradient stops. 
_declspec(dllexport) void Set_ObjectBackColor_Gradient(lv_obj_t* ptrObj, struct GradientStopInfo* gradientStopInfo, int gradientDirection, int gradientStopCount) 
{
    if (ptrObj != NULL)
    {
        //Reset Opacity
        lv_obj_set_style_bg_opa(ptrObj, 255, LV_PART_MAIN); //setting whole object opacity as 255 mean "No transparent".
        lv_grad_dsc_t* grad_dsc = lv_malloc_zeroed(sizeof(lv_grad_dsc_t)); // used lv_malloc_zeroed to apply changes to selected object only.
        grad_dsc->dir = gradientDirection;
        grad_dsc->stops_count = gradientStopCount;

        for (int i = 0; i < gradientStopCount; i++) //fill grad_dsc using available colors in gradientStopInfo
        {
            grad_dsc->stops[i].color = lv_color_hex(((UINT32)gradientStopInfo[i].color)); //color
            grad_dsc->stops[i].frac = gradientStopInfo[i].fraction * 255; //gradient stop location
            grad_dsc->stops[i].opa = gradientStopInfo[i].opacity; //in place of 255 just pass 0 as an opacity for your last few colors of 'stops' array to make it transparent.
        }

        lv_obj_set_style_bg_grad(ptrObj, grad_dsc, LV_PART_MAIN); //applying changes (grad_dsc) to selected object only (ptrObj).
    }
}

I think that this my implemented code may help you. Currently, I have not applied transparent option to each stop. Please, refer my screenshot for more references.
ImageHGradient