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


What LVGL version are you using?


What do you want to achieve?

Why does using “lv_style_set_transform_zoom” cause the control to disappear? I used it for a button control, when I press it, the control disappears, did I miss the code?

What have you tried so far?

Code to reproduce

Add a code snippet which can run in the simulator. It should contain only the relevant code that compiles without errors when separated from your main code base.

The code block(s) should be formatted like:

/*        static lv_style_prop_t tr_prop[] = { LV_STYLE_TRANSFORM_ZOOM, LV_STYLE_TRANSFORM_HEIGHT, 0 };
        static lv_style_transition_dsc_t tr;
        lv_style_transition_dsc_init(&tr, tr_prop, lv_anim_path_linear, 100, 0, NULL);
        static lv_style_t style_def;
        lv_style_set_transition(&style_def, &tr);
        static lv_style_t style_pr;
       // lv_style_set_transform_width(&style_pr, 10);
       // lv_style_set_transform_height(&style_pr, 30);
        lv_style_set_transform_zoom(&style_pr, 100);
        lv_obj_add_style(imgbtn1, &style_def, 0);
        lv_obj_add_style(imgbtn1, &style_pr, LV_STATE_PRESSED);


Screenshot and/or video

If possible, add screenshots and/or videos about the current state.

I tried to run the official example,“lv_example_style_15” the same cannot be displayed normally

I want to make sure you are aware that the zoom function is a 0 to 255 number that is scaled for 0% to 100%… so if you wanted to use percentages it would be uint8_t (percentage * 2.55f)

Thanks for your reply.In fact, no matter what value I set, as long as I use “transform_zoom” or “transform_angle” for the object, the object will disappear and will no longer be displayed on the screen, but “transform_width” is valid.

instead of using a style try setting it directly on the object using lv_obj_set_style_transform_zoom. Maybe there is an issue with it in the styles but not if it gets set directly on the object.

I’m sorry to reply to you for so long, I’ve been very busy recently. I have tried your thoughts before, in fact LVGL files have lv_example_style_15.c example in the LVGL file, my Visual Studio Simulator cannot display it on the screen normally. So I’m wondering if it needs any changes in the display side to make the transform_zoom display normally.

so if you don’t zoom the image at all does it display properly?

Also how are you setting the image to the lv_img object?

code, I need to see all of the code. make sure to wrap the code like this

this is a code block

so it appears like this

this is a code block
In fact, this is an example of LVGL itself, and I have not modified it.

I do want to let you know that you are using example code for version 9.0 and not version 8.3. Tho the contents of that example are identical in this case I wanted to make sure that you use examples that are for the LVGL version you are using.

I did also want to mention that you are not using the same code that is in the example. You have modified the code. Have you tried running the code as is without making any changes to it?

obj_set_style_transform_pivot_x and obj_set_style_transform_pivot_y are only going to work with obj_set_style_transform_angle

by setting obj_set_style_transform_zoom to 10 you are making the button 3.9% of it’s normal size. This is too small for LVGL to display hence the reason why the button ends up not being able to be seen.

Thank you for your reply, I’m actually using the code of 8.3, this sample code has not changed from version 9.0, so I directly shared the code of 9.0. This is the display case before I changed it.