#pragma mark - CAAnimation类、实现动画
#pragma mark ** CABasicAnimation 动画 - (IBAction)handleCABasicAnimation:(id)sender { /* 创建动画类的对象 */
CABasicAnimation *basic = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"]; /*初始值*/
basic.fromValue = [NSNumber numberWithInt:];
basic.toValue = [NSNumber numberWithInt:]; /* 动画的相关设置 */
basic.duration = ;
basic.repeatCount = NSIntegerMax; /* 添加到相关的View的layer属性上 */
[self.myView.layer addAnimation:basic forKey:@"basic"]; } #pragma mark - **CAAinmationGroup 动画 - (IBAction)handleCAAnimationCroup:(id)sender { /**创建多个Animation对象*/
CABasicAnimation *b1 = [CABasicAnimation animationWithKeyPath:@"transform.rotation.x"]; b1.fromValue = [NSNumber numberWithInt:];
b1.toValue = [NSNumber numberWithInt:]; CABasicAnimation *b2 = [CABasicAnimation animationWithKeyPath:@"transform.rotation.y"];
b2.fromValue = [NSNumber numberWithInt:];
b1.toValue = [NSNumber numberWithInt:]; CABasicAnimation *b3 = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"]; b3.fromValue = [NSNumber numberWithInt:];
b3.toValue = [NSNumber numberWithInt:]; /* 创建动画组对象*/
CAAnimationGroup *aGroup = [[CAAnimationGroup alloc]init]; /* 设置组对象的动画数组属性 */
aGroup.animations = @[b1,b2,b3]; /* 动画相关设置 */
aGroup.duration = ;
aGroup.repeatCount = NSIntegerMax; /* 添加到相关View的layer属性上*/ [self.myView.layer addAnimation:aGroup forKey:@"aGroup"]; } #pragma mark - CAKeyframeAnimation 动画 - (IBAction)handleCAKeyframeAnimation:(id)sender { /* 创建动画对象 */
//CAKeyframeAnimation *keyA = [CAKeyframeAnimation animationWithKeyPath:@"transform.translation"];
CAKeyframeAnimation *keyA = [CAKeyframeAnimation animationWithKeyPath:@"position"]; /* 设置动画对象的path属性(对象要沿着path移动)*/ /* 创建CGPathRef结构体*/
CGMutablePathRef path = CGPathCreateMutable(); /* 指定path的初始的位置 */
CGAffineTransform t = self.redView.transform; CGPathMoveToPoint(path, &t, self.redView.center.x, self.redView.center.y); // /* Path添加点坐标(直线) */
// CGPathAddLineToPoint (path, &t, 100, 100);
// CGPathAddLineToPoint(path, &t, 300, 100); /* 添加贝塞尔曲线 */ CGPathAddCurveToPoint(path, &t, self.redView.center.x, self.redView.center.y, , , , ); /* Path设置动画对象的属性 */
keyA.path = path;
keyA.duration = ;
keyA.repeatCount = ;
/* 相应地View的layer属性添加动画 */
[self.redView.layer addAnimation:keyA forKey:@"keyA"]; } #pragma mark **CATransition 动画 - (IBAction)handleCATranslation:(id)sender { /* 创建对象 */
CATransition *transtition = [CATransition animation]; /* 设置相关的属性 */
//transtition.type = kCATransitionMoveIn;
transtition.type = @"cube";
transtition.repeatCount = NSIntegerMax; /* View的layer添加动画 */
transtition.duration = ;
[self.myView.layer addAnimation:transtition forKey:@"transition"]; } /** type
*
* 各种动画效果 其中除了'fade', `moveIn', `push' , `reveal' ,其他属于私有的API.
* ↑↑↑上面四个可以分别使用'kCATransitionFade', 'kCATransitionMoveIn', 'kCATransitionPush', 'kCATransitionReveal'来调用.
* @"cube" 立方体翻滚效果
* @"moveIn" 新视图移到旧视图上面
* @"reveal" 显露效果(将旧视图移开,显示下面的新视图)
* @"fade" 交叉淡化过渡(不支持过渡方向) (默认为此效果)
* @"pageCurl" 向上翻一页
* @"pageUnCurl" 向下翻一页
* @"suckEffect" 收缩效果,类似系统最小化窗口时的神奇效果(不支持过渡方向)
* @"rippleEffect" 滴水效果,(不支持过渡方向)
* @"oglFlip" 上下左右翻转效果
* @"rotate" 旋转效果
* @"push"
* @"cameraIrisHollowOpen" 相机镜头打开效果(不支持过渡方向)
* @"cameraIrisHollowClose" 相机镜头关上效果(不支持过渡方向)
*/ /** type
*
* kCATransitionFade 交叉淡化过渡
* kCATransitionMoveIn 新视图移到旧视图上面
* kCATransitionPush 新视图把旧视图推出去
* kCATransitionReveal 将旧视图移开,显示下面的新视图
*/

