uibezierpath

SceneKit draw curved line

可紊 提交于 2021-02-19 04:32:35
问题 I'd like to draw a bezier curved line with SceneKit and thought this would work: func drawCurvedLine() { let scene = SCNScene() let scnView = self.view as! SCNView scnView.scene = scene scnView.allowsCameraControl = true let path = UIBezierPath() path.moveToPoint(CGPoint(x: -20, y: -20)) path.addCurveToPoint(CGPoint(x: 20, y: 20), controlPoint1: CGPoint(x: 5, y: 5), controlPoint2: CGPoint(x: 15, y: 15)) path.closePath() path.flatness = 0.3 var scnShape:SCNShape = SCNShape(path: path,

SceneKit draw curved line

巧了我就是萌 提交于 2021-02-19 04:31:30
问题 I'd like to draw a bezier curved line with SceneKit and thought this would work: func drawCurvedLine() { let scene = SCNScene() let scnView = self.view as! SCNView scnView.scene = scene scnView.allowsCameraControl = true let path = UIBezierPath() path.moveToPoint(CGPoint(x: -20, y: -20)) path.addCurveToPoint(CGPoint(x: 20, y: 20), controlPoint1: CGPoint(x: 5, y: 5), controlPoint2: CGPoint(x: 15, y: 15)) path.closePath() path.flatness = 0.3 var scnShape:SCNShape = SCNShape(path: path,

How can i draw a bottom curve of the uiview using uibezierpath?

南楼画角 提交于 2021-02-10 06:30:47
问题 I'm tried to draw a bottom curve on UIimageview using uibezierpath. I don't know how to do that? - (void)setMaskTo:(UIView*)view byRoundingCorners: (UIRectCorner)corners { UIBezierPath *rounded = [UIBezierPath bezierPathWithRoundedRect:view.bounds byRoundingCorners:corners cornerRadii:CGSizeMake(200.0, 200.0)]; CAShapeLayer *shape = [[CAShapeLayer alloc] init]; [shape setPath:rounded.CGPath]; view.layer.mask = shape; } i already tried like this https://imgur.com/a/WKykdyU I expect the output

How to draw a text on a UIBezierPath?

為{幸葍}努か 提交于 2021-02-08 11:34:31
问题 I don't know if that is possible. My researches so far, did not give any hints. I have a UIBezierPath and like to draw a text alined it, so the text is curved. I this possible ? Any hints where to start ? 回答1: See CurvyText from iOS Programming Pushing the Limits for a simple version that draws along a single cubic Bézier curve. The technique can be extended to more complex curves, but it does become more complicated, particularly at the junctions. There are several basic techniques you need.

Specifying UIBezierPath points with corner radii like in drawing apps (e.g. Sketch)

孤街醉人 提交于 2021-02-08 11:28:24
问题 In drawing apps such as Sketch, when you draw a vector, you can specify a custom corner radius for each point individually. For example, here is a 5 point vector, with the middle point's corner radius set to 17: (The top left and bottom right points have custom radii as well.) In Swift, I can draw paths using a UIBezierPath, but when I specify addLine , I'm only given an option to specify a point. I don't have the option to specify a corner radius. How do I give addLine a corner radius? It

How to make an ellipse/circular UIImage with transparent background?

£可爱£侵袭症+ 提交于 2021-02-08 09:51:28
问题 This is the code I am using extension UIImage { var ellipseMasked: UIImage? { guard let cgImage = cgImage else { return nil } let rect = CGRect(origin: .zero, size: size) return UIGraphicsImageRenderer(size: size, format: imageRendererFormat) .image{ _ in UIBezierPath(ovalIn: rect).addClip() UIImage(cgImage: cgImage, scale: scale, orientation: imageOrientation) .draw(in: rect) } } } This is the image I got The background color is black. How can I make the background transparent? I tried

UIBezierPath containsPoint: don't work correctly?(Updated: touch location in superview how to handle?)

帅比萌擦擦* 提交于 2021-02-08 05:46:40
问题 So I have 2 UIViews witch can draw a bezierpath and then returns the path. Then I need to check if the path contains a point I do this with help of [path containsPoint:currentObject.position] and it works for one of the views but not the other. One view is on the top half of the iPhone and the other view is on the bottom half. The one on the bottom don't work. I tried to switch the views, and then it was the same problem, the bottom one doesn't work. Here is some code: in mainviewcontroller:

UIBezierPath- Both direction Arrow with Curve

荒凉一梦 提交于 2021-02-07 20:27:16
问题 I am trying to make an arrow which have two side arrow mark and in middle arc curve But Now i have used mayOff_gist and able to make single line arrow with one side . code- //.h @interface UIBezierPath (arrow) + (UIBezierPath *)dqd_bezierPathWithArrowFromPoint:(CGPoint)startPoint toPoint:(CGPoint)endPoint tailWidth:(CGFloat)tailWidth headWidth:(CGFloat)headWidth headLength:(CGFloat)headLength; @end //.m #define kArrowPointCount 7 @implementation UIBezierPath (arrow) + (UIBezierPath *)dqd

UIBezierPath- Both direction Arrow with Curve

南楼画角 提交于 2021-02-07 20:26:11
问题 I am trying to make an arrow which have two side arrow mark and in middle arc curve But Now i have used mayOff_gist and able to make single line arrow with one side . code- //.h @interface UIBezierPath (arrow) + (UIBezierPath *)dqd_bezierPathWithArrowFromPoint:(CGPoint)startPoint toPoint:(CGPoint)endPoint tailWidth:(CGFloat)tailWidth headWidth:(CGFloat)headWidth headLength:(CGFloat)headLength; @end //.m #define kArrowPointCount 7 @implementation UIBezierPath (arrow) + (UIBezierPath *)dqd

Shadow on UIView layer

家住魔仙堡 提交于 2021-02-07 06:34:29
问题 I've make a path in order to mask my view: let path = // create magic path (uiview bounds + 2 arcs) let mask = CAShapeLayer() mask.path = path.cgPath view.layer.masksToBounds = false view.layer.mask = mask Up to here all ok. Now I would like to add a shadow that follows path, is it possibile? I try in several way, the last one is: mask.shadowPath = path.cgPath mask.shadowColor = UIColor.red.cgColor mask.shadowOffset = CGSize(width: 10, height: 2.0) mask.shadowOpacity = 0.5 But this produce a