有窗口,其布局由states and transition
. 我们知道当状态改变时,transition-animation
会自动启动,但是当过渡动画没有完成时,我改变状态,就麻烦了。就像slow in reacting
; 如何解决?谢谢你...
它是这样的:
轻弹{
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
}
}
]