Documentation


Commands

clear

clears the screen


undo

undo the last thing drawn


color <hex color>

specify the color to draw with - color should be given as hexadecimal


linewidth <size>

specify the width of the pen


stroke

only draw the outline of shapes


fill

fill shapes with color


line <fromX> <fromY> <toX> <toY>

draw a line from (fromX, fromY) to (toX, toY)


rect <x> <y> <width> <height>

draw a rectangle starting at (x, y) with the specified width and height


square <x> <y> <size>

draw a square starting at (x, y) with the width and height of the size specified


csquare <x> <y> <size>

same as square, but x and y specify the centerpoint of the square


circle <x> <y> <radius>

draw a circle at (x, y) with the specified radius

Ranges

When drawing lines and shapes, instead of passing a number for positions and sizes, you can specify ranges. This allows you to draw multiple shapes with a single command. Ranges have the following syntax:

<start>:<stop>:<increment>

See the Examples section for sample code.

Examples

Draws 5 circles with the following x positions: 100, 200, 300. Each circle has y position 100 and radius 50.

circle 100:300:100 100 50

Run the below examples in script mode to see what they do.

Note: On mobile, the x and y positions may need to be adjusted to fit on screen

example 1

clear  
linewidth 1  
circle 800 250 10:200:10  
circle 1000 250 10:200:10  
circle 800 450 10:200:10  
circle 1000 450 10:200:10  
circle 900 350 10:140:10

example 2

clear  
linewidth 1  
color #ff9900  
circle 800:1000:50 300:500:50 10:150:20

example 3

clear  
linewidth 1  
square 800 400 -200:200:10  
square 1000 200 -200:200:10

example 4

clear  
linewidth 1  
csquare 700:900:50 300:500:50 250:50:-25