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. How can i control the interval of qml animation ?
Qt 6.11 is out! See what's new in the release blog

How can i control the interval of qml animation ?

Scheduled Pinned Locked Moved QML and Qt Quick
8 Posts 4 Posters 8.3k 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.
  • A Offline
    A Offline
    aabc
    wrote on last edited by
    #1

    I know how to set the duration but is there a way to set the interval of the animation ?

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on last edited by
      #2

      Could you use a Timer element set to repeat?

      1 Reply Last reply
      0
      • A Offline
        A Offline
        aabc
        wrote on last edited by
        #3

        When i use property animation the syntax is:

        PropertyAnimation {id: myAnimation; target: myRect; property: "width"; from: 4; to: 329; duration: 500}

        It means that myRect.width will grow from 4 to 329 in 500 ms.
        My question is how can set the interval of the change to be every 4ms for example (the "repainting" interval) ?

        1 Reply Last reply
        0
        • A Offline
          A Offline
          andre
          wrote on last edited by
          #4

          You can not control that interval, AFAIK. Qt will calculate the steps based on the refresh rate (in theory).

          1 Reply Last reply
          0
          • M Offline
            M Offline
            mbrasser
            wrote on last edited by
            #5

            Hi,

            Can you give any more detail about why you want to control the interval? As I understand it, usually the screen refresh interval is 16ms, and a smaller interval translates to more work each frame without visual effect.

            In Qt Quick 2 the animation timer will be synced to the screen refresh (see http://labs.qt.nokia.com/2010/12/02/velvet-and-the-qml-scene-graph/ for some more details), while in Qt Quick 1 it is hard-coded to 16ms. There is a private/undocumented API for setting the interval -- see the QUnifiedTimer code in src/corelib/animation/qabstractanimation_p.h. Whether setting small values has the intended effect may depend on the underlying timer resolution.

            Regards,
            Michael

            1 Reply Last reply
            0
            • A Offline
              A Offline
              aabc
              wrote on last edited by
              #6

              My problem is:

              I'm running an application that using Qml animation, my graphic system is openGL.
              When the application is running over a screen with refresh rate of 75Hz the CPU consumption is about 5%, but when the application is running over a screen with refresh rate of 60Hz (on the same computer - i just changing the refresh rate) the CPU consumption is climbing to 60%.

              1 Reply Last reply
              0
              • B Offline
                B Offline
                billouparis
                wrote on last edited by
                #7

                Wow, did you ever get an explanation of your last comment?
                Bill

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  aabc
                  wrote on last edited by
                  #8

                  No - I have not

                  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