UIBezierPath + bezierPathWithArcCenter
2015-10-27 10:21
561 查看
UIBezierPath + bezierPathWithArcCenter:radius:startAngle:endAngle:clockwise:
Creates and returns a new UIBezierPath object initialized with an arc of a circle.
Declaration
SWIFT
convenience init(arcCenter center: CGPoint,
radius radius: CGFloat,
startAngle startAngle: CGFloat,
endAngle endAngle: CGFloat,
clockwise clockwise: Bool)
OBJECTIVE-C
+ (instancetype)bezierPathWithArcCenter:(CGPoint)center
radius:(CGFloat)radius
startAngle:(CGFloat)startAngle
endAngle:(CGFloat)endAngle
clockwise:(BOOL)clockwise
Parameters
center
Specifies the center point of the circle (in the current coordinate system) used to define the arc.
radius
Specifies the radius of the circle used to define the arc.
startAngle
Specifies the starting angle of the arc (measured in radians).
endAngle
Specifies the end angle of the arc (measured in radians).
clockwise
The direction in which to draw the arc.
Return Value
A new path object with the specified arc.
Discussion
This method creates an open subpath. The created arc lies on the perimeter of the specified circle. When drawn in the default coordinate system, the start and end angles are based on the unit circle shown in Figure 1. For example, specifying a start angle of
0 radians, an end angle of π radians, and setting the clockwise parameter to YES draws the bottom half of the circle. However, specifying the same start and end angles but setting the clockwise parameter set to NO draws the top half of the circle.
Figure 1Angles in the default coordinate system
image: ../Art/radians_circle.png
After calling this method, the current point is set to the point on the arc at the end angle of the circle.
Availability
Available in iOS 3.2 and later.
可以使用贝塞尔曲线和 CAKeyframeAnimation 来构建动画。
// 路径曲线
UIBezierPath *movePath = [UIBezierPath bezierPath];
...
// 关键帧
CAKeyframeAnimation *moveAnim = [CAKeyframeAnimation animationWithKeyPath:@"position"];
moveAnim.path = movePath.CGPath;
Creates and returns a new UIBezierPath object initialized with an arc of a circle.
Declaration
SWIFT
convenience init(arcCenter center: CGPoint,
radius radius: CGFloat,
startAngle startAngle: CGFloat,
endAngle endAngle: CGFloat,
clockwise clockwise: Bool)
OBJECTIVE-C
+ (instancetype)bezierPathWithArcCenter:(CGPoint)center
radius:(CGFloat)radius
startAngle:(CGFloat)startAngle
endAngle:(CGFloat)endAngle
clockwise:(BOOL)clockwise
Parameters
center
Specifies the center point of the circle (in the current coordinate system) used to define the arc.
radius
Specifies the radius of the circle used to define the arc.
startAngle
Specifies the starting angle of the arc (measured in radians).
endAngle
Specifies the end angle of the arc (measured in radians).
clockwise
The direction in which to draw the arc.
Return Value
A new path object with the specified arc.
Discussion
This method creates an open subpath. The created arc lies on the perimeter of the specified circle. When drawn in the default coordinate system, the start and end angles are based on the unit circle shown in Figure 1. For example, specifying a start angle of
0 radians, an end angle of π radians, and setting the clockwise parameter to YES draws the bottom half of the circle. However, specifying the same start and end angles but setting the clockwise parameter set to NO draws the top half of the circle.
Figure 1Angles in the default coordinate system
image: ../Art/radians_circle.png
After calling this method, the current point is set to the point on the arc at the end angle of the circle.
Availability
Available in iOS 3.2 and later.
可以使用贝塞尔曲线和 CAKeyframeAnimation 来构建动画。
// 路径曲线
UIBezierPath *movePath = [UIBezierPath bezierPath];
...
// 关键帧
CAKeyframeAnimation *moveAnim = [CAKeyframeAnimation animationWithKeyPath:@"position"];
moveAnim.path = movePath.CGPath;
相关文章推荐
- OC笔记 - 核心动画(2015.4.6)
- UIBezierPath画圆弧的记录
- CAShapeLayer 与CABasicAnimation结合使用时strokeStart、strokeEnd 与fromValue、toValue的用法
- iOS开发之使用画板和CA自定义有动画效果的AlertView
- iOS 扫描上的层及其样式(一)
- iOS 扫描上的层及其样式(二)
- iOS UIBezierPath类
- IOS 之 CAKeyframeAnimation
- 如何用UIBezierPath画线
- 设置控件圆角,只设置上面两个角的圆角(任意角)
- CABasicAnimation 热门动画效果
- iPhone/iOS Core Animation开发总结(CALayer)
- iOS UIBezierPath类 介绍
- UIBezierPath
- CAKeyframeAnimation简单旋转动画
- CAKeyframeAnimation-核心动画-帧动画
- CAAnimationGroup-核心动画组
- 利用UIBezierPath实现一个带圆角的视图
- CAKeyframeAnimation 关键帧动画
- iOS UIBezierPath类 介绍