swift – 使用SKShapeNode在Sprite Kit中绘制虚线

swift – 使用SKShapeNode在Sprite Kit中绘制虚线,第1张

概述I fount this solution but I can’t make it into swift code 这就是我的尝试 var pattern[2]:CGFloat; this var dashed: CGPathRef = CGPathCreateCopyByDashingPath(CGPathCreateCopyByDashingPath(path, transform, ph I fount this solution but I can’t make it into swift code

这就是我的尝试

var pattern[2]:CGfloat; this var dashed: CGPathref = CGPathCreatecopyByDashingPath(CGPathCreatecopyByDashingPath(path,transform,phase,lengths,count);var myShapeNode: SKShapeNode!;        var CGPathCreatecopyByDashingPath:CGPathref;
解决方法 这是你在swift中绘制虚线的方法.您可以根据需要更改参数.

let bezIErPath = UIBezIErPath()let startPoint = CGPointMake(0,250)let endPoint = CGPointMake(450,250)bezIErPath.movetoPoint(startPoint)bezIErPath.addlinetoPoint(endPoint)var pattern : [CGfloat] = [10.0,10.0]let dashed = CGPathCreatecopyByDashingPath (bezIErPath.CGPath,nil,pattern,2)var shapeNode = SKShapeNode(path: dashed)shapeNode.position = CGPointMake(100,100)self.addChild(shapeNode)
总结

以上是内存溢出为你收集整理的swift – 使用SKShapeNode在Sprite Kit中绘制虚线全部内容,希望文章能够帮你解决swift – 使用SKShapeNode在Sprite Kit中绘制虚线所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1012668.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-22
下一篇2022-05-22

发表评论

登录后才能评论

评论列表(0条)

    保存