Skip to content
This repository has been archived by the owner on Apr 16, 2022. It is now read-only.
Atsuya Sato edited this page Nov 30, 2018 · 6 revisions

Shape


point(_ x: CGFloat, _ y: CGFloat)

Available

iOS, OSX

Examples

point(30, 20)
point(85, 20)
point(85, 75)
point(30, 75)

Description

Draws a point.


line(_ x1: CGFloat, _ y1: CGFloat, _ x2: CGFloat, _ y2: CGFloat)

Available

iOS, OSX

Examples

line(30, 20, 85, 75)

Description

Draws a line.


rect(_ x: CGFloat, _ y: CGFloat, _ width: CGFloat, _ height: CGFloat)

Available

iOS, OSX

Examples

rect(30, 20, 55, 55)

Description

Draws a rectangle.


ellipse(_ x: CGFloat, _ y: CGFloat, _ width: CGFloat, _ height: CGFloat)

Available

iOS, OSX

Examples

ellipse(56, 46, 55, 55)

Description

Draws an ellipse.


arc(_ x: CGFloat, _ y: CGFloat, _ radius: CGFloat, _ start: CGFloat, _ stop: CGFloat)

Available

iOS, OSX

Examples

arc(50, 50, 20, 0, PI+QUARTER_PI)

Description

Draws an arc.


triangle(_ x1: CGFloat, _ y1: CGFloat, _ x2: CGFloat, _ y2: CGFloat, _ x3: CGFloat, _ y3: CGFloat)

Available

iOS, OSX

Examples

triangle(30, 75, 58, 20, 86, 75)

Description

Draws a triangle.


quad(_ x1: CGFloat, _ y1: CGFloat, _ x2: CGFloat, _ y2: CGFloat, _ x3: CGFloat, _ y3: CGFloat, _ x4: CGFloat, _ y4: CGFloat)

Available

iOS, OSX

Examples

quad(38, 31, 86, 20, 69, 63, 30, 76)

Description

Draws a triangle.


curve(_ cpx1: CGFloat, _ cpy1: CGFloat, _ x1: CGFloat, _ y1: CGFloat, _ x2: CGFloat, _ y2: CGFloat, _ cpx2: CGFloat, _ cpy2: CGFloat)

Available

iOS, OSX

Examples

curve(5, 26, 73, 24, 73, 61, 15, 65)

Description

Draws a curved line.


bezier(_ x1: CGFloat, _ y1: CGFloat, _ cpx1: CGFloat, _ cpy1: CGFloat, _ cpx2: CGFloat, _ cpy2: CGFloat, _ x2: CGFloat, _ y2: CGFloat)

Available

iOS, OSX

Examples

bezier(85, 20, 10, 10, 90, 90, 15, 80)

Description

Draws a Bezier curve.


radians(_ degrees: CGFloat) -> CGFloat

Available

iOS, OSX

Examples

let deg = 45
let rad = radians(deg)

Description

Converts a degree measurement to its corresponding value in radians.


Clone this wiki locally