使用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画椭圆的更多相关文章

  1. 《图形学》实验七:中点Bresenham算法画椭圆

    开发环境: VC++6.0,OpenGL 实验内容: 使用中点Bresenham算法画椭圆. 实验结果: 代码: #include <gl/glut.h> #define WIDTH 50 ...

  2. Canvas画椭圆的方法

    虽然标题是画椭圆,但是我们先来说说Canvas中的圆 相信大家对于Canvas画圆都不陌生   oGC.arc(400, 300, 100, 0, 2*Math.PI, false); 如上所示,直接 ...

  3. 利用border-radius画椭圆

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...

  4. canvas 画椭圆

    圆的标准方程(x-x0)²+(y-y0)²=r²中,有三个参数x0.y0.r,即圆心坐标为(x0, y0), 半径为 r圆的参数方程 x = x0 + r * cosθ, y = y0 + r * s ...

  5. 1.1.4-学习Opencv与MFC混合编程之---画图工具 画椭圆

    源代码地址:http://download.csdn.net/detail/nuptboyzhb/3961690 1.    增加‘椭圆’菜单项,设置属性,添加类向导: 2.    编辑消息处理函数, ...

  6. Bresenham画椭圆算法

    这里不仔细讲原理,只是把我写的算法发出来,跟大家分享下,如果有错误的话,还请大家告诉我,如果写的不好,也请指出来,一起讨论进步. 算法步骤: (1) 输入椭圆的长半轴a和短半轴b. (2) 计算初始值 ...

  7. c++ 珊格画椭圆

    #ifndef _TEST_H #define _TEST_H #include <iostream> #include <math.h> using namespace st ...

  8. Android利用canvas画各种图形(点、直线、弧、圆、椭圆、文字、矩形、多边形、曲线、圆角矩形) .

    1.首先说一下canvas类: Class Overview The Canvas class holds the "draw" calls. To draw something, ...

  9. IOS用CGContextRef画各种图形(文字、圆、直线、弧线、矩形、扇形、椭圆、三角形、圆角矩形、贝塞尔曲线、图片)

    ... 首先了解一下CGContextRef: An opaque type that represents a Quartz 2D drawing environment. Graphics Con ...

随机推荐

  1. 11gr2 RAC安装INS-35354问题一例

    转自:http://www.askmaclean.com/archives/11gr2-rac安装ins-35354问题一例.html 今天在安装一套11.2.0.2 RAC数据库时出现了INS-35 ...

  2. Nginx的upstream目前支持5种分配方式

    本文转自:http://mp.weixin.qq.com/s?__biz=MzI4OTU3ODk3NQ==&mid=2247484058&idx=1&sn=f4da816bfa ...

  3. 【iCore4 双核心板_ARM】例程二十三:LWIP_HTTP实验——网页服务器

    实验现象: 核心代码: int main(void) { system_clock.initialize(); led.initialize(); adc.initialize(); delay.in ...

  4. Java中内存溢出与内存泄露

    内存溢出 内存溢出(out of memory),是指程序在申请内存时,没有足够的内存空间供其使用,出现out of memory:比如申请了一个integer,但给他存了long才能存下的数,就会发 ...

  5. wrk压测工具使用

    介绍分为四部分 1.wrk简述 2.wrk安装 3.wrk运行参数 4.wrk高级用法 1.wrk简述 当使用ab做压测的时候发现,ab的客户端消耗很大,而且测试时性能较差,测试redis,sprin ...

  6. netbeans rcp中如何编程设置主窗口标题

    http://www.th7.cn/Program/java/201510/606050.shtml ————————————————————————————————————————————————— ...

  7. APACHE多个服务器的配置

    APACHE 多个服务器的配置? 网站目录:d:www 下设两个站点:1.D:wwwszbw  2.D:wwwweb 注意前面,要开启 Vhost 及 vhos 相关 so <VirtualHo ...

  8. Java知多少(60)isAlive()和join()的使用

    如前所述,通常你希望主线程最后结束.在前面的例子中,这点是通过在main()中调用sleep()来实现的,经过足够长时间的延迟以确保所有子线程都先于主线程结束.然而,这不是一个令人满意的解决方法,它也 ...

  9. Gradle依赖的统一管理,解决依赖冲突

    看见别人在用implementation rootProject.ext.dependencies["xxxx"]不知道是什么意思,上网查了一下,原来是为了解决或者说预防gradl ...

  10. Sword redis存取二进制数据

    #include "hiredis/hiredis.h" /* redis头文件 */ #include <stdio.h> #include <stdlib.h ...