IOS几种实现动画的方式
来源:互联网 发布:python 定时执行函数 编辑:程序博客网 时间:2024/06/03 01:58
1. 使用基本关键帧动画CABasicAnimation
特点:可做3D动画
详细介绍可参看两个帖子:
http://blog.csdn.net/iosevanhuang/article/details/14488239
http://blog.csdn.net/wscqqlucy/article/details/8669636
注:( CGAffineTransform 和 CATransform3D 的比较 )
CGAffineTransform is used for 2-D manipulation of NSViews, UIViews, and other 2-D Core Graphics elements.
CATransform3D is a Core Animation structure that can do more complex 3-D manipulations of CALayers.( 搬运from stackOverFlow)
如:
CABasicAnimation* animation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.y"]; animation.fromValue = @(0); animation.toValue = @(-M_PI); animation.repeatCount = 0; animation.duration = 0.4; [aUIView.layer addAnimation:animation forKey:@"rotation"]; CATransform3D transform = CATransform3DIdentity; transform.m34 = 1.0 / 500.0; aUIView.layer.transform = transform;
2. 使用UIView关键帧动画animateKeyframesWithDuration
如:
[UIView animateKeyframesWithDuration:durationTime delay:0 options:0 animations:^{ [UIView addKeyframeWithRelativeStartTime:0*frameDuration relativeDuration:1*frameDuration animations:^{ weakSelf.pickGradeView.transform = CGAffineTransformMakeScale(0.01, 0.01); }]; [UIView addKeyframeWithRelativeStartTime:1*frameDuration relativeDuration:1*frameDuration animations:^{ weakSelf.pickGradeView.alpha = 1.0; }]; } completion:^(BOOL finished) { }];
3.使用UIView animateWithDuration
如:
__weak typeof(self) weakSelf = self; [UIView animateWithDuration:1.0 delay:0.0 usingSpringWithDamping:1.0 initialSpringVelocity:0.5 options:0 animations:^{ __strong typeof(weakSelf) strongSelf = weakSelf; strongSelf.shortNameLabel.transform = CGAffineTransformMakeScale(0.8, 0.8); } completion:^(BOOL finished) { [UIView animateWithDuration:0.4 delay:0.0 usingSpringWithDamping:0.5 initialSpringVelocity:0.5 options:0 animations:^{ __strong typeof(weakSelf) strongSelf = weakSelf; strongSelf.shortNameLabel.transform = CGAffineTransformMakeScale(1.0, 1.0); } completion:nil]; }];
0 0
- ios 实现动画的几种方式
- IOS几种实现动画的方式
- IOS中的几种动画的实现方式
- iOS 旋转动画的几种实现方式
- 属性动画的几种实现方式
- iOS播放GIF动画的几种方式
- iOS 多线程的几种实现方式
- IOS的动画实现方式
- 随笔--帧动画的几种简单实现方式
- Android动画的几种实现方式总结
- iOS开发-autolayout动画效果实现的几种方法
- IOS中实现动画的三种方式
- iOS 简单动画效果实现的三种方式
- iOS 动画的实现方式和代码
- iOS中多线程的几种实现方式
- ios中打电话功能实现的几种方式
- ios中发短信功能实现的几种方式
- ios中发邮件功能实现的几种方式
- rabbitmq基本原理
- cf 558A Lala Land and Apple Trees
- 类 & 对象
- Junit4 框架学习
- windows2008允许多用户同时登录
- IOS几种实现动画的方式
- vlc在ubuntu15.04下安装成功(解决sudo apt-get build-dep vlc失败问题)
- 无线网络安全--BackTrack 的U盘启动盘制作
- Codeforces 452 A. Eevee
- Why SeaJS
- NYOJ 523 亡命逃窜(3维bfs+队列)
- Makefile 选项 CFLAGS 、LDFLAGS 、LIBS
- Hibernate 建立一对多双向关联关系
- 安装Navicat Premium