How to zoom label widget

I can use this function to make animation to an img widget, but cannot applly it to a label widget . I know using style can zoom a label,but I don’t need style to control an animation effect. Do you have any suggestions ?

The C code :
void anim_img_zoom(lv_obj_t* obj, int delay, uint32_t period, int from, int to)
{
lv_anim_t anim;
lv_anim_init(&anim);
lv_anim_set_time(&anim, period);
lv_anim_set_user_data(&anim, obj);
lv_anim_set_custom_exec_cb(&anim, lv_img_set_zoom);
lv_anim_set_values(&anim, from, to);
lv_anim_set_path_cb(&anim, lv_anim_path_linear);
lv_anim_set_delay(&anim, delay + 0);
lv_anim_set_early_apply(&anim, false);
lv_anim_set_ready_cb(&anim, zoom_none);
lv_anim_start(&anim);
}

Take a look at this:

@kisvegabor
Hi,I have seen this example,in fact i need this effect that can gradually magnify the label widget.It’s a animation effect,not an instant that magnify the label widget .

I think can make a custom function for “lv_anim_set_exec_cb” . One by one instant will look like a animation.

@kisvegabor @wilson

Hi,What you said is not the effect that i want. So far this is the effect that you said,This only can make the transparency smaller immediately, but i want to let the transparency of label gradually smaller in style.Could you give me some suggestions again?
ezgif.com-gif-maker (1)

these are C code:

static void style_trans_small_x(lv_obj_t* obj, int delay, uint32_t period, int from, int to)
{
static const lv_style_prop_t props[] = { LV_STYLE_WIDTH, LV_STYLE_HEIGHT, LV_STYLE_TRANSFORM_PIVOT_X, LV_STYLE_TRANSFORM_PIVOT_Y, LV_STYLE_TRANSFORM_ZOOM, 0 };
static lv_style_transition_dsc_t trans_def;
lv_style_transition_dsc_init(&trans_def, props, lv_anim_path_linear, period, 0, NULL);
static lv_style_transition_dsc_t trans_pr;
lv_style_transition_dsc_init(&trans_pr, props, lv_anim_path_linear, period, 0, NULL);

static lv_style_t style_def;
lv_style_init(&style_def);
lv_style_set_opa(&style_def, LV_OPA_90, 0);
lv_style_set_transition(&style_def, &trans_def);

static lv_style_t style_pr;
lv_style_init(&style_pr);
lv_style_set_transform_zoom(&style_pr, to);
lv_style_set_opa(&style_pr, LV_OPA_10, 0);

lv_style_set_transition(&style_pr, &trans_pr);

lv_obj_add_style(obj, &style_def, 0);
lv_obj_add_style(obj, &style_pr, LV_STATE_PRESSED);

}

Who can help me?

void fade_anim_cb(void * obj, int32_t v)

{
lv_obj_set_style_img_opa(obj, v, 0);
}

void fade_in_anim_ready(lv_anim_t * a)
{
lv_obj_remove_local_style_prop(a->var, LV_STYLE_OPA, 0);
}

    lv_anim_t a;
lv_anim_init(&a);
lv_anim_set_path_cb(&a, lv_anim_path_ease_in_out );
lv_anim_set_var(&a, ui->screen_demo);
lv_anim_set_time(&a, SWITCHING_DYNAMIC_DELAY);
lv_anim_set_repeat_count(&a, 0);
lv_anim_set_exec_cb(&a, set_zoom);
lv_anim_set_values(&a, 256, 204);
lv_anim_start(&a);


lv_anim_set_values(&a, LV_OPA_100, LV_OPA_50);
lv_anim_set_exec_cb(&a, fade_anim_cb);
lv_anim_set_ready_cb(&a, fade_in_anim_ready);
lv_anim_set_time(&a, SWITCHING_DYNAMIC_DELAY);
lv_anim_set_delay(&a, 0);
lv_anim_start(&a);

This is my code .