This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ### Keybase proof | |
| I hereby claim: | |
| * I am jamiegilmartin on github. | |
| * I am jamiegilmartin (https://keybase.io/jamiegilmartin) on keybase. | |
| * I have a public key ASD_BeSps-SN3-y42UN1jFwIhbXWpfjsnTFCKWkiRL_eFQo | |
| To claim this, I am signing this object: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ### Keybase proof | |
| I hereby claim: | |
| * I am jamiegilmartin on github. | |
| * I am jamiegilmartin (https://keybase.io/jamiegilmartin) on keybase. | |
| * I have a public key ASD_BeSps-SN3-y42UN1jFwIhbXWpfjsnTFCKWkiRL_eFQo | |
| To claim this, I am signing this object: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //@see https://stackoverflow.com/questions/8563356/nsimage-to-cvmat-and-vice-versa | |
| Mat matFromNSImage(NSImage* image) { | |
| //https://stackoverflow.com/a/2548861/1308629 | |
| CGImageSourceRef source; | |
| source = CGImageSourceCreateWithData((CFDataRef)[image TIFFRepresentation], NULL); | |
| CGImageRef imageRef = CGImageSourceCreateImageAtIndex(source, 0, NULL); | |
| //https://gist.github.com/dominiklessel/1716068 | |
| //CGImageRef imageRef = cgImage; | |
| CGColorSpaceRef colorSpace = CGImageGetColorSpace(imageRef); | |
| CGFloat cols = image.size.width; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| override func update(deltaTime seconds: TimeInterval) { | |
| super.update(deltaTime: seconds) | |
| let lerpRate = 0.5 // or some normalized percentage | |
| x += (Target — x) * lerpRate | |
| myNode.position.x = x | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let path = CGMutablePath() | |
| path.move(to: p1 ) | |
| path.addLine(to: p2 ) | |
| let node = SKShapeNode(path: path) | |
| node.name = name | |
| node.zPosition = 0 | |
| parentNode.addChild(node) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SKColor(red: 255, green: 0, blue: 255, alpha: 0.7) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let p1 = CGPoint(x: 0, y: 0) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let node = SKShapeNode(circleOfRadius: radius) | |
| node.position = p1 | |
| node.glowWidth = 1.0 | |
| node.strokeColor = .white | |
| node.lineWidth = 2 | |
| node.fillColor = .clear | |
| node.alpha = 0.5 |