【发布时间】:2013-04-18 09:15:25
【问题描述】:
我正在创建具有如此多自定义的应用程序。从某种意义上说,定制,我想给我的应用程序带来新的面貌。在自定义部分,我想在我的应用程序中添加THIS 类型的动画。
我在互联网上搜索了最后我发现了这么多 3d 动画。但这些结果并不能满足我的需求。
建议我一些代码来使该动画成为可能。
如果你提供任何源代码,那对我真的很有帮助。
【问题讨论】:
标签: iphone ipad animation core-graphics
我正在创建具有如此多自定义的应用程序。从某种意义上说,定制,我想给我的应用程序带来新的面貌。在自定义部分,我想在我的应用程序中添加THIS 类型的动画。
我在互联网上搜索了最后我发现了这么多 3d 动画。但这些结果并不能满足我的需求。
建议我一些代码来使该动画成为可能。
如果你提供任何源代码,那对我真的很有帮助。
【问题讨论】:
标签: iphone ipad animation core-graphics
这正是你想要的。像这样设置你的视图。 _transitionFrame 是标签出口。该标签放置在您的显示视图上。
包含 QuartzCore 框架并定义一个方法来将度数转换为弧度,像这样
#import <QuartzCore/QuartzCore.h>
#define DEGREES_TO_RADIANS(angle) ((angle) / 180.0 * M_PI)
在视图中确实加载方法写了以下代码。
- (void)viewDidLoad
{
CGRect preFrame=_transitionFrame.frame;
preFrame.origin.y+=preFrame.size.height/2;
[_transitionFrame setFrame:preFrame];
[UIView beginAnimations:nil context:nil];
CATransform3D _3Dt = CATransform3DRotate(_transitionFrame.layer.transform,DEGREES_TO_RADIANS(90), 1.0, 0.0,0.0);
[UIView setAnimationRepeatAutoreverses:YES];
[UIView setAnimationRepeatCount:100];
[UIView setAnimationDuration:1];
[_transitionFrame.layer setAnchorPoint:CGPointMake(0.5, 1)];
_transitionFrame.layer.transform=_3Dt;
[UIView commitAnimations];
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
【讨论】: