I have decided to use animation instead of screen to focus/zoom on containers.
I just have a problem with the ‘direction’ of animation.
The animation don’t keep the anchor specified
with lv_obj_align, is this a known problem ?
I can solve it with an extra animation to move the container to the right, but may be there is a more clean solution ?
I hope I was clear
lv_obj_align is not an anchor. It is merely a convenient way of positioning an object. When you use an animation it will change the coordinates itself, and not use
lv_obj_align is only used to set the position at creation.
I will add another animator to move it, thanks.
lv_obj_align can be called as many times as you want (not just at object creation), but it’s not an anchor (you have to call it again if you resize the parent).
ok, I see. Thanks for the precision.
So I could call my own fonction in animation which call
Actually, there is a way to “anchor” objects. It’s called “auto realign”.
If you enable
lv_obj_set_auto_realign(obj, true) and then call
lv_obj_align(...) the library will save parameters from
lv_obj_align() and reapply them when the size has changed.
You can enable this feature with
LV_USE_OBJ_REALIGN 1 in lv_conf.h
And this is what happens when I get busy and forget the newer APIs. Sorry about that @sam76.
Hi! Sorry for resuming this old post, but I’m currently facing a similar issue.
I have 2 objects on the screen, one one the left and one on the right, which split the screen in two parts. After some time I would like to let the left item to smoothly transition of of view on the left and having the right one to fill the entire screen (i.e. align itself to the left border of the screen).
Moving the left object out of screen is easy by setting up an
lv_style_transition_dsc_t. The problem is that the right object does not follow it. Of course the two are aligned with
lv_obj_align_to on creation.
I just looked for
LV_USE_OBJ_REALIGN but I didn’t find any reference. Was that symbol renamed or the feature treated differently?
Edit: I forgot to mention that I’m using version 8.3
Well, it’s really something that we should find a solution for. However, it can be added only in v9.
Thanks for your reply! The version is not really a problem: I’m using 8.3 because that was the last official release when I started working on my project, but I can switch
Question: is there already an issue associated with this in GitHub? In case I’m willing to contribute, do you think this might be a “good first issue” to start from?
There is no issue track it at this moment. Please open one to track this feature.