1
有窗戶,其佈局由states and transition
設計。我們知道當狀態改變時,transition-animation
會自動啓動,但當轉換動畫沒有完成時,我改變狀態,這會造成麻煩。就像slow in reacting
;如何解決它?謝謝...如何停止QML中的過渡動畫?
它是這樣的:
Flickable {
id: content anchors.fill: parent flickableDirection: Flickable.HorizontalFlick contentWidth: width * 2 contentHeight: height clip: true onFlickStarted: { if(horizontalVelocity > 0) { regAndFind.state = "Find" } else { regAndFind.state = "Register" } } ....... }
states: [
State {
name: "Register"
PropertyChanges {
target: slider
x: 0
}
PropertyChanges {
target: content
contentX: 0
}
},
State {
name: "Find"
PropertyChanges {
target: slider
x: parent.width/2
}
PropertyChanges {
target: content
contentX: parent.width
}
}
]
transitions: [
Transition {
NumberAnimation {
target: slider
property: "x"
duration: 600
}
NumberAnimation {
target: content
property: "contentX"
duration: 600
}
}
]