[Interest] Duration property of PropertyAnimation
Jérôme Godbout
godboutj at amotus.ca
Tue Jul 3 21:58:28 CEST 2018
Probably not the most helpful, but you could more easily fix this by doing a Behavior on the animation instead. But this is a reverse handling, the Transform will hold the Behavior which hold the NumberAnimation. The bahavior have an enabled property.
http://doc.qt.io/qt-5/qml-qtquick-behavior.html
Maybe this could help.
________________________________
From: Interest <interest-bounces+godboutj=amotus.ca at qt-project.org> on behalf of Marco Trapanese <marcotrapanese at gmail.com>
Sent: July 3, 2018 2:51 PM
To: interest at qt-project.org
Subject: [Interest] Duration property of PropertyAnimation
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
_______________________________________________
Interest mailing list
Interest at qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20180703/aa7fd897/attachment.html>
More information about the Interest
mailing list