博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
关键帧动画实现圆弧动画
阅读量:6330 次
发布时间:2019-06-22

本文共 1536 字,大约阅读时间需要 5 分钟。

/*     CAKeyframeAnimation *pathAnimation = [CAKeyframeAnimation     animationWithKeyPath:@"position"];     pathAnimation.calculationMode = kCAAnimationPaced;     pathAnimation.fillMode = kCAFillModeForwards;     pathAnimation.removedOnCompletion = NO;     pathAnimation.duration = 15.0;     pathAnimation.repeatCount = 1;     CGMutablePathRef curvedPath = CGPathCreateMutable();     CGPathMoveToPoint(curvedPath, NULL, x+15, y);     CGPathAddQuadCurveToPoint(curvedPath, NULL, 20, 10, 100, 330);     pathAnimation.path = curvedPath;     CGPathRelease(curvedPath);     Yourimage.center=CGPointMake(x, y);     [Yourimage.layer addAnimation:pathAnimation forKey:@"moveTheSquare"];          */                UIView *aView = [[UIView alloc]initWithFrame:CGRectMake(150, 50, 20, 20)];          aView.backgroundColor = [UIColor greenColor];    CAKeyframeAnimation *pathAnimation = [CAKeyframeAnimation                                          animationWithKeyPath:@"position"];    pathAnimation.calculationMode = kCAAnimationPaced;    pathAnimation.fillMode = kCAFillModeForwards;    pathAnimation.removedOnCompletion = NO;    pathAnimation.duration = 0.5;    pathAnimation.repeatCount = 20;    CGMutablePathRef curvedPath = CGPathCreateMutable();    CGPathAddArc(curvedPath, NULL, 160, 240, 100, 0,2*M_PI , 0);    pathAnimation.path = curvedPath;    CGPathRelease(curvedPath);    [aView.layer addAnimation:pathAnimation forKey:@"moveTheCircleOne"];        [self.view addSubview:aView];

  

转载于:https://www.cnblogs.com/cocoajin/p/3219706.html

你可能感兴趣的文章
df -h 卡住
查看>>
K-means算法(理论+opencv实现)
查看>>
第七天1
查看>>
[转] createObjectURL方法 实现本地图片预览
查看>>
Jquery中的Jquery.extend, Jquery.fn.extend,Jquery.prototype
查看>>
JavaScript—DOM编程核心.
查看>>
获得表字段名称和数据类型
查看>>
python 日志打印
查看>>
Javascript鼠标滚轮事件兼容写法
查看>>
如何完全卸载 mysql 数据库
查看>>
JavaScript碎片
查看>>
Bootstrap-下拉菜单
查看>>
soapUi 接口测试
查看>>
【c学习-12】
查看>>
工作中MySql的了解到的小技巧
查看>>
loadrunner-2-12日志解析
查看>>
2013年蓝桥杯省赛C/C++A组真题解析
查看>>
[实战]MVC5+EF6+MySql企业网盘实战(5)——ajax方式注册
查看>>
[翻译]应用程序池和应用程序域的区别
查看>>
使用POI创建word表格-在表格单元格中创建子表格
查看>>