[Interest] Duration property of PropertyAnimation

Marco Trapanese marcotrapanese at gmail.com
Tue Jul 3 20:51:20 CEST 2018


Hi to all,
I'm working on a project that use Qt 5.9.2 on RPi3B+, with eglfs platform.

Here a full working code:

> import QtQuick 2.9
> import QtQuick.Window 2.3
>
> Window {
>     visible: true
>
>     property real _degree: 0
>     property real _time: 50
>
>     Component.onCompleted: move()
>
>     function move()
>     {
>         _degree += 360 / 12
>         animStep.start()
>     }
>
>     Image {
>         source: "file:///home/pi/resources/images/needle.png"
>         x: 300
>         y: 400
>
>         transform: Rotation {
>             id: rotSpin
>             origin.x: 62
>             origin.y: 194
>         }
>     }
>
>     SequentialAnimation {
>         id: animStep
>         NumberAnimation { target: rotSpin; property: "angle"; 
> easing.type: Easing.Linear; to: _degree; duration: _time; }
>         onStopped: move()
>     }
> }


The purpose of this code is to animate an image like a clock hand. Of 
course this is a simple example, my actual code is more complex. The 
approach is to animate the needle for 30 degrees (360 / 12) and then 
advance for other 30 degrees. This is because I will need to stop the 
animation when certain conditions are met (i.e. I cannot set the 
animation 'to' property to 360 * N)

It works fine if the duration property is above about 45 ms. Below this 
threshold the animation doesn't speed up anymore. The docs say nothing 
about a minimum value.

I'm aware the refresh rate of the monitor doesn't allow faster 
animation, but I would expect the animation would complete in the given 
time (duration) even without any intermediate frames.

The problem here is instead it takes the same amount of time! I mean, 
even if I set duration = 10 ms, it take the same amount of time like 
when duration = 40 ms. Hence, I think it would complete a whole cycle in 
120 ms, instead it takes something like 480 ms!


Is there a way to force PropertyAnimation to honor the duration property 
even if it cannot draw intermediate frames?
Best regards
Marco





More information about the Interest mailing list