rotating circle with swipe question
- by Joe
Okay so I'm making something that basically works as a knob, but only half on the screen -- so I just need horizontal swipes to cause it to rotate. I have it nearly all sorted with one exception: if you change direction of your swipe in mid-swipe, the rotation doesn't change direction. I even can see the problem, but not sure what to do about a solution.
So in my touchesMoved, I get the swipe into radians in the predictable way:
CGFloat radians = atan2f(location.y - centerY, location.x - centerX);
I then store radians, add/subtract it to previous rotation and then give the result to the CATransform3D.
So the prob is that even though the swipe changes direction, there is a "balance" which doesn't allow an immediate change of direction.
Does this make any sense?