The following code draws a straight line that connect the two points x1, y1 and x2, y2:
line( x1, y1, x2, y2);
The following code will draw the same straight line
line( x2, y2, x1, y1);
For convenience, we'll refer to these as first and second points, where the first point is written before the second point. You task is to complete the following statement that draws a line where
1.
The first point is at 80, 70
2.
The second point is 30 pixels to the left of the first point, and 20 pixels below the first point.
ANSWER - line(80,
70, 50, 90);
QUESTION 5:
The following code draws a rectangle where the x and y coordinates represent the upper-left corner of the shape, with a width of w and a height of h.
rect(
x, y, w, h);
Determine what changes when the following statement is added.
ANSWER:
rectMode(CENTER);
Before it would start from the up left corner but rectMode(CENTER); will cause the drawing to start from the middle of the rectangle
rect( x, y, w, h);
QUESTION 6:
ANSWER:
size(200,200);
strokeWeight(4);