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.


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

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

//position the frame, create the custom shape = Point(canvas.width*2/3,
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

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