How to set the width of an image moving leftwards


Hello. I have an image whose width I would like to change during an animation. The position remains the same, but I would like the width to increase in the leftwards direction. I can easily do this animation with the width increasing in the right direction using lv_obj_set_width, but can’t figure out how I can mirror this behavior and have the image increase in width from right to left as the image remains in the same position.
Similarly, is there a way to have a “window” of an image displayed? As in, the right and left bounds of the viewable image are not at either the left or right edges of the image itself.

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

STM32G4 and custom HW. GDB compiler

What LVGL version are you using?


What have you tried so far?

I’ve messed around with the lv_obj_align, lv_obj_set_width, and lv_img_set_offset_x functions but can’t find a combination that works as desired.


Did you use lv_obj_realign() after changing the width of the object?