Skip to content
mohayonao edited this page Aug 11, 2014 · 11 revisions

line

Draws a line to the canvas. To color a line, use the stroke() function. A line cannot be filled, therefore the fill() function will not affect the color of a line.

Examples

canvas.stroke(15)
  .line(20, 20, 80, 80);

canvas.stroke([ 0, 15, 6 ])
  .line(120, 50, 180, 50);

Syntax

canvas.line(x1, y1, x2, y2);

Parameters

  • x1: int
    • x-coordinate of the first point
  • y1: int
    • y-coordinate of the first point
  • x2: int
    • x-coordinate of the second point
  • y2: int
    • y-coordinate of the second point

Returns

Canvas: self for method chaining

Related