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 ...
随机推荐
- Excel公式中使用动态计算的地址
例:统计A列第四行开始,到公式所在行的前一行的非空白行的个数: =COUNTA(A4:INDIRECT(ADDRESS(ROW()-,COLUMN())))
- vue编程式路由实现新窗口打开
一. 标签实现新窗口打开: 官方文档中说 v-link 指令被 组件指令替代,且 不支持 target=”_blank” 属性,如果需要打开一个新窗口必须要用标签,但事实上vue2版本的 是支持 ta ...
- ios 耳机插入拔出检测
[AVAudioSession sharedInstance]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@se ...
- 写写我的硕士三年【zz】
昨天我们组的10bit-40M ADC测出来了,自己终于能松口气,可以无牵无挂的毕业了.晚上老板bg全组毕业生,喝了很多,我对老板说:"这3年在组里,我是把它当作事业来做的!"是的 ...
- Saltstack之通过grains在配置文件中赋值
案例,使用salt给客户端安装zabbix agent时需要在配置文件中自动生成主机名信息 zabbix agent安装sls zabbix-agent-install: file.managed: ...
- content-type对照表
- 安装MAC的ReactNative环境
brew install node brew install watchman npm config set registry https://registry.npm.taobao.org --gl ...
- invariant theory 不变量理论
https://baike.baidu.com/item/不变量理论/9224903?fr=aladdininvariant theory 一组几何元素由 k个参数组成的向量 P1表示.若 T为某一变 ...
- PHP之错误
三.PHP配置之Error handling logging 1.error_reporting integer error_reporting = E_ALL 设置错误报告的级别.该参数可以是一个任 ...
- [tcpreplay] tcpreplay高级用法--使用tcpreplay-edit进行循环动态发包
tcpreplay-edit提供了可对包进行修改的高级用法: --unique-ip Modify IP addresses each loop iteration to generate uniqu ...