iOS UIView animation动画效果 (1)
来源:互联网 发布:百度ar扫描软件 编辑:程序博客网 时间:2024/06/03 02:26
转载: http://blog.csdn.net/richard_rufeng/article/details/9987667
UIView类的很多属性都设计为动画,动画的属性是指当属性从一个值变成另外一个值时可以支持动画,同时通知UIKit需要执行什么样类型的动画,UIView对象支持动画的属性有如下几个:
frame属性:可以使用该属性改变尺寸和位置
bounds:改变尺寸
center:改变视图的位置
alpha:改变视图的透明度
backgroundColor:改变视图的背景
contentStretch:改变视图内容如何拉伸
第二、
翻转的动画
//开始动画
[UIView beginAnimations:@"wap view" context:nil];
//设置时常
[UIView setAnimationDuration:1];
//设置动画淡入淡出
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
//设置代理
[UIView setAnimationDelegate:self];
//设置翻转方向
[UIView setAnimationTransition:
UIViewAnimationTransitionFlipFromLeft forView:manImageView cache:YES];
//动画结束
[UIView commitAnimations];
第二、旋转动画
创建一个CGAffineTransform transform对象
CGAffineTransform transform;
//设置旋转度数
transform = CGAffineTransformRotate(manImageView.transform,M_PI/6.0);
//动画开始
[UIView beginAnimations:@"rotate" context:nil ];
//动画时常
[UIView setAnimationDuration:2];
//添加代理
[UIView setAnimationDelegate:self];
//获取transform的值
[manImageView setTransform:transform];
//关闭动画
[UIView commitAnimations];
偏移动画
[UIView beginAnimations:@"move" context:nil];
[UIView setAnimationDuration:2];
[UIView setAnimationDelegate:self];
//改变它的frame的x,y的值
manImageView.frame=CGRectMake(100,100, 120,100);
[UIView commitAnimations];
翻页动画
[UIView beginAnimations:@"curlUp" context:nil];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];//指定动画曲线类型,该枚举是默认的,线性的是匀速的
//设置动画时常
[UIView setAnimationDuration:1];
[UIView setAnimationDelegate:self];
//设置翻页的方向
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:manImageView cache:YES];
//关闭动画
[UIView commitAnimations];
缩放动画
CGAffineTransform transform;
transform = CGAffineTransformScale(manImageView.transform,1.2,1.2);
[UIView beginAnimations:@"scale" context:nil];
[UIView setAnimationDuration:2];
[UIView setAnimationDelegate:self];
[manImageView setTransform:transform];
[UIView commitAnimations];
取反的动画效果是根据当前的动画取他的相反的动画
CGAffineTransform transform;
transform=CGAffineTransformInvert(manImageView.transform);
[UIView beginAnimations:@"Invert" context:nil];
[UIView setAnimationDuration:2];//动画时常
[UIView setAnimationDelegate:self];
[manImageView setTransform:transform];//获取改变后的view的transform
[UIView commitAnimations];//关闭动画
- iOS UIView animation动画效果 (1)
- ios UIView 动画效果
- iOS UIView动画效果
- iOS UIView动画实践(五):Keyframe Animation
- iOS UIView动画实践(五):Keyframe Animation
- ios uiview的动画效果
- iOS UIView动画 效果详解
- ios CALayer Core Animation UIView动画封装
- iOS开发UIView的Animation效果
- iOS开发UIView的Animation效果
- iOS关于Animation 动画效果
- iOS Animation各种动画效果
- iOS 动画Animation详解, UIView动画,CALayer动画
- iOS学习笔记59-UIView自带动画和核心动画(Core Animation)
- iOS 动画Animation详解, UIView动画(UIView属性动画,UIViewTransition动画,UIView Block动画),CALayer动画(CABasicAnima...)
- iOS 动画Animation详解, UIView动画(UIView属性动画,UIViewTransition动画,UIView Block动画),CALayer动画(CABasicAnima...)
- iOS 动画Animation详解, UIView动画(UIView属性动画,UIViewTransition动画,UIView Block动画),CALayer动画(CABasicAnima...)
- ios开发学习--动画(Animation)效果源码分享
- Smarty的初步使用
- 详解Dagger2
- Zox's code life 人生就是不停的战斗! xxx is not in the sudoers file.This incident will be reported.的解决方法
- Fragment切换与Activity状态丢失
- NSOperation的使用
- iOS UIView animation动画效果 (1)
- 第三周项目4:穷举法解决组合问题(5)委派任务
- 多线程--创建线程两种方式实例
- 尽量以const,enum,inline替换#define
- 最新的一些开源face alignment及评价
- 自制智能手机电话APP
- HDU-1003-Max Sum
- Java中ArrayList类的用法(转)
- 数字证书的基础知识