Skip to content
[~]*-functions.md: update polygon and added iter/map_func() authored by gibbonjoyeux's avatar gibbonjoyeux
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
- [set_text_align](#set_text_align) - [set_text_align](#set_text_align)
- [set_text_wrap](#set_text_wrap) - [set_text_wrap](#set_text_wrap)
- [Other](#other) - [Other](#other)
- [shape](#shape) - [polygon](#polygon)
- [fill](#fill) - [fill](#fill)
- [border](#border) - [border](#border)
- [set_draw_mode](#set_draw_mode) - [set_draw_mode](#set_draw_mode)
...@@ -335,41 +335,41 @@ than the text / paragraph width). ...@@ -335,41 +335,41 @@ than the text / paragraph width).
# Other # Other
## shape ## polygon
```javascript ```javascript
> shape(x, y, radius_x, radius_y, vertices, character); > polygon(x, y, rx, ry, vertices, char_edges);
> shape(x, y, radius_x, radius_y, vertices, character, linked); > polygon(x, y, rx, ry, vertices, char_edges, char_fill);
> shape(x, y, radius_x, radius_y, vertices, character, linked, rotation_offset); > polygon(x, y, rx, ry, vertices, char_edges, char_fill, rotation);
``` ```
Draws a shape on the active layer. The shape is positioned at `x` and `y` passed Draws a polygon on the active layer. The polygon is positioned at `x` and `y`
coordinates. The value of `vertices` defines the number of sides of the shape. passed coordinates. The value of `vertices` defines the number of edges of the
With 3 vertices, the shape would be a **triangle**, with 4, a **square** etc. polygon.
The bigger this value is, the nearer the shape would be to a **circle**. With 3 vertices, the polygon would be a **triangle**, with 4, a **square** etc.
The bigger this value is, the nearer the polygon would be to a **circle**.
`radius_x` and `radius_y` are used to modify the shape width / height ratio. As `rx` and `ry` are used to modify the polygon width / height ratio. As most fonts
most fonts have characters taller than bigger, it is important to make some have characters taller than bigger, it is important to make some tests with your
tests with your font to know which radius would give the shape you want. font to know which radius would give the polygon you want.
`character` is used to draw the shape. `char_edges` is the character used to draw the polygon's edges.
`char_fill` is the character used to fill the polygon. If `char_fill` is not
passed or passed as `null`, only the edges will be drawn.
If `linked` (`true` by default) is set to `false`, sides of the shape will not `rotation` (`0` by default) is a number value (between `0` and `1`) which sets
be drawn. Only the corners will. the polygon rotation offset between 2 corners. Looping from `0` to `1` would
make the polygon rotate continually.
`rotation_offset` (`0` by default) is a number value (between `0` and `1`) which
sets the shape rotation offset between 2 corners. Looping from `0` to `1` would
make the shape rotate continually.
### Parameters: ### Parameters:
- `x` Number: x coordinate of the shape center - `x` Number: x coordinate of the polygon center
- `y` Number: y coordinate of the shape center - `y` Number: y coordinate of the polygon center
- `radius_x` Number: Width of the shape - `rx` Number: Width of the polygon
- `radius_y` Number: Height of the shape - `ry` Number: Height of the polygon
- `vertices` Number: Number of vertices of the shape - `vertices` Number: Number of vertices of the polygon
- `character` Characters (string): Character used to draw the shape - `char_edges` Character (string): Character used to draw the polygon's edges
- `linked` Boolean: If `true`, vertices are drawn. If not, only corners are - `char_fill` Character (string): Character used to fill the polygon
- `rotation_offset` Number: Between `0` and `1`, set the shape angle based on the difference between two corners - `rotation` Number: Between `0` and `1`, set the polygon angle based on the difference between two corners
## fill ## fill
... ...
......