Im working on a dial that rotates when a user touches it and drags it around. So far so good, but when the dial gets to more than 360, the value goes back to 0, making the animation jump backwards around the dial instead of continuing.
dialRotation = (atan2(event->localY()-circleCenterY, event->localX()-circleCenterX) * (180/M_PI));
Does anyone know how to stop it from jumping?
You can use the existing value to determine if you should go beyond 360 or not. Perhaps something like this:
I think this will work in the negative direction, too, though I sometimes get confused by
fmod()s behavior for negative numbers, so be sure to check it.