ProductPromotion
Logo

Swift

made by https://0x3d.site

GitHub - bakhtiyork/Rough: Rough lets you draw in a sketchy, hand-drawn-like, style.
Rough lets you draw in a sketchy, hand-drawn-like, style. - bakhtiyork/Rough
Visit Site

GitHub - bakhtiyork/Rough: Rough lets you draw in a sketchy, hand-drawn-like, style.

GitHub - bakhtiyork/Rough: Rough lets you draw in a sketchy, hand-drawn-like, style.

Rough (Swift)

Version License Platform

Rough lets you draw in a sketchy, hand-drawn-like, style. It is Swift clone of Rough.js. The library defines primitives to draw lines, curves, arcs, polygons, circles, and ellipses.

Requirements

Xcode 9, iOS 10

Installation

Rough is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'Rough'

Usage

Rectangle

let canvas = roughView.canvas
canvas.rectangle(origin: CGPoint(x: 10, y: 10), width: 200, height: 100)
roughView.setNeedsDisplay()

Lines and Ellipses

Lines and Ellipses

canvas.circle(center: CGPoint(x: 80, y: 120), radius: 25)
canvas.ellipse(center: CGPoint(x: 300, y: 100), width: 150, height: 80)
canvas.line(from: CGPoint(x: 80, y: 120), to: CGPoint(x: 300, y: 100))

Filling

Filling

canvas.circle(center: CGPoint(x: 50, y: 50), radius: 40) { options in
    options.fill = UIColor.red
} // fill with red hachure

canvas.rectangle(origin: CGPoint(x: 120, y: 15), width: 80, height: 80) { options in
    options.fill = UIColor.red
}

canvas.circle(center: CGPoint(x: 50, y: 150), radius: 40) {
    options in
    options.fill = UIColor(red: 10/255.0, green: 150/255.0, blue: 10/255.0, alpha: 1.0)
    options.fillWeight = 3 // thicker lines for hachure
}

canvas.rectangle(origin: CGPoint(x: 220, y: 15), width: 80, height: 80) { options in
    options.fill = UIColor.red
    options.hachureAngle = 60 // angle of hachure
    options.hachureGap = 8
}

canvas.rectangle(origin: CGPoint(x: 120, y: 105), width: 80, height: 80) { options in
    options.fill = UIColor(red: 1.0, green: 0, blue: 200/255.0, alpha: 0.2)
    options.fillStyle = .solid // solid fill
}

Sketching style

Sketching style

canvas.rectangle(origin: CGPoint(x: 15, y: 15), width: 80, height: 80) { options in
    options.roughness = 0.5
    options.fill = UIColor.red
}

canvas.rectangle(origin: CGPoint(x: 120, y: 15), width: 80, height: 80) { options in
    options.roughness = 2.8
    options.fill = UIColor.blue
}

canvas.rectangle(origin: CGPoint(x: 220, y: 15), width: 80, height: 80) { options in
    options.bowing = 6
    options.stroke = UIColor.green
    options.strokeWidth = 3
}

SVG Path

TODO

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Credits

Credits to Rough.js by Preet

License

Rough is available under the MIT license. See the LICENSE file for more info.

More Resources
to explore the angular.

mail [email protected] to add your project or resources here ๐Ÿ”ฅ.

Related Articles
to learn about angular.

FAQ's
to learn more about Angular JS.

mail [email protected] to add more queries here ๐Ÿ”.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory