Defining an easing for QML PathView animation

141 Views Asked by At

I wrote this code in Qt 6.2.0 / QML under Ubuntu 20.04:

Component {
    id: delegate

    Item {
        id: item
        width: 864 * 0.6; height: 1536 * 0.6

        Image {
            width: parent.width * 0.95
            height: parent.height * 0.95
            source: modelData
            sourceSize: Qt.size(parent.width, parent.height)
            visible: true
            clip: false
        }
    }
}

PathView {
    id: view
    anchors.fill: parent
    anchors.bottomMargin: 150
    anchors.topMargin: 50
    pathItemCount: 3
    preferredHighlightBegin: 0.5
    preferredHighlightEnd: 0.5
    highlightRangeMode: PathView.StrictlyEnforceRange
    The : 3000
    snapMode: PathView.SnapToItem
    rotation: -90
    model:
        [
        base_path + "Resized80 03.png",
        base_path + "Resized80 04.png",
        base_path + "Resized80 05.png",
        base_path + "Resized80 06.png",
        base_path + "Resized80 08.png",
    ]
    delegate: delegate
    path: Path {
        startX: 0; startY: view.height / 2
        PathLine {x: view.width/2; y: view.height / 2 }
        PathLine {x: view.width; y: view.height / 2 }
    }
}

Timer {
    interval: 5000; running: true; repeat: true
    onTriggered: view.incrementCurrentIndex()
}

It changes the current item programmatically every 5 s. The highlightMoveDuration property set the duration of the animation, but I didn't find a way to specify the easing.

How to add this settings to the animation?

0

There are 0 best solutions below