What is wrong with the following for a conditional pause? This seems to cause a 
glitch where the first time the button is pressed the rotating rectangle jumps 
to the pause position. Bug?

import Qt 4.7

Rectangle {

    width: 640

    height: 480

    Rectangle{

        width: 200

        height: 200

        radius: 5

        border.width: 3

        anchors.centerIn: parent

        gradient: Gradient {

            GradientStop { position: 0.0; color: "grey" }

            GradientStop { position: 0.33; color: "darkgrey" }

            GradientStop { position: 1.0; color: "lightgrey" }

        }

        SequentialAnimation on rotation {

            NumberAnimation { from: 0; to: 180; duration: 700 }

            // Conditonal pause based on single line javascript if setting 
pause duration

            PauseAnimation { duration: buttonMouseArea.pressed ? 300 : 0 }

            NumberAnimation { from: 180; to: 360; duration: 700 }

            loops: Animation.Infinite

        }

    }

    Rectangle {

        width: 150

        height: 40

        radius:  5

        border.width: 3

        anchors.bottom: parent.bottom

        Text {

            text: "Pause when pressed"

            anchors.centerIn: parent

        }

        MouseArea {

            id: buttonMouseArea

            anchors.fill: parent

        }

    }

}



- Nigel

On Thu, Aug 26, 2010 at 9:11 PM,  
<[email protected]<mailto:[email protected]>> wrote:
On 27/08/2010, at 8:21 AM, ext Alex wrote:

SequentialAnimation {
 NumberAnimation {}
 ConditionalPauseAnimation { condition: myComponent.isReady }
 NumberAnimation {}
}

I can't think of anything currently available that's as elegant as the above -- 
could you add a suggestion for this in JIRA?

I just added QTBUG-13240.


You could try something like this to pause the animation:

SequentialAnimation {
   id: group
   NumberAnimation { to: 200 }
   ScriptAction { script: if (!myComponent.isReady) group.pause() }
   NumberAnimation { to: 400 }
}

and then elsewhere call group.resume() whenever the condition is met.

Thanks for the suggestion.  It is a little clunky but should work...

Cheers,
Alex

_______________________________________________
Qt-qml mailing list
[email protected]<mailto:[email protected]>
http://lists.trolltech.com/mailman/listinfo/qt-qml

_______________________________________________
Qt-qml mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt-qml

Reply via email to