diff --git a/Playground-iOS.playground/Pages/Basic.xcplaygroundpage/Contents.swift b/Playground-iOS.playground/Pages/Basic.xcplaygroundpage/Contents.swift deleted file mode 100644 index b40af0a..0000000 --- a/Playground-iOS.playground/Pages/Basic.xcplaygroundpage/Contents.swift +++ /dev/null @@ -1,89 +0,0 @@ -// RoughSwift iOS Playground - -import UIKit -import RoughSwift -import PlaygroundSupport - -let size = CGSize(width: 800, height: 500) -let view = UIView(frame: CGRect(origin: .zero, size: size)) -view.backgroundColor = .white - -// https://roughjs.com/examples/sampler.html - -func sineWave(generator: Generator) { - let points: [Point] = Array(0..<20).map { i in - let x: Float = (400 / 20) * Float(i) + 100 - let xdeg = (Float.pi / 100) * x - let y = round(sin(xdeg) * 90) + 250 - return Point(x: x, y: y) - } - - var options = Options() - options.stroke = UIColor.brown - options.strokeWidth = 3 - options.roughness = 1.2 - generator.curve(points: points, options: options) -} - -func polygon(generator: Generator) { - let points = [ - Point(x: 5, y: 5), - Point(x: 100, y: 50), - Point(x: 50, y: 100), - Point(x: 10, y: 90) - ] - - var options = Options() - options.stroke = UIColor.red - options.fill = UIColor.green - options.hachureAngle = 65 - - generator.polygon(points: points, options: options) -} - -func chart(generator: Generator) { - let width: Float = 50 - var options = Options() - options.fill = UIColor.yellow - Array(0..<10).forEach { i in - let height = Float(arc4random_uniform(150)) - generator.rectangle(x: Float(i) * width + 100, y: 470 - height, width: width, height: height, options: options) - } -} - -let layer = draw(size: size, using: { generator in - var options = Options() - options.fill = UIColor.green - generator.rectangle(x: 80, y: 10, width: 140, height: 100, options: options) - - options.fill = UIColor.blue - options.fillStyle = .starBurst - generator.circle(x: 280, y: 50, diameter: 80, options: options) - - options.fill = UIColor.brown - options.fillStyle = .zigzagLine - generator.ellipse(x: 400, y: 50, width: 140, height: 80, options: options) - - options.stroke = UIColor.purple - options.strokeWidth = 4 - options.fillStyle = .crossHatch - generator.arc(x: 500, y: 20, width: 200, height: 180, start: 0, stop: Float.pi/2, closed: true, options: options) - - sineWave(generator: generator) - polygon(generator: generator) - chart(generator: generator) -}) - -let bird = draw(size: CGSize(width: 150, height: 150), using: { generator in - var options = Options() - options.stroke = UIColor.brown - options.fill = UIColor.red - let apple = "M85 32C115 68 239 170 281 192 311 126 274 43 244 0c97 58 146 167 121 254 28 28 40 89 29 108 -25-45-67-39-93-24C176 409 24 296 0 233c68 56 170 65 226 27C165 217 56 89 36 54c42 38 116 96 161 122C159 137 108 72 85 32z" - generator.path(d: apple, options: options) -}) - -bird.frame.origin = CGPoint(x: 500, y: 140) - -view.layer.addSublayer(layer) -view.layer.addSublayer(bird) -PlaygroundPage.current.liveView = view diff --git a/Playground-iOS.playground/Pages/Shape.xcplaygroundpage/Contents.swift b/Playground-iOS.playground/Pages/Shape.xcplaygroundpage/Contents.swift deleted file mode 100644 index 3a710cf..0000000 --- a/Playground-iOS.playground/Pages/Shape.xcplaygroundpage/Contents.swift +++ /dev/null @@ -1,60 +0,0 @@ -// RoughSwift iOS Playground - -import UIKit -import RoughSwift -import PlaygroundSupport - -let size = CGSize(width: 800, height: 500) -let view = UIView(frame: CGRect(origin: .zero, size: size)) -view.backgroundColor = .white - -func greenRectangle(generator: Generator) { - var options = Options() - options.fill = UIColor.green - generator.rectangle(x: 80, y: 10, width: 140, height: 100, options: options) -} - -func circles(generator: Generator) { - var options = Options() - options.stroke = UIColor.blue - - options.fill = UIColor.red - options.fillStyle = .crossHatch - generator.circle(x: 100, y: 100, diameter: 100, options: options) - - options.fill = UIColor.green - options.fillStyle = .dashed - generator.circle(x: 230, y: 100, diameter: 100, options: options) - - options.fill = UIColor.purple - options.fillStyle = .dots - generator.circle(x: 350, y: 100, diameter: 100, options: options) - - options.fill = UIColor.cyan - options.fillStyle = .hachure - generator.circle(x: 480, y: 100, diameter: 100, options: options) - - options.fill = UIColor.orange - options.fillStyle = .solid - generator.circle(x: 100, y: 300, diameter: 100, options: options) - - options.fill = UIColor.gray - options.fillStyle = .starBurst - generator.circle(x: 230, y: 300, diameter: 100, options: options) - - options.fill = UIColor.yellow - options.fillStyle = .zigzag - generator.circle(x: 350, y: 300, diameter: 100, options: options) - - options.fill = UIColor.blue - options.fillStyle = .zigzagLine - generator.circle(x: 480, y: 300, diameter: 100, options: options) -} - -let layer = draw(size: size, using: { generator in - // greenRectangle(generator: generator) - circles(generator: generator) -}) - -view.layer.addSublayer(layer) -PlaygroundPage.current.liveView = view diff --git a/Playground-iOS.playground/Pages/Try.xcplaygroundpage/Contents.swift b/Playground-iOS.playground/Pages/Try.xcplaygroundpage/Contents.swift deleted file mode 100644 index a510648..0000000 --- a/Playground-iOS.playground/Pages/Try.xcplaygroundpage/Contents.swift +++ /dev/null @@ -1,32 +0,0 @@ -// RoughSwift iOS Playground - -import UIKit -import RoughSwift -import PlaygroundSupport - -let size = CGSize(width: 300, height: 300) -let view = UIView(frame: CGRect(origin: .zero, size: size)) -view.backgroundColor = .white - -let layer = draw(size: size, using: { generator in - var options = Options() - options.fill = UIColor.brown - options.fillStyle = .zigzag - generator.circle(x: 200, y: 200, diameter: 120, options: options) - - options.fill = UIColor.purple - options.fillStyle = .hachure - generator.circle(x: 200, y: 100, diameter: 80, options: options) - - options.fillStyle = .starBurst - options.fill = UIColor.blue - generator.rectangle(x: 10, y: 10, width: 100, height: 50, options: options) - - options.fill = UIColor.green - options.fillStyle = .crossHatch - options.stroke = UIColor.brown - generator.ellipse(x: 80, y: 170, width: 100, height: 50, options: options) -}) - -view.layer.addSublayer(layer) -PlaygroundPage.current.liveView = view diff --git a/Playground-iOS.playground/contents.xcplayground b/Playground-iOS.playground/contents.xcplayground deleted file mode 100644 index 0c1978d..0000000 --- a/Playground-iOS.playground/contents.xcplayground +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/Playground-iOS.playground/playground.xcworkspace/contents.xcworkspacedata b/Playground-iOS.playground/playground.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 919434a..0000000 --- a/Playground-iOS.playground/playground.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/Playground-iOS.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Playground-iOS.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist deleted file mode 100644 index 18d9810..0000000 --- a/Playground-iOS.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +++ /dev/null @@ -1,8 +0,0 @@ - - - - - IDEDidComputeMac32BitWarning - - - diff --git a/RoughSwift.xcworkspace/contents.xcworkspacedata b/RoughSwift.xcworkspace/contents.xcworkspacedata index fd100f5..efbbada 100644 --- a/RoughSwift.xcworkspace/contents.xcworkspacedata +++ b/RoughSwift.xcworkspace/contents.xcworkspacedata @@ -2,7 +2,7 @@ + location = "group:../../Downloads/MyPlayground.playground">