Created
December 27, 2015 02:01
-
-
Save wolfspider/ad717f49ed6317fa95e0 to your computer and use it in GitHub Desktop.
Swift Rounded Rect Playground
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
| import SpriteKit | |
| import XCPlayground | |
| let view:SKView = SKView(frame: CGRectMake(0, 0, 1024, 768)) | |
| XCPlaygroundPage.currentPage.liveView = view | |
| let scene:SKScene = SKScene(size: CGSizeMake(1024, 768)) | |
| scene.scaleMode = SKSceneScaleMode.AspectFit | |
| view.presentScene(scene) | |
| //Add something to it! | |
| let redBox:SKSpriteNode = SKSpriteNode(color: SKColor.redColor(), size:CGSizeMake(300, 300)) | |
| redBox.position = CGPointMake(512, 384) | |
| redBox.runAction(SKAction.repeatActionForever(SKAction.rotateByAngle(3, duration: 2))) | |
| let redShape:SKShapeNode = SKShapeNode(rectOfSize: CGSizeMake(100, 100)) | |
| redShape.position = CGPointMake(200, 200) | |
| redShape.glowWidth = 1.5 | |
| redShape.strokeColor = SKColor.redColor() | |
| redShape.setScale(0.5) | |
| let redTex:SKTexture = view.textureFromNode(redShape)! | |
| redBox.texture = redTex | |
| //redShape.removeFromParent() | |
| redShape.path = nil | |
| scene.addChild(redBox) | |
| redBox.position = CGPointMake(200, 200) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment