使用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 ...
随机推荐
- 8个超实用的jQuery插件应用
自jQuery诞生以来,jQuery社区都在不断地.自发地为jQuery创建许许多多功能不一的插件应用,很多jQuery插件非常实用,对我们的前端开发帮助相当大,不仅可以更完美的完成指定功能,而且节省 ...
- git初始化本地项目并推送到git服务器
1.创建本地项目,在项目根目录执行git init命令 git init 2.在git服务器上创建一个仓库,这里使用GitHub创建一个仓库. 3.执行git remote add origin &l ...
- 实验室ubuntu连ipv6
1.买个极路由 2.无线中继连tsinghua-5G 3.安装ipv6插件 4.联网或者科协vpn 5.下载bt客户端:sudo apt-get install qbittorrent (或者su ...
- 【转】xhEditor技术手册 网页编辑器基础教程
1. xhEditor入门基础 1.1. 在线可视化HTML编辑器概述1.2. 获取xhEditor1.3. xhEditor运行环境1.4. xhEditor基本使用指南 1.1. 在线可视化HTM ...
- bigtable原理
bigtable原理 数据模型 A Bigtable is a sparse, distributed, persistent multi-dimensional sorted map. The ma ...
- [Object Tracking] How to learn Active contour model - Snake Model
常见四种跟踪的思路: 区域:人体肢体识别.跟踪 模型:人体面部识别.跟踪 特征:摄像头3D定位 主动轮廓:(蛇模型属于这er,数学基础<图像处理的偏微分方程方法>,也是最流行的一个目前) ...
- ubuntu安装cocos2dx
操作系统:ubuntu16.04 LTSIDE:Code::blocks 16.01Cocos2dx版本:cocos2d-x 3.11.1这篇随笔将会简要地演示如何在ubuntu下安装cocos2dx ...
- nuxt项目中vue报错The client-side rendered virtual ...
报错: 翻译过来是: [Vue警告]:客户端呈现的虚拟DOM树与服务器呈现的内容不匹配.这可能是由不正确的HTML标记引起的,例如在其中嵌套块级元素或丢失.Bailing水化和执行完整的客户端渲染. ...
- Windows-NTFS-ADS在渗透测试中的利用
0.什么是ADS Windows:微软公司的一款视窗操作系统,其内核为WindowsNT. NTFS:WindowsNT环境的限制级专用文件系统. ADS:NTFS的系统特性,交换数据流(Altern ...
- Orleans学习总结(二)--创建工程
通过第一篇Orleans学习总结(一)--入门认识我们大致知道知道是干嘛的了,下面我们来动手造一个传说中的神秘的高并发集群Orleans程序. 一.创建四个C#工程 1.IGrain工程,用来定义各种 ...