UIView动画效果之----翻转.旋转.偏移.翻页.缩放.取反的动画效
2024-09-03 19:23:55
- 翻转的动画
//开始动画
[UIView beginAnimations:@"doflip" context:nil];
//设置时常
[UIView setAnimationDuration:];
//设置动画淡入淡出
[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:];
//添加代理
[UIView setAnimationDelegate:self];
//获取transform的值
[manImageView setTransform:transform];
//关闭动画
[UIView commitAnimations];
- 偏移动画
[UIView beginAnimations:@"move" context:nil];
[UIView setAnimationDuration:];
[UIView setAnimationDelegate:self];
//改变它的frame的x,y的值
manImageView.frame=CGRectMake(,, ,);
[UIView commitAnimations];
- 翻页动画
[UIView beginAnimations:@"curlUp" context:nil];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];//指定动画曲线类型,该枚举是默认的,线性的是匀速的
//设置动画时常
[UIView setAnimationDuration:];
[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:];
[UIView setAnimationDelegate:self];
[manImageView setTransform:transform];
[UIView commitAnimations];
- 取反的动画效果是根据当前的动画取他的相反的动画
CGAffineTransform transform;
transform=CGAffineTransformInvert(manImageView.transform); [UIView beginAnimations:@"Invert" context:nil];
[UIView setAnimationDuration:];//动画时常
[UIView setAnimationDelegate:self];
[manImageView setTransform:transform];//获取改变后的view的transform
[UIView commitAnimations];//关闭动画
最新文章
- MySQL PXC构建一个新节点只需IST传输的方法
- python征程1.1(初识python)
- Oracle(修改表结构和约束)
- MySQL 创建表
- Jenkins_获取源码编译并启动服务(二)
- curl用法
- 学习笔记_Java_day13_三层的HelloWorld程序(15)--不错,整体三层架构学习
- HP DL360 G7通过iLO部署系统
- [置顶] 局部加权回归、最小二乘的概率解释、逻辑斯蒂回归、感知器算法——斯坦福ML公开课笔记3
- CentOS 6.4 + 曙光DS200 IPSan组建FTP服务器
- 【虚拟化实战】容灾设计之三Stretched Cluster
- Spring整合JMS-基于activeMQ实现(二)
- ajax数据请求2(json格式)
- PAT1019:General Palindromic Number
- socket通信的遇到的问题1
- (转)漫谈MySql中的事务
- sklearn学习笔记(一)——数据预处理 sklearn.preprocessing
- python 并发协程
- K-means算法实现
- js获取浏览器信息及版本(兼容IE)