QML中的抽屉动画

问题描述 投票:0回答:1

如何改变动画(即持续时间和缓和曲线)?Drawer 我试过了,但是没有效果。

PropertyAnimation{
            easing.type: Easing.InOutQuad
            easing.amplitude: 1000
            easing.period : 1000
}

(抱歉,QML中动画类型的多样性让我感到困惑,我无法尝试所有可能的选项)

qt animation qml
1个回答
1
投票

你需要覆盖Popup::enter过渡,如这里的文档。

https:/doc.qt.ioqt-5qml-qtquick-controls2-popup.html#enter-prop

注意,抽屉的实现对如何上屏和下屏做了很多假设,所以一不小心就很容易被破坏。

你可以在这里看到默认的。

https:/github.comqtqtquickcontrols2blobdevsrcimportscontrolsDrawer.qml。

    enter: Transition { SmoothedAnimation { velocity: 5 } }
    exit: Transition { SmoothedAnimation { velocity: 5 } }

所以,从那里开始,慢慢调整,直到你得到你想要的东西。

© www.soinside.com 2019 - 2024. All rights reserved.