Animation anchor


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 :smile:

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.

Ok so 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 lv_obj_set_width and lv_obj_align. Great.

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

Great ! thanks

And this is what happens when I get busy and forget the newer APIs. :man_facepalming:Sorry about that @sam76.

no problem, I understand :wink: