Shape
Collection Functions
compose shape1 shape2
Combines two shapes shape1
and shape2
into a single shape. shape2
is always rendered over shape1
.
Equivalent to the (:)
binary operator.
Example:
collect shapes
Combines a list of shapes shapes
into a single shape. Shapes are rendered in order of list.
Example:
copy shape
Returns a duplicate of shape
.
This is required in situations where you need to render the same shape object multiple times. Not doing so will result in a crash.
Example:
Translation Functions
t x y shape
Returns shape
translated by x
and y
on the x and y axes. x
and y
must be of the integer or float types and shape
must be of the shape type.
Shorthand for the translate
function.
Example:
tx x shape
Returns shape
translated by x
on the x axis. x
must be of the integer or float types and shape
must be of the shape type.
Shorthand for the translatex
function.
Example:
ty y shape
Returns shape
translated by y
on the y axis. y
must be of the integer or float types and shape
must be of the shape type.
Shorthand for the translatey
function.
Example:
tt n shape
Returns shape
translated by n
on both the x and y axes. n
must be of the integer or float types and shape
must be of the shape type.
Shorthand for the translateb
function.
Example:
Rotation Functions
r deg shape
Returns shape
rotated by deg
degrees. deg
must be of the integer or float types and shape
must be of the shape type.
Shorthand for the rotate
function.
Example:
ra deg x y shape
Returns shape
rotated by deg
degrees at position x
and y
. deg
, x
, and y
must be of the integer or float types and shape
must be of the shape type.
Shorthand for the rotate_at
function.
Example:
Scale Functions
s x y shape
Returns shape
scaled by x
and y
on the x and y axes. x
and y
must be of the integer or float types and shape
must be of the shape type.
Shorthand for the scale
function.
Example:
sx x shape
Returns shape
scaled by x
on the x axis. x
must be of the integer or float types and shape
must be of the shape type.
Shorthand for the scalex
function.
Example:
sy y shape
Returns shape
scaled by y
on the y axis. y
must be of the integer or float types and shape
must be of the shape type.
Shorthand for the scaley
function.
Example:
ss n shape
Returns shape
scaled by n
on both the x and y axes. n
must be of the integer or float types and shape
must be of the shape type.
Shorthand for the scaleb
function.
Example:
Skew Functions
k x y shape
Returns shape
skewed by x
and y
on the x and y axes. x
and y
must be of the integer or float types and shape
must be of the shape type.
Shorthand for the skew
function.
Example:
kx x shape
Returns shape
skewed by x
on the x axis. x
must be of the integer or float types and shape
must be of the shape type.
Shorthand for the skewx
function.
Example:
ky y shape
Returns shape
skewed by y
on the y axis. y
must be of the integer or float types and shape
must be of the shape type.
Shorthand for the skewy
function.
Example:
kk n shape
Returns shape
skewed by n
on the x and y axes. n
must be of the integer or float types and shape
must be of the shape type.
Shorthand for the skewb
function.
Example:
Flip Functions
f deg shape
Returns shape
flipped along the deg
angle. deg
must be of the integer or float types and shape
must be of the shape type.
Shorthand for the flip
function.
Example:
fh shape
Returns shape
flipped along the x axis. shape
must be of the shape type.
Shorthand for the fliph
function.
Example:
fv shape
Returns shape
flipped along the y axis. shape
must be of the shape type.
Shorthand for the flipv
function.
Example:
fd shape
Returns shape
flipped along both the x and y axes. shape
must be of the shape type.
Shorthand for the flipd
function.
Example:
Z-Index Functions
z n shape
Returns shape
with its z-index set to z
. Shapes with a higher z-index are rendered on top of shapes with a lower z-index. z
must be of the integer or float types and shape
must be of the shape type.
Shorthand for the zindex
function.
Example:
zshift n shape
Returns shape
with its z-index shifted by n
. n
must be of the integer or float types and shape
must be of the shape type.
Example:
Rendering Functions
blend bm shape
Returns shape
with its blend mode set to bm
.
Example:
anti_alias toggle shape
Returns shape
with anti-aliasing set to toggle
. toggle
must be of the boolean type and shape
must be of the shape type.
Example:
fill shape
Returns shape
with its style set to fill.
Example:
winding shape
Returns shape
with its fill rule set to winding.
Specifies that “inside” is computed by a non-zero sum of signed edge crossings.
Example:
even_odd shape
Returns shape
with its fill rule set to even-odd.
Specifies that “inside” is computed by an odd number of edge crossings.
Example:
stroke w shape
Returns shape
with its style set to stroke with a stroke width of w
. w
must be of the integer or float types.
When stroke width is set to 0, a hairline stroking will be used.
Example:
miter_limit n shape
Returns shape
with its style set to stroke and its miter limit set to n
. n
must be of the integer or float types.
Miter limit is the limit at which a sharp corner is drawn beveled.
Example:
line_cap lc shape
Returns shape
with its style set to stroke and its line cap set to lc
.
Example:
line_join lj shape
Returns shape
with its style set to stroke and its line join set to lj
.
Example:
dash array offset shape
Returns shape
with its style set to stroke and its dash properties set to array
and offset
. array
must be a list of either integers or floats and offset
must be of the integer or float types.
The array must be of pairs, where the first number indicates an “on” interval and the second one indicates an “off” interval. The offset affects where the dash pattern starts.
Example:
no_dash shape
Returns shape
with its style set to stroke and its dash removed.
Example:
Path Functions
move_to x y
Returns a new path shape starting at (x
, y
). Accepts integer and float types.
Example:
line_to x y
Continues an existing path by drawing a line from the last point to (x
, y
). Accepts integer and float types.
Example:
quad_to x1 y1 x y
Continues an existing path by drawing a quad curve from the last point to (x
, y
). Accepts integer and float types.
Example:
cubic_to x1 y1 x2 y2 x y
Continues an existing path by drawing a cubic curve from the last point to (x
, y
). Accepts integer and float types.
Example:
close
Closes an existing path, preventing further modifications.
Example:
Last updated