Jerky animation : no constant refresh rate



  • I am trying to have smooth animation but it seems that the refresh rate is not constant : I have a high end computer (Windows Seven) with an high end graphic card (I play on a 1920x1080 screen ... not an embedded platform with small screen) and even with a small animation (like the sample source code) I have some jerky movement. I've tryed in qmlviewer, embedded in a qdeclarativeView with or without opengl viewport and it's always the same. Is there a way to lock refresh to vertical screen blanking ? It seems I have a the same problem if this is a simple scene or a more complex ... i suspect it's not a performance trouble but perhaps a synchronisation issue. Have anyone obtain good smooth animation with QML ?

    @import Qt 4.7

    Rectangle {
    id: rectangle1
    width: 1920
    height: 1080

    Rectangle
    {
        id: logo
        x: 264
        y: -200
        width : 100
        height :100
        color :"red"
        anchors.horizontalCenter: parent.horizontalCenter
        SequentialAnimation {
            id : anim
            NumberAnimation { target: logo; property: "y"; easing.amplitude: 1.85; easing.type :"OutBounce"; to: 800; duration: 6000 }
            
        }
        Component.onCompleted:{anim.running=true; }
        
    }
    

    }
    @



  • I have done a lot of tests and it seems that the jerky movement is related to the refresh timing of NumberAnimation... after doing some search in qt source it seems that the timer of QAbstractAnimation has a granularity of 16ms ....

    I have replaced the NumberAnimation by a timer with a timeout of 10ms and I have now a smooth movement !!!



  • If I do this :

    @import Qt 4.7

    Rectangle
    {
    width:1920
    height:1080
    anchors.fill:parent
    color : "black"

    Timer
    {
    

    id :time
    interval: 10;
    running: true;
    repeat: true
    onTriggered:{ logo.y=logo.y+10;if(logo.y>800) logo.y=0;}
    }

    Rectangle
    {
    

    id: logo
    x: 264
    y: -200
    width : 40
    height :40
    color :"red"
    Component.onCompleted :time.start();
    }

    }
    @

    If you launch qmlviewer with -opengl it's perfectly smooth ... If you do the same with an animation you have a jerky movement .... I don't know if the only way is to hack qt to change the 16 ms timer resolution ?


Log in to reply
 

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