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