rotating circle with swipe question

Posted by Joe on Stack Overflow See other posts from Stack Overflow or by Joe
Published on 2010-05-25T02:22:48Z Indexed on 2010/05/25 2:31 UTC
Read the original article Hit count: 279

Filed under:
|

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?

© Stack Overflow or respective owner

Related posts about iphone

Related posts about objective-c