![]()
这就是我的尝试
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中绘制虚线所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)