Drawing your face
The first task of our current mission is to draw a face using Processing. We will use drawing primitives such as ellipses and curves and learn how to change the fill and stroke styles. We want to make three parameters changeable in the next task, so we define variables for these parameters and use their values for drawing our face.
Engage Thrusters
Let's draw a face:
Open a new sketch and add a
setup()
and adraw()
method:void setup() { } void draw() { }
In the
setup()
method, we set the window size to 300 x 300 pixels and turn on line smoothing. We also change the color mode to HSB (which stands for Hue, Saturation, and Brightness) instead of RGB to make changing the color of the face easier.void setup() { size(300,300); smooth(); colorMode(HSB); }
The first thing we are going to draw is a colored circle. To make the color changeable, we will add an integer variable named
col
to our sketch, just abovethesetup()
method.int col = 150; void setup() {
Our control variable...