W2261 Paths

From Coder Merlin
Revision as of 09:01, 11 June 2019 by Chukwuemeka-tinashe (talk | contribs) (Created page with "== Complex Shapes == Arbitrarily complex shapes may be constructed using '''Path'''s. Paths are built of primitives enabling us to add straight lines or curves and then final...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Within these castle walls be forged Mavens of Computer Science ...
— Merlin, The Coder

Complex Shapes[edit]

Arbitrarily complex shapes may be constructed using Paths. Paths are built of primitives enabling us to add straight lines or curves and then finally rendering the path by stroking or filling.

Adding Straight Lines[edit]

  • To add a series of lines, we have two options:
    • To move to a new position without drawing a line, we use the moveTo() method on a path.
    • To draw a line to a new position continuing from the previous position, we use the lineTo() method on a path.