使用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 ...
随机推荐
- SAP Study Notes: BW Queriy-Variables(变量)
About Variable:1.Variable 是和InfoObject绑定的,可用于任何含有该IO的query中.2.Variable有以下几种类型:Characteristic:用于限制Cha ...
- ORGANISING THE TEST CASES
ORGANISING THE TEST CASES -Test note of “Essential Software Test Design” 2015-09-24 目录 22.1 Test Cas ...
- 【九天教您南方cass 9.1】 09 提取坐标的几种方法
同学们大家好,欢迎收看由老王测量上班记出品的cass9.1视频课程 我是本节课主讲老师九天. 我们讲课的教程附件也是共享的,请注意索取测量空间中. [点击索取cass教程]5元立得 (给客服说暗号:“ ...
- Java Utils工具类大全(转)
源码和jar见:https://github.com/evil0ps/utils #Java Utils --- 封装了一些常用Java操作方法,便于重复开发利用. 另外希望身为Java牛牛的你们一起 ...
- Go语言实践_实现一(服务器端)对多(客户端)在线聊天室
一.目的 运用Go语言中的goroutine和通道实现一个简单的一个服务器端对多个客户端的在线聊天 软件环境:Goland,Go1.9 代码仓库链接 二.设计思路 与一对一的设计思路类似,就是加了个线 ...
- Linux CentOS 6.9 Minimal 编译 OpenJDK 7
今天学习<深入理解Java虚拟机:JVM高级特性与最佳实践>一书,并动手在Linux系统上编译OpenJDK 7,初次搞不太顺利,特记录下编译操作细节. 一.前期准备 约定:工具默认安装目 ...
- Python_序列与映射的解包操作
解包就是把序列或映射中每个元素单独提取出来,序列解包的一种简单用法就是把首个或前几个元素与后面几个元素分别提取出来,例如: first, seconde, *rest = sequence 如果seq ...
- java-信息安全(十二)-数字签名【Java证书体系实现】
概述 信息安全基本概念 数字证书 数字证书就是互联网通讯中标志通讯各方身份信息的一串数字,提供了一种在Internet上验证通信实体身份的方式,数字证书不是数字身份证,而是身份认证机构盖在数字身份证上 ...
- [Android Studio] Using API of OpenCV DNN
前言 一.故事背景 NDK方法人脸识别 OpenCV4Android系列: 1. OpenCV4Android开发实录(1):移植OpenCV3.3.0库到Android Studio 2.OpenC ...
- [Bayes] Understanding Bayes: A Look at the Likelihood
From: https://alexanderetz.com/2015/04/15/understanding-bayes-a-look-at-the-likelihood/ Reading note ...