smooth animation



  • I'm using QML 4.7

    I'm animating a panning background in my interface like so:

    		Image{
    			id: skylineLayer01
    			source: "skyline_layer01.png"
    			smooth: true
    		    NumberAnimation {
    				id: skylineLayer01_anim
    				target: skylineLayer01
    				properties: "x"
    				from: 0.0
    				to: 0.0 - (skylineLayer01.width-1080)
    				loops: Animation.Infinite
    				duration: 240 * 1000
    			}
    			Component.onCompleted:{
    				skylineLayer01_anim.start();
    			}
    		}
    

    The image is 3128px wide, so it's moving slowly... the animation is not smooth until I go down to something around a duration of 60 * 1000. However, I really need the slow animation and I need it to be smooth. I can't tell if maybe qml doesn't do subpixel rendering and that's what I'm seeing? or maybe it's an issue with synchronizing the animation and the frame rate? Can anyone help with this?

    Thanks!!



  • I'm experimenting a bit with QML as we speak, but classically using standard Qt4/Qt5 you would have an EventTimer() (specified by some msec timer update) and a Paint() function that you can override in your Draw class doing the screen update. (Actually another approach is possible as well)

    But basically, inside the Paint() update you would do the drawing & animation needed. QML may have something similar in updatePaintNode().

    Hope that helps,
    -Vince


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.