PDA

View Full Version : How can I stop an infinite animation ? (with non-infinitive animation)



Yonetici
26th July 2012, 22:16
Hi,

I have a infinite animation and 1 loop animation in same QML file.

I want that when 1 loop animation complete itself, infinite animation also complete itself. But not stop, totally complete the animation. (maybe with complete() )

How can I do that?

Note: I want that, when 1 loop animation completes itself, all animations complete themselves. In this way, I can use all animations again and again with call them with different if situations.

Note 2 : Actually I want to know how can I determine if or not a animation complete itself ? Is there any special code for it?

Yonetici
27th July 2012, 16:33
ok I solved it :) maybe other people also need it:




Item {
id: the_item
height: 480
width: 854

Rectangle {
id:rect
height: 120
width: 300
color: "blue"
anchors.verticalCenter: the_item.verticalCenter
anchors.horizontalCenter: the_item.horizontalCenter

NumberAnimation on rotation { id: rot; from: 0; to:230; duration: 2000; loops: Animation.Infinite }

NumberAnimation on opacity { id: opa; from: 1; to: 0.5; duration: 2000; loops: 1 }

onOpacityChanged: {
if(rect.opacity == 0.5){
opa.stop();
rot.stop();
}
}

}

Rectangle {
id: button
height: 50
width: 50
color: "red"
anchors.right: parent.right
anchors.top: parent.top
anchors.rightMargin: 15
anchors.topMargin: 15

MouseArea {
anchors.fill: parent
onPressed: {
if(rect.opacity == 0.5){
opa.start();
rot.start();
}
}
}

}

}