views:

30

answers:

1

I'm trying to create an animated meter (like the gas tank in your car). I can't seem to get CGAffineTransformMakeRotate to rotate past 180. I've attempted to do it in 2 separate animations (eg: rotate 180 degrees and then rotate the remaining degrees) but it looks terrible since the timing of the total animation changes frequently on user actions in the app.

How can I animate more than 180 degrees in one swoop? My existing code looks like this:

[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:duration];
[UIView setAnimationCurve:curve];
[UIView setAnimationBeginsFromCurrentState:YES];
imageView.layer.anchorPoint = CGPointMake(1, 0.5);
CGAffineTransform transform = CGAffineTransformMakeRotation(DEGREES_TO_RADIANS(degrees));
imageView.transform = transform;
[UIView commitAnimations];