[Interest] How to make a looping element?

Sze Howe Koh szehowe.koh at gmail.com
Mon Jan 29 23:53:15 CET 2018


On 30 January 2018 at 03:07, Jason H <jhihn at gmx.com> wrote:
>
> This is more like a rotation.. I'm looking for the other kind of rotation where bearing % 360 can go from 359 to 1, without sweeping backwards while animating the sweep.  Rather than sweep, I'd prefer to seek
> 0----90----180----270----360
>  ------>----------> increase
> <------------------ sweep back (how can I avoid this?)

Two things come to mind:

1. Use relative moves instead of absolute moves. E.g. instead of "359°
to 1°", do "359° + 2°"
2. Support values <= 0° and >= 360°. E.g. instead of "359° to 1°", do
"359° to 361°". After the animation is done, you can normalize "361°"
-> "1°" (optional)


Regards,
Sze-Howe

> Sent: Monday, January 29, 2018 at 1:23 PM
> From: "Ola Røer Thorsen" <ola at silentwings.no>
> To: No recipient address
> Cc: "interestqt-project.org" <interest at qt-project.org>
> Subject: Re: [Interest] How to make a looping element?
> Try the RotationAnimation item and set the direction property to shortest.
> http://doc.qt.io/qt-5/qml-qtquick-rotationanimation.html
>
> Cheers,
> Ola
>
>
> Den 29. jan. 2018 kl. 02.15 skrev Jason H <jhihn at gmx.com>:
>
>
> I am trying to make a compass control, something that shows 0-360, like a boat compass. It's got hash marks and numbers 350...0...10, etc. I have something that largely works, but when the position crosses over 360 to 0, the whole thing swings back around. It's very jerky, so I animate it, and it's got that nice smoothness. I've tried to use complete() to make the animation finish when it's a switch over, no luck.
>
> Does anyone have tips on how I can do this?



More information about the Interest mailing list