使用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 ...
随机推荐
- .NET+MVC+ORACLE存储分页查询一后端实现
MemberController:public ActionResult UserList() { UserBll userBll = new UserBll(); string keyWords = ...
- 【转载】ssh-keygen 基本用法
[转载]ssh-keygen 基本用法 原文地址:https://www.liaohuqiu.net/cn/posts/ssh-keygen-abc/ ssh 公钥认证是ssh认证的方式之一.通过公钥 ...
- Java多线程系列——线程池简介
什么是线程池? 为了避免系统频繁地创建和销毁线程,我们可以让创建的线程进行复用.用线程时从线程池中获取,用完以后不销毁线程,而是归还给线程池. JDK 对线程池的支持 为了更好的控制多线程,JDK 提 ...
- 再战android-语音识别2(修改配置)
可怕的半桶水一直在晃.程序中需要根据用户的选择设置语音识别的语言(目前科大讯飞支持英文.普通话.粤语),不想每次要用户去IatSetting中去改,需要能直接修改IatSetting的设置.之前移植的 ...
- yizhihongqiang
最新网址:https://www. hongxingwangzhi .com/
- AbtestingGateway 分流策略添加
目录结构分布 我们从GitHub上把它下载后解压出来,有以下5个目录,分别是: admin 管理模块,对策略增删改查等功能 diversion 主模块吧,看源码是匹配redis存储的key doc 文 ...
- mybatis通用mapper源码解析(二)
1.javabean的属性值生成sql /** * 获取所有查询列,如id,name,code... * * @param entityClass * @return */ public static ...
- [GAN] How to use GAN - Meow Generator
一篇介绍GAN应用的文章.今后GAN模型学习的主要内容. 中文链接:萌物生成器:如何使用四种GAN制造猫图 原文链接:https://ajolicoeur.wordpress.com/cats/ 项目 ...
- Spring 整合 Junit4 进行单元测试
1. pom.xml 引入JAR依赖: <dependency> <groupId>junit</groupId> <artifactId>junit& ...
- Mac 上 Charles 抓取 iso http、https数据包
一.下载charles包. http://www.charlesproxy.com/download/ 选择mac版本的最新包Charles is 3.11.4. http://www.charles ...