Drawing
Drawing Functions
drawPixel
drawPixel
Draws a single pixel.
x
*
number
-
the x coordinate of the point
y
*
number
-
the y coordinate of the point
color
string
'black'
the color to use
Returns
nothing
drawLine
drawLine
Draws a straight line.
x1
*
number
-
the x coordinate of the start of the line
y1
*
number
-
the y coordinate of the start of the line
x2
*
number
-
the x coordinate of the end of the line
y2
*
number
-
the y coordinate of the end of the line
color
string
'black'
the color to use
thickness
number
1
the thickness of the line
Returns
nothing
drawCircle
drawCircle
Draws the outline of a circle.Draws a straight line.
x
*
number
-
the x coordinate of the center of the circle
y
*
number
-
the y coordinate of the center of the circle
radius
*
number
-
the radius of the circle
color
string
'black'
the color to use
thickness
number
1
the thickness of the edge
Returns
nothing
fillCircle
fillCircle
Draws a solid, filled-in, circle.
x
*
number
-
the x coordinate of the center of the circle
y
*
number
-
the y coordinate of the center of the circle
radius
*
number
-
the radius of the circle
color
string
'black'
the color to use
Returns
nothing
drawEllipse
drawEllipse
Draws the outline of an ellipse.
x
*
number
-
the x coordinate of the center of the ellipse
y
*
number
-
the y coordinate of the center of the ellipse
width
*
number
-
the width of the ellipse
height
*
number
-
the height of the ellipse
color
string
'black'
the color to use
thickness
number
1
the thickness of the edge
Returns
nothing
fillEllipse
fillEllipse
Draws a solid, filled-in, ellipse.
x
*
number
-
the x coordinate of the center of the ellipse
y
*
number
-
the y coordinate of the center of the ellipse
width
*
number
-
the width of the ellipse
height
*
number
-
the height of the ellipse
color
string
'black'
the color to use
Returns
nothing
drawRectangle
drawRectangle
Draws the outline of a rectangle.
x
*
number
-
the x coordinate of the top-left corner of the rectangle
y
*
number
-
the y coordinate of the top-left corner of the rectangle
width
*
number
-
the width of the rectangle
height
*
number
-
the height of the rectangle
color
string
'black'
the color to use
thickness
number
1
the thickness of the line
Returns
nothing
fillRectangle
fillRectangle
Draws a solid, filled-in, rectangle.
x
*
number
-
the x coordinate of the top-left corner of the rectangle
y
*
number
-
the y coordinate of the top-left corner of the rectangle
width
*
number
-
the width of the rectangle
height
*
number
-
the height of the rectangle
color
string
'black'
the color to use
Returns
nothing
drawPolygon
drawPolygon
Draws the outline of a shape with straight sides.
pointlist
*
array
-
An array of arrays, where each subarray is the [x, y]
coordinates of a vertex of the polygon.
color
string
'black'
the color to use
thickness
number
1
the thickness of the line
Returns
nothing
fillPolygon
fillPolygon
Draws a solid, filled-in, shape with straight sides.
pointlist
*
array
-
An array of arrays, where each subarray is the [x, y]
coordinates of a vertex of the polygon.
color
string
'black'
the color to use
Returns
nothing
drawString
drawString
Draws text on the screen
text
*
string
-
the text to display
x
*
number
-
the x coordinate of the top-left corner of the text
y
*
number
-
the y coordinate of the top-left corner of the text
size
number
30
the size of the letters in the text, in pixels
color
string
'black'
the color to use
bold
boolean
false
true
for bold, false
for regular
italic
boolean
false
true
for italic, false
for regular
Returns
nothing
Last updated