1
0
Fork 0
freesewing/sites/dev/docs/reference/macros/sprinkle
Joost De Cock ab3204f9f1 chore: Port FreeSewing.dev to docusaurus
The replaces the NextJS site powering FreeSewing.dev with a Docusaurus
setup. It's part of my efforts to simplify FreeSewing's setup so we can
focus on our core value proposition.
2024-09-28 13:13:48 +02:00
..
readme.mdx chore: Port FreeSewing.dev to docusaurus 2024-09-28 13:13:48 +02:00

---
title: sprinkle
---

The `sprinkle` macro facilitates adding snippets to your pattern in bulk.

It is provided by [plugin-sprinkle](/reference/plugins/sprinkle), which is
part of [core-plugins](/reference/plugins/core) (so it is available by default).

## Signature

```js
macro('sprinkle', {
  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(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 |