January 2018
Intermediate to advanced
678 pages
20h 16m
English
In the previous section, you learned how to draw curved lines with the arc method. It’s also important to learn how to draw straight lines. Sometimes, you’ll need to display straight lines by themselves. For more complicated drawings, you’ll need to display straight lines that connect to themselves and to curved lines. In this section, you’ll learn how to draw standalone lines, as well as lines that connect to other lines to form paths.
To draw a standalone line segment, you first need to move to the position where you want to start drawing the line. You do that by calling the context object’s moveTo method with x and y argument values for the starting position. Here’s the syntax:
context ...Read now
Unlock full access