I am trying to rotate an image. The wheel animation is required to go back and forth as if it were generating momentum and on release it will turn clockwise.
I have all that working however, on first touch the wheel jumps as its starting point has become from where my finger touchdown rather than from its current standing position. I understand why its doing it but i have no idea how make it so there is no jump.
Code:
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch = [touches anyObject];
CGPoint location = [touch locationInView:wheelImage];
xleg = location.x-starttoset.x;
yleg = location.y-starttoset.y;
swipetimer = CFAbsoluteTimeGetCurrent();
CGAffineTransform transforms;
location = [touch locationInView:wheelImage];
float theAngle = atan2( location.y-wheelImage.center.y, location.x-wheelImage.center.x );
transforms = CGAffineTransformConcat(spinningWheelImage.transform,CGAffineTransformMakeRotation(theAngle));
}
I realise i should be using degrees however, This doesnt allow the anti-clockwise animation.
Code:
totalRadians += fabs(theAngle - totalRadians);
totalRadians = fmod(totalRadians, 2*M_PI);
Any ideas for i can resolve this?