1
0
Fork 0

chore(markdown): Work on macro reference docs

This commit is contained in:
Joost De Cock 2022-09-30 04:39:30 +02:00
parent 403f0c45c2
commit cfef146fd3
13 changed files with 416 additions and 129 deletions

View file

@ -5,17 +5,48 @@ title: sprinkle
The `sprinkle` macro facilitates adding snippets to your pattern in bulk.
It is by the [sprinkle plugin](/reference/plugins/sprinkle).
<Example part="plugin_sprinkle">
Example of button snippets sprinkled on a pattern by this macro
</Example>
## Signature
```js
macro('sprinkle', {
snippet: 'button',
on: ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i']
Array on,
Number scale,
Snippet snippet,
Number rotation,
})
```
## Example
<Example caption="An example of the sprinkle macro">
```js
({ Point, points, Path, paths, macro, part }) => {
points.a = new Point(0,0)
points.b = new Point(10,5)
points.c = new Point(20,0)
points.d = new Point(30,5)
points.e = new Point(40,0)
points.f = new Point(50,5)
points.g = new Point(60,0)
macro('sprinkle', {
snippet: 'button',
on: ['a', 'b', 'c', 'd', 'e', 'f', 'g']
})
// Prevent clipping
paths.diag = new Path()
.move(points.a)
.move(points.g)
return part
}
```
</Example>
## Configuration
| Property | Default | Type | Description |
|------------:|---------|------------------|-------------|
| `snippet` | | String | Name of the snippet to sprinkle |