OC动画:CAKeyframeAnimation

// 方法一 用法1 Value方式
//创建动画对象 CAKeyframeAnimation *animation = [CAKeyframeAnimation animationWithKeyPath:@"position"]; //设置value NSValue *value1=[NSValue valueWithCGPoint:CGPointMake(100, 100)]; NSValue *value2=[NSValue valueWithCGPoint:CGPointMake(200, 100)]; NSValue *value3=[NSValue valueWithCGPoint:CGPointMake(100, 200)]; NSValue *value4=[NSValue valueWithCGPoint:CGPointMake(200, 200)]; NSValue *value5=[NSValue valueWithCGPoint:CGPointMake(100, 300)]; NSValue *value6=[NSValue valueWithCGPoint:CGPointMake(200, 300)]; animation.values=@[value1,value2,value3,value4,value5,value6]; //重复次数 默认为1 // animation.repeatCount=MAXFLOAT; //设置是否原路返回默认为不 // animation.autoreverses = YES; //设置移动速度,越小越快 animation.duration = 4.0f; animation.removedOnCompletion = NO; animation.fillMode = kCAFillModeForwards; animation.timingFunction=[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; animation.delegate=self; //给这个view加上动画效果 [redView.layer addAnimation:animation forKey:nil];

CAKeyframeAnimation *keyframeAnimation=[CAKeyframeAnimation animationWithKeyPath:@"position"];
// 创建一个CGPathRef对象,就是动画的路线
CGMutablePathRef path = CGPathCreateMutable();
// 设置开始位置
CGPathMoveToPoint(path, NULL, redView.layer.position.x-40, redView.layer.position.y+40);//移动到起始点
// 沿着路径添加四曲线点移动
CGPathAddQuadCurveToPoint(path, NULL, 100, 100, self.view.frame.size.width, 0);
keyframeAnimation.path = path;
keyframeAnimation.delegate = self;
CGPathRelease(path);
keyframeAnimation.duration = 7;
[redView.layer addAnimation:keyframeAnimation forKey:@"KCKeyframeAnimation_Position"];
OC动画:CAKeyframeAnimation的更多相关文章
- iOS:核心动画之关键帧动画CAKeyframeAnimation
CAKeyframeAnimation——关键帧动画 关键帧动画,也是CAPropertyAnimation的子类,与CABasicAnimation的区别是: –CABasicAnimation只能 ...
- OC - 25.CAKeyframeAnimation
概述 简介 CAKeyframeAnimation又称关键帧动画 CAKeyframeAnimation是抽象类CAPropertyAnimation的子类,可以直接使用 通过values与path两 ...
- 核心动画 - CAKeyframeAnimation 简单应用
核心动画: 登录按钮的抖动效果: CAKeyframeAnimation * kfAnimation = [CAKeyframeAnimation animationWithKeyPath:@&quo ...
- OC动画:CAAnimationGroup
//贝塞尔曲线路径 UIBezierPath *movePath = [UIBezierPath bezierPath]; [movePath moveToPoint:CGPointMake(10.0 ...
- iOS动画:CAKeyframeAnimation
网络中Core Animation类的继承关系图 属性简介 @interface CAKeyframeAnimation : CAPropertyAnimation /* 提供关键帧数据的 ...
- OC动画CABasicAnimation
//1.创建动画 CABasicAnimation *anima=[CABasicAnimation animationWithKeyPath:@"bounds"]; //1.1设 ...
- 直播点赞,上升的动画-- CAKeyFrameAnimation
// // ViewController.m // DMHeartFlyAnimation // // Created by Rick on 16/3/9. // Copyright © 20 ...
- 核心动画(CAKeyframeAnimation)
Main.storyboard ViewController.m // // ViewController.m // 8A02.核心动画 - CAKeyframeAnimation // // ...
- iOS开发——图形与动画篇OC篇&图层基本上动画
图层的一些基本动画效果 #define kRadianToDegrees (radian) (radian * 180.0) / (M_PI) //闪烁 [self.testView.layer ad ...
随机推荐
- Android异步处理系列文章四篇之一使用Thread+Handler实现非UI线程更新UI界面
目录: Android异步处理一:使用Thread+Handler实现非UI线程更新UI界面Android异步处理二:使用AsyncTask异步更新UI界面Android异步处理三:Handler+L ...
- [IR] Dictionary Coding
[数据压缩]LZ77算法原理及实现 [数据压缩]LZ78算法原理及实现 Lempel–Ziv–Welch 年发表的论文<A Universal Algorithm for Sequential ...
- [Full-stack] 跨平台大框架 - RN
前言 React-Redux的大全栈代码复用理论有点意思,给出一个具体的例子:[React] 15 - Redux: practice IM 因为与react内容天然地部分重合,故这里将重点放在了对c ...
- [React] 10 - Tutorial: router
Ref: REACT JS TUTORIAL #6 - React Router & Intro to Single Page Apps with React JS Ref: REACT JS ...
- 从Elasticsearch来看分布式系统架构设计
分布式系统类型多,涉及面非常广,不同类型的系统有不同的特点,批量计算和实时计算就差别非常大.这篇文章中,重点会讨论下分布式数据系统的设计,比如分布式存储系统,分布式搜索系统,分布式分析系统等. 我们先 ...
- Android Selinux
https://blog.csdn.net/rikeyone/article/details/84337115 如何快速定位SElinux问题并修复? https://blog.csdn.net/ ...
- [原]openstack-kilo--issue(十八) Error parsing template file: Template format version not found.
在创建stack的时候出现的报错: ]# heat stack-create nems_demo -e AAA.yaml -f AAA.parameter.yaml Error parsing tem ...
- 【CF506E】Mr. Kitayuta's Gift dp转有限状态自动机+矩阵乘法
[CF506E]Mr. Kitayuta's Gift 题意:给你一个字符串s,你需要在s中插入n个字符(小写字母),每个字符可以被插在任意位置.问可以得到多少种本质不同的字符串,使得这个串是回文的. ...
- Mac下利用Cordova打包 iOS App以及出现的问题
安装 cordova sudo npm install cordova 创建项目 创建一个demo文件夹,里面自动加载基本的文件以及目录 cordova create demo com.test.de ...
- 也谈.Net中间语言——破解Delphi2CS行数和时间限制
其实我一直在研究将Delphi版的传奇2源代码使用C#实现,不过由于我并没有学习过Delphi.就只能说先试着用一些工具转换代码. 后来我在网上找到了一款软件:Delphi2CS.这款软件比较强大,虽 ...