iOS开发CAAnimation类动画, CATransition动画的更多相关文章

  1. iOS开发笔记10:圆点缩放动画、强制更新、远程推送加语音提醒及UIView截屏

    1.使用CAReplicatorLayer制作等待动画 CALayer+CABasicAnimation可以制作很多简单的动画效果,之前的博客中介绍的“两个动画”,一个是利用一张渐变色图片+CABas ...

  2. 【Swift】IOS开发中自定义转场动画

    在IOS开发中,我们model另外一个控制器的时候,一般都使用默认的转场动画. 其实我们可以自定义一些转场动画.达到不同的转场效果. 步骤如下:(photoBrowser是目标控制器) 1.在源控制器 ...

  3. iOS开发CAAnimation详解

    Core Animation,即为核心动画,它是一组非常强大的动画处理API,使用它能做出非常炫丽的动画效果,而且往往是事半功倍.也就是说,使用少量的代码就可以实现非常强大的功能.Core Anima ...

  4. iOS开发--QQ音乐练习,旋转动画的实现,音乐工具类的封装,定时器的使用技巧,SliderBar的事件处理

    一.旋转动画的实现 二.音乐工具类的封装 -- 返回所有歌曲,返回当前播放歌曲,设置当前播放歌曲,返回下一首歌曲,返回上一首歌曲方法的实现 头文件 .m文件 #import "ChaosMu ...

  5. ios开发——实用技术篇&三维旋转动画

    实现三位旋转动画的方法有很多种,这里介绍三种 一:UIView 1 [UIView animateWithDuration:1.0 animations:^{ 2 self.iconView.laye ...

  6. iOS开发UIkit动力学UIDynamicAnimator一系列动画

    UIDynamicAnimator类,通过这个类中的不同行为来实现一些动态特性. UIAttachmentBehavior(吸附),UICollisionBehavior(碰撞),UIGravityB ...

  7. ios开发之简单实现loading动画效果

    最近有朋友问我类似微信语音播放的喇叭动画和界面图片加载loading界面是怎样实现的,是不是就是一个gif图片呢!我的回答当然是否定了,当然不排除也有人用gif图片啊!下面我就来罗列三种实现loadi ...

  8. iOS开发之--UIImageView的animationImages动画

    图片动画实现,代码如下: -(UIImageView *)animationImageView { if (!_animationImageView) { _animationImageView= [ ...

  9. IOS开发学习笔记022-imageView实现动画

    这里要播放的动画是很多张连续的动画,连续播放就会显示出动画效果. 大概过程是: 新建一个single view application ,然后添加一个image View控件到视图.给image vi ...

随机推荐

  1. C# 发送Http协议 模拟 Post Get请求

    1.参数 paramsValue的格式 要和 Reques.ContentType一致, 如果 contentype  "application/x-www-form-urlencoded& ...

  2. ArrayList的源码分析(基于jdk1.8)

    1.初始化 transient Object[] elementData; //实际存储元素的数组 private static final Object[] DEFAULTCAPACITY_EMPT ...

  3. 利用 Python 插件 xlwings 读写 Excel

    Python 通过 xlwings 读取 Excel 数据 去年底公司让我做设备管理,多次委婉拒绝,最终还是做了.其实我比较喜欢技术.做管理后发现现场没有停机率统计,而原始数据有,每次要自己在Exce ...

  4. Django时间时区问题

    在django1.4以后,存在两个概念 naive time 与 active time. 简单点讲,naive time就是不带时区的时间,Active time就是带时区的时间. 举例来说,使用d ...

  5. python新手第一天学习笔记-第一个ptyhon程序和python变量

    一.python 的注释和第一个python 程序 : 1.单行注释 # Author Xiajq 2.多行注释 ''' ------------注释内容----------------------- ...

  6. 【BZOJ2286】消耗战(虚树,动态规划)

    [BZOJ2286]消耗战(虚树,动态规划) 题面 BZOJ Description 在一场战争中,战场由n个岛屿和n-1个桥梁组成,保证每两个岛屿间有且仅有一条路径可达.现在,我军已经侦查到敌军的总 ...

  7. HttpClient&Jsoup爬虫的简单应用

    详细的介绍已经有很多前辈总结,引用一下该篇文章:https://blog.csdn.net/zhuwukai/article/details/78644484 下面是一个代码的示例: package ...

  8. sql server 对Geography 的增(insert)和查询(select)

    insert:    Location为    Geography类型                INSERT INTO [oss1].[dbo].[Order] ([Location]) VAL ...

  9. Chrome模拟平板调试

    1. 按F12,打开开发者工具,右上角,点击红圈中的标志.然后在弹出的面板中点击'Emulation'. 2. 会看到左侧的四个选项卡  Device 设备.Screen 屏幕.User Agent ...

  10. FCL中你不得不知的几种委托

    FCL中丰富的类库信息极大的方便了我们的编码,很多我们日常经常用到的类型,FCL中已经帮我们定义好,下面要介绍的就是FCL中定义好的几种委托类型,直接使用它们不仅能提高我们的编码效率,而且还能让我们的 ...