博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
UIView动画基础
阅读量:7145 次
发布时间:2019-06-29

本文共 2469 字,大约阅读时间需要 8 分钟。

1 Position 平移

[UIView animateWithDuration:1.0 animations:^{

_blueView.centerX = self.view.width -100;    _blueView.centerY = self.view.height -150;}];

2 Opacity 透明度

  • (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor whiteColor];
    _redView = [[UIView alloc]init];
    _redView.backgroundColor = [UIColor redColor];
    _redView.left = 100;
    _redView.top = 100;
    _redView.height = 100;
    _redView.width = 100;
    [self.view addSubview:_redView];
    }

-(void)touchesBegan:(NSSet<UITouch > )touches withEvent:(UIEvent *)event {

[UIView animateWithDuration:1.0 animations:^{    _redView.alpha = 0.3;}];

}

3 Scale 尺寸

[UIView animateWithDuration:1.0 animations:^{    _yellowView.transform = CGAffineTransformMakeScale(0.3, 0.3);}];

4 Ratation 偏移

[UIView animateWithDuration:1.0 delay:0 options:UIViewAnimationOptionRepeat animations:^{

_grayView.transform = CGAffineTransformRotate(_grayView.transform, M_PI);} completion:nil];[UIView animateWithDuration:1.0 delay:0 options:UIViewAnimationOptionRepeat | UIViewAnimationOptionAutoreverse animations:^{    _blackView.left = self.view.width -_blackView.width -50;} completion:nil];

UIViewAnimationOption

UIViewAnimationOptionLayoutSubviews //提交动画的时候布局子控件,表示子控件将和父控件一同动画。

UIViewAnimationOptionAllowUserInteraction //动画时允许用户交流,比如触摸

UIViewAnimationOptionBeginFromCurrentState //从当前状态开始动画

UIViewAnimationOptionRepeat //动画无限重复

UIViewAnimationOptionAutoreverse //执行动画回路,前提是设置动画无限重复

UIViewAnimationOptionOverrideInheritedDuration //忽略外层动画嵌套的执行时间

UIViewAnimationOptionOverrideInheritedCurve //忽略外层动画嵌套的时间变化曲线

UIViewAnimationOptionAllowAnimatedContent //通过改变属性和重绘实现动画效果,如果key没有提交动画将使用快照

UIViewAnimationOptionShowHideTransitionViews //用显隐的方式替代添加移除图层的动画效果

UIViewAnimationOptionOverrideInheritedOptions //忽略嵌套继承的选项

//时间函数曲线相关

UIViewAnimationOptionCurveEaseInOut //时间曲线函数,由慢到快

UIViewAnimationOptionCurveEaseIn //时间曲线函数,由慢到特别快

UIViewAnimationOptionCurveEaseOut //时间曲线函数,由快到慢

UIViewAnimationOptionCurveLinear //时间曲线函数,匀速

//转场动画相关的

UIViewAnimationOptionTransitionNone //无转场动画

UIViewAnimationOptionTransitionFlipFromLeft //转场从左翻转

UIViewAnimationOptionTransitionFlipFromRight //转场从右翻转

UIViewAnimationOptionTransitionCurlUp //上卷转场

UIViewAnimationOptionTransitionCurlDown //下卷转场

UIViewAnimationOptionTransitionCrossDissolve //转场交叉消失

UIViewAnimationOptionTransitionFlipFromTop //转场从上翻转

UIViewAnimationOptionTransitionFlipFromBottom //转场从下翻转

转载于:https://www.cnblogs.com/ritian/p/6364579.html

你可能感兴趣的文章
如何实现全屏遮罩(附Vue.extend和el-message源码学习)
查看>>
阿里:千亿交易背后的0故障发布
查看>>
利用angular4和nodejs-express构建一个简单的网站(十)—好友模块
查看>>
极光大数据告诉你,程序员们都在"愁"些啥?
查看>>
前端基础知识学习记录(三)
查看>>
LeanCloud + Ionic3 迅速重构应用
查看>>
chrome扩展推荐:帮你留住每一次ctrl+c --- Clipboard History 2
查看>>
Spring Web Services 3.0.4.RELEASE和2.4.3.RELEASE发布
查看>>
配置一次,到处运行:将配置与运行时解耦
查看>>
菜鸟成都未来园区启动,无人车首次进入园区调拨运输环节 ...
查看>>
算法不扎实的程序员,每个都很慌
查看>>
Element 2.6.3 发布,基于 Vue 2.0 的桌面端组件库
查看>>
基于kubeadm的kubernetes高可用集群部署
查看>>
定位「数字化助手」,腾讯想用服务创新助力产业智慧升级
查看>>
golang之sync.Mutex互斥锁源码分析
查看>>
SAP增强的PA教材内容
查看>>
C#使用Xamarin开发可移植移动应用(3.Xamarin.Views控件)附源码
查看>>
Java 模拟基于UDP的Socket通信
查看>>
有关 Windows Lite 的一切,只为对抗 Chrome OS?
查看>>
NG-ZORRO 7.0.1 发布,Ant Design 的 Angular 实现
查看>>