Author
Travis Kirton


Fill & Stroke

You can change the fill and stroke colors by setting their respective properties:

custom.fillColor = green
custom.strokeColor = magenta

The default colors for a shape are fill: C4Blue and stroke: C4Purple.

Example

//create a variable rect
var f = Rect(0, 0, 200, 200)

//position the frame, create the default shape
f.center = Point(canvas.width/3, canvas.center.y)
let shape = Ellipse(frame: f)

//position the frame, create the custom shape
f.center = Point(canvas.width*2/3, canvas.center.y)
let custom = Ellipse(frame: f)

//you can cast from a UIColor to a C4 Color
//set the fill and stroke colors for the custom shape
custom.fillColor = green
custom.strokeColor = magenta

//add the shapes to the canvas
canvas.add(shape)
canvas.add(custom)

Did you see how we set the center of the Rect?