Hi,
I'm searching for a way to create a menu in an iPhone app that allows buttons to rotate around a center point. To put this in visual terms: the buttons would be planets and the center is the sun.
- this would allow the user to 'spin' the buttons around the circular path.
** an actual example of this would be the Poynt menu for their iPhone app. **
I got started with this code, that I found from a post by mahboudz here on SO:
- (void) runSpinAnimationWithDuration:(UIView*)animatedView withDuration:(CGFloat) duration;
{
CABasicAnimation* rotationAnimation;
rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.y"];
rotationAnimation.toValue = [NSNumber numberWithFloat: M_PI * 2.0 /* full rotation*/ * 1 * duration ];
rotationAnimation.duration = duration;
rotationAnimation.cumulative = YES;
rotationAnimation.repeatCount = 1.0;
rotationAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut];
[animatedView.layer setAnchorPoint:CGPointMake( 0.5, 0.5 )];
[animatedView.layer addAnimation:rotationAnimation forKey:@"rotationAnimation"];
}
There is an interesting post on rotation here on SO: link text
Anyway, I can rotate a button - but not around a predetermined path (like the planet scenario).
Any help would be appreciated.