0
我正在寻找一种方法来在iPhone应用程序中创建一个允许按钮围绕中心点旋转的菜单。把它放在视觉上:按钮是行星,中心是太阳。围绕中心旋转按钮
- 这将允许用户'旋转'圆形路径周围的按钮。
**一个实际的例子就是他们iPhone应用程序的Poynt菜单。 **
我开始使用此代码,我从后发现mahboudz这里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"];
}
有上旋转了一个有趣的帖子在这里对这样:link text
无论如何,我可以旋转一个按钮 - 但不是围绕预定路径(如行星场景)。
任何帮助,将不胜感激。
感谢您的回答。无可否认,这是我第一次进入动画领域,因此我还没有得到任何正确的工作。 – CraigH 2010-03-12 16:45:54
这是什么?这是无用的一段代码。你是否提高重复账户的利率? – 2015-08-31 08:57:33