Skip to content

Instantly share code, notes, and snippets.

@stepheng
Created November 16, 2016 23:59
Show Gist options
  • Save stepheng/74c641829d0015b9be2935b6164ff264 to your computer and use it in GitHub Desktop.
Save stepheng/74c641829d0015b9be2935b6164ff264 to your computer and use it in GitHub Desktop.
private func dashedLineNode(start: CGPoint, end: CGPoint, pattern: [CGFloat] = [10, 10]) -> SKNode {
let bezierPath = CGMutablePath()
bezierPath.move(to: start)
bezierPath.addLine(to: end)
let dashed = bezierPath.copy(dashingWithPhase: pattern[0] / 2, lengths: pattern)
return SKShapeNode(path: dashed)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment