Saturday, November 7, 2026
HomeiOS Developmentios - The impact displayed by SKShapeNode is totally different from that...

ios – The impact displayed by SKShapeNode is totally different from that of CAShapelayer

[ad_1]

I’m going to make use of SKShapeNode to show a Bezier curve graph, however the displayed impact could be very unusual, and it isn’t the identical because the one displayed by CAShapeLayer. I do not know what’s fallacious. Does anybody know the issue?

Here’s a screenshot of the impact I confirmed in two other ways.

The impact displayed by CAShapeLayer seems to be regular and is as anticipated

the impact displayed by SKShapeNode misses some traces

right here is my primary code:

    let bezierPath = UIBezierPath()
            bezierPath.transfer(to: CGPoint(x: 54.5, y: 244.5))
            bezierPath.addCurve(to: CGPoint(x: 54.5, y: 164.5), controlPoint1: CGPoint(x: 53.5, y: 243.5), controlPoint2: CGPoint(x: 29.5, y: 201.5))
            bezierPath.addCurve(to: CGPoint(x: 54.5, y: 70.5), controlPoint1: CGPoint(x: 79.5, y: 127.5), controlPoint2: CGPoint(x: 54.5, y: 70.5))
            bezierPath.addLine(to: CGPoint(x: 227.5, y: 70.5))
            bezierPath.addCurve(to: CGPoint(x: 227.5, y: 164.5), controlPoint1: CGPoint(x: 227.5, y: 70.5), controlPoint2: CGPoint(x: 254.5, y: 127.5))
            bezierPath.addCurve(to: CGPoint(x: 227.5, y: 244.5), controlPoint1: CGPoint(x: 200.5, y: 201.5), controlPoint2: CGPoint(x: 227.5, y: 244.5))
            bezierPath.addCurve(to: CGPoint(x: 54.5, y: 244.5), controlPoint1: CGPoint(x: 227.5, y: 244.5), controlPoint2: CGPoint(x: 55.5, y: 245.5))
            bezierPath.shut()

let scene = SKScene.init(measurement: CGSize.init(width: 300, top: 300))
        scene.backgroundColor = UIColor.white
        self.contentView.presentScene(scene)
        
        let node = SKShapeNode.init()
        node.path = bezierPath.cgPath
        node.lineJoin = .miter
        node.lineCap = .spherical
        node.miterLimit = 10
        node.strokeColor = SKColor.blue
        node.fillColor = SKColor.crimson
        node.lineWidth = 10
        node.isAntialiased = true
        scene.addChild(node)

[ad_2]

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments