Line

Line

{Object} Line Line object

Constructor

new Line()

Description:
  • Create a Line object
Source:
Properties:
Name Type Attributes Default Description
start Point Start X & Y axis coordinates
end Point End X & Y axis coordinates
stroke Stroke Stroke properties
shadow Shadow Shadow properties
lineCap string <optional>
'round' Line cap's end points shape
canvas HTMLCanvasElement 2D canvas context
controlPoints ControlPoints Control point properties
options Options Options for this object
position Position Position properties

Methods

canvas(value)

Description:
  • Set canvas value
Source:
See:
Parameters:
Name Type Description
value string Canvas id

canvas() → {string}

Description:
  • Get canvas value
Source:
See:
Returns:
Canvas id
Type
string

center() → {Point}

Description:
  • Get center of this object
Source:
Returns:
Center point coordinates
Type
Point

controlPoints() → {ControlPoints}

Description:
  • Get control point properties
Source:
Returns:
Control points properties
Type
ControlPoints

curve(p0, p1, p2, p3)

Description:
  • Set control points for bezier curve
Source:
Parameters:
Name Type Description
p0 number Control point 0
p1 number Control point 1
p2 number Control point 2
p3 number Control point 3

draw(canvas)

Description:
  • Draw this object
Source:
Parameters:
Name Type Description
canvas string Canvas Id

drawPoints()

Description:
  • Draws start & end points
Source:

end(value)

Description:
  • Set ending point
Source:
Parameters:
Name Type Description
value Point Ending point

end() → {Point}

Description:
  • Set ending point
Source:
Returns:
Ending point
Type
Point

isThere(line)

Description:
  • Check whether the passed object is already present
Source:
Parameters:
Name Type Description
line Line Object to validate

lineCap(value)

Description:
  • Set line cap
Source:
Parameters:
Name Type Description
value string Line cap

lineCap() → {string}

Description:
  • Get line cap
Source:
Returns:
Line cap
Type
string

move(degree, distance)

Description:
  • Move this object
Source:
Parameters:
Name Type Description
degree number Direction to move; in degrees
distance number Distance to move

options() → {Options}

Description:
  • Get options properties
Source:
Returns:
Options properties
Type
Options

position() → {Position}

Description:
  • Get position properties
Source:
Returns:
Position properties
Type
Position

rotate(degree, anchoropt)

Description:
  • Rotate this object
Source:
Parameters:
Name Type Attributes Default Description
degree number Distance to rotate; in degrees
anchor string <optional>
'center' Anchoring point during rotation

shadow() → {Shadow}

Description:
  • Get shadow properties
Source:
Returns:
Shadow properties
Type
Shadow

showControlPoints(offsetopt, fontSizeopt)

Description:
  • Show control points for this object
Source:
Parameters:
Name Type Attributes Default Description
offset number <optional>
10 Offset of control points y origin
fontSize number <optional>
16 Control points font size

showCoordinates(offsetopt, fontSizeopt)

Description:
  • Shows coordinates of this object
Source:
Parameters:
Name Type Attributes Default Description
offset number <optional>
10 Offset of coordinates y origin
fontSize number <optional>
16 Coordinates font size

start(value)

Description:
  • Set starting point
Source:
Parameters:
Name Type Description
value Point Starting point

start() → {Point}

Description:
  • Set starting point
Source:
Returns:
Starting point
Type
Point

stroke() → {Stroke}

Description:
  • Get stroke properties
Source:
Returns:
Stroke properties
Type
Stroke