Shapes
Every shape VeeLang can draw, with what at means for it, the properties you can give it after having, and the points and numbers you can read from a named shape (like box.center).
All shapes that have an inside take fill (the inside color), stroke (the outline color), color (both at once) and thickness (how thick the outline is). Positions are measured in steps from the top-left corner of the canvas: the first number goes across, the second goes down.
circle
draw circle at 120, 100 having radius 60, fill "tomato"
|
|
at |
the center |
| Properties |
radius, fill, stroke, color, thickness |
| You can read |
center, radius, color |
oval
draw oval at 150, 100 having width 200, length 100, fill "pink"
|
|
at |
the center |
| Properties |
width, length, fill, stroke, color, thickness |
| You can read |
center, width, length, color |
rectangle
draw rectangle at 50, 50 having width 200, length 100, fill "lightblue"
|
|
at |
the top-left corner |
| Properties |
width, length, fill, stroke, color, thickness |
| You can read |
center, topLeft, topRight, bottomLeft, bottomRight, width, length, color |
square
draw square at 50, 50 having size 120, fill "gold"
|
|
at |
the top-left corner |
| Properties |
size, fill, stroke, color, thickness |
| You can read |
the same as a rectangle |
triangle
draw triangle having corner1 at 50, 200, corner2 at 250, 200, corner3 at 150, 40, fill "green"
|
|
at |
the top-left of the box around the triangle. Without corners, a triangle is 100 wide and 100 tall. |
| Properties |
corner1, corner2, corner3, fill, stroke, color, thickness |
| You can read |
corner1, corner2, corner3, center, color |
polygon
A polygon is drawn in one of two ways.
With equal sides: say how many sides it has.
draw polygon at 150, 150 having sides 6, size 160, fill "gold"
|
|
at |
the center |
| Properties |
sides (3 to 100), size (how wide it is: the corners sit on a circle that wide; 100 if not given), fill, stroke, color, thickness |
| Shape |
the first corner points straight up, and the rest follow clockwise |
With corners you choose: list them.
draw polygon from 150, 20 to 230, 120 to 150, 280 to 70, 120 having fill "orange"
|
|
| Position |
from the first corner to each next corner (at least 3 corners); it closes itself |
| Properties |
fill, stroke, color, thickness. at (set with name.at = x, y) moves the whole polygon, like a triangle's. |
Either way, you can read corner1, corner2, ... (clockwise from the top, or in the order written), center, at and color.
line
draw line from 50, 50 to 250, 150 having color "navy", thickness 4
|
|
| Position |
from where it starts to where it ends |
| Properties |
color, stroke, thickness |
| You can read |
start, end, center, length, color |
arc
draw arc from 50, 150 to 250, 150 having radius 120, color "purple", thickness 4
|
|
| Position |
from where it starts to where it ends |
| Properties |
radius (how round it is), curve ("small" or "big"), color, stroke, thickness |
| You can read |
start, end, radius, color |
text
draw text at 40, 100 having content "Hello!", size 48, color "purple", font "cursive"
|
|
at |
where the words start, on the line they sit on |
| Properties |
content (the words, in quotes), size, font ("sans-serif", "serif", "monospace" or "cursive"), color or fill |
| You can read |
center (the at point), color |
Points and numbers
A point like box.center has an x (across) and a y (down): box.center.x. Points are always positions on the whole drawing, even for a shape inside another shape.
Not yet
There are no ready-made stars, hearts, diamonds, hexagons, pentagons or arrows yet, but you can draw any of them as a polygon. Those words also work as names, like polygon star from ....