使用uibesizerpath + Cashaplayer画椭圆
使用uibesizerpath
Cashaplayer
画椭圆:
+ (void)drawOvalAnimSourceView:(UIView *)sourceView {
//view是曲线的背景view
UIView *view = [[UIView alloc]initWithFrame:sourceView.bounds];
view.backgroundColor = [UIColor clearColor];
view.transform = CGAffineTransformMakeRotation(-M_PI_2*0.5);
[sourceView addSubview:view];
//第一、UIBezierPath绘制线段
UIBezierPath *firstPath = [UIBezierPath bezierPathWithOvalInRect:sourceView.bounds];
//第二、UIBezierPath和CAShapeLayer关联
CAShapeLayer *lineLayer2 = [CAShapeLayer layer];
lineLayer2.frame = sourceView.bounds;
lineLayer2.fillColor = [UIColor clearColor].CGColor;
lineLayer2.path = firstPath.CGPath;
lineLayer2.strokeColor = [UIColor redColor].CGColor;
lineLayer2.lineWidth = ;
//第三,动画
CABasicAnimation *ani = [CABasicAnimation animationWithKeyPath:NSStringFromSelector(@selector(strokeEnd))];
ani.fromValue = @;
ani.toValue = @;
ani.duration = 2.5; // 2快 3慢
[lineLayer2 addAnimation:ani forKey:NSStringFromSelector(@selector(strokeEnd))];
[view.layer addSublayer:lineLayer2];
UIImageView *hand = [[UIImageView alloc] initWithFrame:CGRectMake(, , , )];
hand.image = [UIImage imageNamed:@"img_help_doubletap_00034"];
[view.layer addSublayer:hand.layer];
UIBezierPath *aniPath = [UIBezierPath bezierPathWithOvalInRect:sourceView.bounds];
CAKeyframeAnimation *animation = [CAKeyframeAnimation animation];
animation.keyPath = @"position";
animation.duration = ;
animation.repeatCount = ;//CGFLOAT_MAX;
animation.path = aniPath.CGPath;
animation.removedOnCompletion = NO;
[hand.layer addAnimation:animation forKey:@"slide"];
}
使用uibesizerpath + Cashaplayer画椭圆的更多相关文章
- 《图形学》实验七:中点Bresenham算法画椭圆
开发环境: VC++6.0,OpenGL 实验内容: 使用中点Bresenham算法画椭圆. 实验结果: 代码: #include <gl/glut.h> #define WIDTH 50 ...
- Canvas画椭圆的方法
虽然标题是画椭圆,但是我们先来说说Canvas中的圆 相信大家对于Canvas画圆都不陌生 oGC.arc(400, 300, 100, 0, 2*Math.PI, false); 如上所示,直接 ...
- 利用border-radius画椭圆
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...
- canvas 画椭圆
圆的标准方程(x-x0)²+(y-y0)²=r²中,有三个参数x0.y0.r,即圆心坐标为(x0, y0), 半径为 r圆的参数方程 x = x0 + r * cosθ, y = y0 + r * s ...
- 1.1.4-学习Opencv与MFC混合编程之---画图工具 画椭圆
源代码地址:http://download.csdn.net/detail/nuptboyzhb/3961690 1. 增加‘椭圆’菜单项,设置属性,添加类向导: 2. 编辑消息处理函数, ...
- Bresenham画椭圆算法
这里不仔细讲原理,只是把我写的算法发出来,跟大家分享下,如果有错误的话,还请大家告诉我,如果写的不好,也请指出来,一起讨论进步. 算法步骤: (1) 输入椭圆的长半轴a和短半轴b. (2) 计算初始值 ...
- c++ 珊格画椭圆
#ifndef _TEST_H #define _TEST_H #include <iostream> #include <math.h> using namespace st ...
- Android利用canvas画各种图形(点、直线、弧、圆、椭圆、文字、矩形、多边形、曲线、圆角矩形) .
1.首先说一下canvas类: Class Overview The Canvas class holds the "draw" calls. To draw something, ...
- IOS用CGContextRef画各种图形(文字、圆、直线、弧线、矩形、扇形、椭圆、三角形、圆角矩形、贝塞尔曲线、图片)
... 首先了解一下CGContextRef: An opaque type that represents a Quartz 2D drawing environment. Graphics Con ...
随机推荐
- 【Ubuntu】xrdp完美实现Windows远程访问Ubuntu 16.04
步骤一.下载TigerVNC Server软件包 下载地址:Tigervnc Deb软件包(适用于Ubuntu 16.04.1 - 64位) 步骤二. 安装TigerVNC Server软件包 1.打 ...
- mysql搭建主从
1.主从服务器分别作以下操作: 1.1.版本一致 1.2.初始化表,并在后台启动mysql 1.3.修改root的密码 数据库内容也要保证数据一致 //否则报错, Slave_SQL_Running: ...
- 飞鱼48小时游戏创作嘉年华_厦门Pitch Time总结与收获
一.48小时游戏开发前期准备 1,策划 明确美术队友和程序队友的水平,提需求的过程中尝试做减法,在保留核心玩法的基础上,看队友水平和时间判断是否添加需求. 策划是整个游戏团队的灵魂,也是开发的上限所在 ...
- json 报错'xxx is not JSON serializable'的处理方法
场景: 报错: 原因: json不能对np.int64或者np.float64等类型进行序列化,可以通过自定义serializer或者直接类型转换来解决. 解决方法: 显式的把 date 转换成 in ...
- Spark学习笔记——读写HDFS
使用Spark读写HDFS中的parquet文件 文件夹中的parquet文件 build.sbt文件 name := "spark-hbase" version := " ...
- 在linux中安装字体
https://blog.csdn.net/wangxintong_1992/article/details/81194896
- Python实现C代码统计工具(四)
目录 Python实现C代码统计工具(四) 标签: Python 计时 持久化 声明 运行测试环境 一. 自定义计时函数 1.1 整个程序计时 1.2 代码片段计时 1.3 单条语句计时 二. 性能优 ...
- 使用mui.js实现下拉刷新
闲聊: 最近因公司项目需求,小颖需要写一些html5页面,方便公司IOS和Android给APP中嵌套使用,其中需要实现拉下刷新功能,其实就是调用了一下mui.js就可以啦嘻嘻,下面跟着小颖一起来看看 ...
- 淘宝 NPM 镜像使用
前言 因为众所周知的原因,使用node,官方NPM仓库安装依赖包是个看人品的事情,不过有万能的淘宝,所以需要部分调整就可以避免这些原因.(以下内容osx, centos下测试通过) 淘宝镜像基本使用 ...
- Mysql的复杂语句
简单的crud操作很容易,但是对于嵌套的查询语句,多表查询语句,以及条件查询语句,这些都很复杂,需要不断练习. limit a,b: 从a开始,长度为b. SELECT * FROM tb_quali ...