[Qt-qml] QML animations, an exercise in frustration...

15 views
Skip to first unread message

Harri Pasanen

unread,
Feb 13, 2012, 4:16:25 PM2/13/12
to qt-...@qt.nokia.com
Lately I've been thinking that perhaps I should write a series of example
applications on how not to do animations, as anything
more complex I've tried seems to end up in dismal failure.

In the hope that I and others can use my latest failure as a learning
experience, I lay it out in public here.

I'm attempting to make a "page" (the grid object below)
to go out left, get rewritten, and come in again from the right:

grid.x = 0 in the beginning.

Transition {
to: "nextPage";
SequentialAnimation {
NumberAnimation { target: grid; properties: "x"; to: -500;
duration: 3000;
easing.type: Easing.InOutQuad }
PropertyAction { target: grid; property: "x"; value: 500 }
ScriptAction { script: { setPageTitle()} }
NumberAnimation { target: grid; properties: "x"; to: 0;
duration: 3000;
easing.type: Easing.InOutQuad }
PropertyAction { target: grid; property: "state"; value: "" }
}


Now the steps in SequentialAnimation certainly don't seem to be
sequential despite its name. Or rather the Sequential only applies to
animation
parts, not the rest.

setPageTitle() gets called before the page has started to move, so
it is the new page that I see going out.

Nothing ever comes back in, as if the second NumberAnimation would not run.

How should I achieve this? It is certainly not intuitive to me.

I would expect animations to have isDone() signal or similar, where I
could trigger
the next state to go to. Then I could chain the together if I want.

If I have states A,B and C that an object to take consecutively,
procedurally,
from code, how to do that? Each state change has an attached animation
that
should run to end prior to next state happening.

Thanks,

Harri

PS. is there qt-project.org mailing list for this list?

_______________________________________________
Qt-qml mailing list
Qt-...@qt.nokia.com
http://lists.qt.nokia.com/mailman/listinfo/qt-qml

michael...@nokia.com

unread,
Feb 13, 2012, 5:11:07 PM2/13/12
to ha...@mpaja.com, qt-...@qt.nokia.com
Hi Harri,

Sorry to hear you are having issues with the animation framework.

Are you able to provide a small, runnable example demonstrating the issues you've described below? That would be very helpful for tracking down their cause.

In the case of the ScriptAction happening out of sequence, does the "nextPage" state have a PropertyChanges setting the new page? In general any property changes that are not explicitly touched by an animation will happen immediately, before the transition starts. It might be that this is being triggered in your case? (if you add console.log() output to setPageTitle(), is that being received in sequence?)

Regards,
Michael

Reply all
Reply to author
Forward
0 new messages