This is done by changing a property of the drawing context. Once we've done that, anything else we draw will be drawn in the new colour.
Challenge: Try to draw a third rectangle somewhere else on the canvas, but make it green.
Pro tip: Use copy and paste, rather than re-typing. You'll make fewer 'case' and punctuation errors. But remember to move your new rectangle to a different position, otherwise you won't see it.
|