UIView 进行各种动画展示及其用法解释
2012-06-07 10:09
155 查看
//第一种动画方式
- (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=============
- (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 进行各种动画展示及其用法解释
- IPhone中UIView中动画及其属性说明
- ios:UIView动画总结[转]IPhone中UIView中动画及其属性说明[转]详解UIScrollView[转]以及cocos2d框架简介[转]Automator重命名文件介绍[转]
- IPhone中UIView中动画及其属性说明
- UIView 的各种动画效果
- UIView进行动画时,设置其依然可以响应用户操作
- UIView的各种动画效果
- UIView做各种动画的demo
- UIView动画的具体用法
- 各种效果动画操作展示(放大、缩小、旋转、翻转等)
- UIView的各种动画详解
- Android之---动画(Animation)大全(各种动画的属性,用法详细介绍)
- 详解iPhone中UIView动画各种表现方式 参考文档 (上)
- UIView 用法展示 CGAffineTransformIdentity CGAffineTransformMakeTranslation CGAffineTransformMakeScale
- 详解iPhone中UIView动画各种表现方式 参考文档 (下)
- c++ vector各种函数介绍及其用法
- C#-WebForm-★★★LinQ-数据的条件组合查询并进行分页展示(未加各种限定)★★★
- IPhone中UIView中动画及其属性说明
- CSS 各种滤镜代码解释 用法案例
- UIVIEW 动画接口解释