使用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 ...
随机推荐
- 前台报错:Uncaught TypeError: Cannot read property '0' of null
错误现象: var div1=mycss[0].style.backgroundColor; //这一行提示360和chrome提示:Uncaught TypeError: Cannot read ...
- Vue.js常用指令:v-show和v-if
一.v-show指令 v-show指令可以用来动态的控制DOM元素的显示或隐藏.v-show后面跟的是判断条件,语法如下: v-show="判断变量" 例如: v-show=&qu ...
- mysql语法 -- concat函数
mysql CONCAT(str1,str2,…) 返回结果为连接参数产生的字符串.如有任何一个参数为NULL ,则返回值为 NULL.或许有一个或多个参 ...
- feign调用接口session丢失解决方案
微服务使用feign相互之间调用时,因为feign默认不传输Header,存在session丢失的问题.例如,使用Feign调用某个远程API,这个远程API需要传递一个鉴权信息,我们可以把cooki ...
- nginx 反向代理 Nginx 502 Bad Gateway
查看错误日志: 摘要: nginx反向代理出现502错误 通过查看日志发现错误信息 2018/01/10 17:58:20 [crit] 8156#0: *1 connect() to 127.0.0 ...
- 8 -- 深入使用Spring -- 5... Spring 3.1 新增的缓存机制
8.5 Spring 3.1 新增的缓存机制 Spring 3.1 新增了一种全新的缓存机制,这种缓存机制与Spring容器无缝地整合在一起,可以对容器中的任意Bean或Bean的方法增加缓存.Spr ...
- 使用 ssh -R 穿透局域网访问内部服务器主机,反向代理 无人值守化
一.搭建SSH方向代理 准备: 局域网主机(虚拟主机): 192.168.6.233 CentOS 6.7 阿里云服务器:120.25.68.60 CentOS 6.7 1. 阿里云服务器12 ...
- 深入Java内存模型之阅读理解(1)
Java内存模型的抽象 在java中,所有实例域.静态域和数组元素存储在堆内存中,堆内存在线程之间共享(本文使用“共享变量”这个术语代指实例域,静态域和数组元素).局部变量(Local variabl ...
- mac环境变量
环境: 当前已经有 .bash_profile文件了 打开.bash_profile: open -e .bash_proile open -e .bash_profile 查看node安装路径: w ...
- shell利用数组分割组合字符串
#!/bin/bash #接收脚本参数如[sh a.txt .0_3_4_f_u_c_k_8080] a=$ #把参数分割成数组 arr=(${a//_/ }) #显示数组长度 #echo ${#ar ...