I am trying to make visible animations sequential. I have a javascript function, which call myModel.move() two times. I have a GridView to show myModel and I have "Behavior on x" animation, thus I can visualy see the movements. But, both movement animatons runs in paralell (the small delay between them is not noticeable).
My idea was to add a counter of how many animations was started and how many of them already finished. Something like this;
Behavior on x {
NumberAnimation {
id: animationX;
duration: 500;
onRunningChanged: {
if (animationX.running) {
console.log("Animation start");
myModel.busy = myModel.busy + 1
} else {
console.log("Animation stop");
myModel.busy = myModel.busy - 1
}
}
}
}
This works as expected. Then, I add a loop to my javascript function to wait until all the animations finished.
ListModel {
id: myModel
property int busy: 0
function doSomething() {
myModel.move(...)
while (myModel.busy) {}
myModel.move(...)
}
}
Here is the problem. I can see that after the first move() all neccessary animations started, but nothing can be seen and none of the animation finished. I have some kind of a deadlock. How to solve this?