1
0
Fork 0
freesewing/markdown/dev/reference/macros/sprinkle/en.md
2022-12-09 20:59:53 -08:00

1.5 KiB

title
sprinkle

The sprinkle macro facilitates adding snippets to your pattern in bulk. It is provided by the sprinkle plugin.

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 |

## Result

| Generated Element | Description |
|-------------------|-------------|
| `snippets.${pointname}-${snippet}` | The Snippet(s) created |