UIView 进行各种动画展示及其用法解释
来源:互联网 发布:php wms 编辑:程序博客网 时间:2024/05/20 20:01
//第一种动画方式
- (void) first_animations
{
[UIView beginAnimations:nil context:nil]; //启动动画动作
[UIView setAnimationRepeatCount:1];//设置是否重复播放
[UIView setAnimationDuration:1];//设置动画持续时间
[UIView setAnimationCurve:UIViewAnimationCurveEaseIn]; //动画曲线,具体的应用 ,可以经过实验检测
[UIView setAnimationDelegate:self];//动画块的某个方法(最下方),委托到本类的实例
[UIView setAnimationDidStopSelector:@selector(resetView)];//动画结束后去执行的方法
CGAffineTransform oneTransform = CGAffineTransformRotate(self.animatView.transform, degreesToRadian(180));//进行 CGAffineTransform 方式的动作(旋转拉伸等等)===>(对于CGAffineTransform 可以另外开辟一个关于CGAffineTransform使用详情的文章进行专门介绍 )
CGAffineTransform twoTransform = CGAffineTransformTranslate(self.animatView.transform,0,-100);
CGAffineTransform newTransform = CGAffineTransformConcat(oneTransform, twoTransform);
[self.animatView setTransform:newTransform];
[UIView commitAnimations];//有些网友说,这是动画结束.起始经过本人尝试试验.其实应该是,执行上方定义的动画块内容.
}
//第二中动画定义方式
- (void) second_animations
{
CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"opacity"];
[animation setDuration:1];
[animation setRepeatCount:0];
[animation setAutoreverses:YES];//自动反向动画
[animation setFromValue:[NSNumber numberWithFloat:1.0]];
[animation setToValue:[NSNumber numberWithFloat:0]];
[animation setDelegate:self];
[self.animatView.layer addAnimation:animation forKey:@"firstView-Opacity"];
}
- (void) third_animations
{
[UIView beginAnimations:nil context:nil];
[UIView setAnimationRepeatCount:1];
[UIView setAnimationDuration:1];
[UIView setAnimationCurve:UIViewAnimationCurveEaseIn];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:self.containView cache:YES];
[UIView setAnimationDidStopSelector:@selector(animationDidStop:finished:)];
[UIView commitAnimations];
}
- (void) fourth_animations
{
CATransition *transition = [CATransition animation];
transition.duration = 1.0f; /* 间隔时间*/
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; /* 动画的开始与结束的快慢*/
transition.type = @"pageCurl"; //@"cube" @"moveIn" @"reveal" @"fade"(default) @"pageCurl" @"pageUnCurl" @"suckEffect" @"rippleEffect" @"oglFlip"
transition.subtype = kCATransitionFromRight;
transition.removedOnCompletion = YES;
transition.fillMode = kCAFillModeBackwards;
transition.delegate = self;
[self.animatView.layer addAnimation:transition forKey:nil];
}
-(void) resetView
{
[self.animatView setTransform:CGAffineTransformRotate(self.animatView.transform, degreesToRadian(180))];
self.animatView.frame = CGRectMake(0, 0, 280, 200);
}
#pragma mark Delegate Methods
- (void)animationDidStop:(CAAnimation *) theAnimation finished:(BOOL) flag {
self.animatView.frame = CGRectMake(0, 0, 280, 200);
}
#define degreesToRadian(x) (M_PI * (x) / 180.0)
================再次挖井的分割线07.11=============
- UIView 进行各种动画展示及其用法解释
- UIView 进行各种动画展示及其用法解释
- UIVIEW 动画接口解释
- UIView 的各种动画效果
- UIView 的各种动画效果
- UIView的各种动画详解
- UIView的各种动画效果
- listview展示:帧动画各种动画实现
- UIView动画的具体用法
- UIView 用法展示 CGAffineTransformIdentity CGAffineTransformMakeTranslation CGAffineTransformMakeScale
- UIView中动画及其属性说明
- 各种算法动画展示,效果不错。
- Java中各种异常类及其解释
- IPhone中UIView中动画及其属性说明
- IPhone中UIView中动画及其属性说明
- mysql-explain 展示的各种信息的解释
- UIView动画
- UIView 动画
- Quartz 2d中的图形变换
- CAPS的编译器支持AMD的GPU和APU了!
- JavaScript中的闭包之我见
- spring 事务管理(转)
- .Net锦囊-C#,.Net发送邮件三种方法(Localhost,SMTP,SSL-SMTP)
- UIView 进行各种动画展示及其用法解释
- 你是奥运志愿者么?
- 个别图片IE中无法显示问题
- .Net中,如何在页面上显示PDF文档
- listview获得每一项的点击,长按,滑动事件
- nginx+python+fastcgi环境配置(flup版本)
- android C/C++ source files 全局宏定义
- Android中Canvas的clipRect参数Region.OP的理解
- IOS开发UI篇之──键盘添加工具条