How can i control the interval of qml animation ?



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



  • Could you use a Timer element set to repeat?



  • 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) ?



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



  • 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



  • 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%.



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



  • No - I have not


Log in to reply
 

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