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

Scale image animation - performance issue



  • Hi,

    after reading this forum post: "performance images":http://developer.qt.nokia.com/wiki/Performance_tip_Images
    I wondered how is it possible to get a smooth and velvet scaling animation?

    Is there probably a possibility to improve the performance of my scaling animation?
    That's how I implemented it right now:

    That's the image
    @
    Image {
    id: item

                scale: 0.800
                clip: false
    
                anchors.left: tachoitem.left
                anchors.top: tachoitem.top
                anchors.leftMargin: 210
                anchors.topMargin: 30
    
    
                source: "images/item.png"
                sourceSize.width: 370
                sourceSize.height: 370
                smooth: true
    
            }@
    

    That's the Animation
    @ParallelAnimation {
    id: scaleoutLeft
    running: scaleout

                NumberAnimation { target: item; easing.type: Easing.InExpo;property: "x"; to: 100; duration: 1000 }
             
                NumberAnimation { target: item; property: "scale"; to: 1; duration: 1000 }
            }@
    

    Thanks



  • What is your type of viewport? QGLWidget?



  • Yes i am using qglwidget.



  • Hi,

    One of the tips on the wiki is:

    bq. If you really need to enable Image.smooth, disable smooth filtering at the beginning of the animation and re-enable it at the end of the animation (scaling artifacts are only visible if the image is stationary on the screen)

    That is what I would suggest in this case. In general this looks something like:

    @
    SequentialAnimation {
    PropertyAction { target: item; property: "smooth"; value: false }
    NumberAnimation { target: item; property: "scale"; to: 1; duration: 1000 }
    PropertyAction { target: item; property: "smooth"; value: true }
    }
    @

    Regards,
    Michael



  • Scaling of images when done on OpenGL is 'free'.

    But, notice that anchors/positions are reevaluated on every scale step, so I think performance issue when doing scaling are there (can somebody confirm?).



  • Ok, I will try to turn off antialiasing during the animation and post the results later. Thank you


Log in to reply