Sliding objects animation
-
Hello,
let's say I have several QML objects and I want to show them one at time. When a new one is requested the current one should exit and the new one should enter.
I'm not going to rely on ready-to-use QML Types likeStackView
orSwipeView
because I might need to customize a lot the behavior and the animation.The main point is understand how to handle the reposition of the items.
Sample behavior:- at first, item
A
is shown at (0, 0), all other items are placed at (X, 0) i.e. off-screen on the right edge - when the item
C
is requested I start an animation to moveA
off-screen on the left side and letB
to enter from right. - now if another item is requested (
A
,B
, etc...) the same should happen. SoC
exits from the left and the new one enters from the right
The problem is I need to reposition each "exited" items off-screen on the right side in order to be ready for another request.
I could do this using a function that cycle all items and if they aren't the current one, it will move them to the idle position.
But I don't know how to programmatically reference a QML Object because the id is not a string. - at first, item