1

有窗口,其布局由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
        }
    }
]
4

1 回答 1

1

阅读 Qml 中的动画元素

在移动到其他状态之前,您可以调用该Animation::stop ()函数以在其间停止动画。请注意,它会立即停止动画,并且动画不会对属性值产生进一步影响。

于 2013-04-16T13:10:20.637 回答