1.4 KiB
1.4 KiB
title |
---|
sprinkle |
The sprinkle
macro facilitates adding snippets to your pattern in bulk.
It is provided by plugin-sprinkle, which is part of core-plugins (so it is available by default).
Signature
macro('sprinkle', {
Array on,
Number scale,
Snippet snippet,
Number rotation,
})
Example
```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(new Point(points.g.x, points.g.y + 5))
return part }
</Example>
## Configuration
| Property | Default | Type | Description |
|------------:|---------|------------------|-------------|
| `snippet` | | String | Name of the Snippet to sprinkle |
| `on` | `[]` | Array of strings | Array of pointnames, the names of Points in the `points` array to add the Snippets on |
| `scale` | 1 | number | Scale for the individual Snippets |
| `rotate` | 0 | number | Rotation for the individual Snippets |