Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Jerky animation : no constant refresh rate
Forum Updated to NodeBB v4.3 + New Features

Jerky animation : no constant refresh rate

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 1 Posters 4.8k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Q Offline
    Q Offline
    qtnext
    wrote on last edited by
    #1

    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; }
        
    }
    

    }
    @

    1 Reply Last reply
    0
    • Q Offline
      Q Offline
      qtnext
      wrote on last edited by
      #2

      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 !!!

      1 Reply Last reply
      0
      • Q Offline
        Q Offline
        qtnext
        wrote on last edited by
        #3

        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 ?

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved