IOS几种实现动画的方式
2015-07-22 21:10
507 查看
1. 使用基本关键帧动画CABasicAnimation
特点:可做3D动画
详细介绍可参看两个帖子:
http://blog.csdn.net/iosevanhuang/article/details/14488239
/article/7693388.html
注:( 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)
如:
2. 使用UIView关键帧动画animateKeyframesWithDuration
如:
3.使用UIView animateWithDuration
如:
特点:可做3D动画
详细介绍可参看两个帖子:
http://blog.csdn.net/iosevanhuang/article/details/14488239
/article/7693388.html
注:( 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]; }];
相关文章推荐
- iOS持续部署平台(一):SHENZHEN
- iOS OC06_省市区字典数组
- IOS使用Charts
- 【iOS】线程安全的文件读写
- iOS_导入libxml2.2框架后,找不到<libxml/tree.h>的解决办
- CTM transforms vs Affine Transforms in iOS (for translate, rotate, scale)
- iOS开发入门(好东西)
- ThemeManager主题切换(1)
- iPhone/iOS图片相关(读取、保存、绘制、其它相关)
- 猫猫学iOS之小知识之_xcode插件的删除方法_自动提示图片插件KSImageNamed有时不灵_分类或宏之类不能自动提示,
- 猫猫学iOS之小知识之xcode6自动提示图片插件 KSImageNamed的安装
- 苹果iOS苹果公司的手机用户都有权索赔
- iOS_NSNotificationCenter(通知中心简单建立)
- 小胖说事33-----iOS给Lable字体添加行间距
- swfit中文学习
- 【直播预告】7月26日iOS免费公开课答疑第三期,有奖问答!
- iOS 图片相册调用封装
- iOS 敏捷开发,常用的宏
- iOS 倒计时NSTimer
- iOS —— 崩溃闪退日志