Parsa Mousavi
Parsa Mousavi

Reputation: 1182

Drawer animation in QML

How to change the animation (i.e duration and easing curve) of the Drawer type in QML? I've tried this :

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

But it has no effect.(Sorry but the diversity of animation types in QML has got me confused and I'm unable to try all possible options)

Upvotes: 0

Views: 844

Answers (1)

David K. Hess
David K. Hess

Reputation: 17246

You'll need to override the Popup::enter transition as documented here:

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

Note, the drawer implementation makes a lot of assumptions about how it gets on and off screen so it is easy to break it if you aren't careful.

You can see the default ones here:

https://github.com/qt/qtquickcontrols2/blob/dev/src/imports/controls/Drawer.qml

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

So, start from there and slowly tweak until you get what you want.

Upvotes: 2

Related Questions