I am looking to achieve a “screen rotation” feature, via code. I can rotate images with “lv_img_set_angle(img, angle)”, but not a label.
Is there a way to rotate a label object?
Any ideas are much appreciated, as I would avoid building and maintaining 2 totally separate projects.
SLS now uses LVGL 8.2 but LVGL 8.3 can already rotate any widget. See here.
So you can update LVGL to v8.3.1 manually and add the rotation setting from code.
This is great, I will give it a go. Will come back with my findings.
Thank you very much for your help, I really appreciate it.
Hello, I have managed to install 8.3.1 (verified with lvgl arduino example and indeed the version is good).
However, I have tried 2 methods of transforming the angle (rotating) of both labels and images, like so:
static lv_style_t style;
lv_obj_add_style(ui_myImage, &style, 0);
lv_obj_set_style_transform_angle(ui_myLabel, 150, 0);
Nothing seems to work, the widgets/objects disappear.
I have also tried some copy/paste code from the docs, the obj is not rendering, doesn’t show up.
Any ideas? @kisvegabor
Probably you also need to enable
That was it! It’s written in the comments there that
LV_COLOR_SCREEN_TRANSP = 1 is needed for transform actions - I didn’t notice.
I was able to rotate a label with:
lv_obj_set_style_transform_angle(ui_myLabel, 900, 0);
Great! Thank for the feedback!