Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

ListView - SmoothedAnimation -> How to stop animation at specific item



  • I want to simulate scrooling and generally it works, but I don't know how to stop at specific item. Is there any parameter which set position, where animation should be stopped?
    Height of infinite list is 200 px.

                SmoothedAnimation
                {
                    target: listviewID
                    easing.type: Easing.InQuart
                    property: "contentY"
                    running: true
                    velocity: 4*200
                    duration: 1000
                    from: 0
                    to: 5 * 200
                }
    

    2302e66e-a671-47c1-9393-a7b6e878d9cf-obraz.png



  • Problem solved. It's working animation which changing items in ListView

                SmoothedAnimation
                {
                    id: animacja1
                    target: listviewID
                    easing.type: Easing.OutCubic
                    property: "contentY"
                    running: animacja_running
                    duration: animation_value * mainListView.animation_height
                    from: listviewID.contentY
                    to: listviewID.contentY + (mainListView.animation_value * mainListView.animation_height)
                }
    

    mainListView.animation_value - how many items. Value > 0 -> increasing index, Value < 0 -> decreasing index
    mainListView.animation_height - height of item

    You can change it using this function

        function xx_ustaw(x_value, x_height)
        {
            object_value3.animation_height = x_height
            object_value3.animation_value = x_value
            object_value3.animacja_running = true
        }
    

Log in to reply