1
0
Fork 0
freesewing/markdown/dev/reference/macros/mirror/en.md
Joost De Cock b34a2ee2ed feat: Flat import of markdown repo
This is a flat (without history) import of (some of) the content
from our markdown module.

We've imported this without history because the repo contains our
blog posts and showcases posts content prior to porting them to strapi.

Since this contains many images, it would balloon the size of this repo
to import the full history.

Instead, please refer to the history of the (archived) markdown repo
at: https://github.com/freesewing/markdown
2021-08-25 16:09:31 +02:00

42 lines
1.4 KiB
Markdown

---
title: mirror
---
The `mirror` macro allows you to mirror points and/or paths around a mirror line.
It is provided by the [mirror plugin](/reference/plugins/mirror/).
<Example part="plugin_mirror" caption="Example of the mirror plugin" />
```js
points.a = new Point(5,5)
points.b = new Point(45,30)
points.c = new Point(5,30)
points.d = new Point(45,5)
points.mid = new Point(25,15)
paths.a = new Path()
.move(points.a)
.curve(points.b, points.c, points.d)
macro('mirror', {
mirror: [points.b, points.d],
points: [points.mid],
paths: [paths.a]
})
macro('sprinkle', {
snippet: 'notch',
on: ['mid', 'mirroredMid']
})
```
| Property | Default | Type | Description |
|-------------:|------------|------------|-------------|
| `mirror` | | `array` | Array with 2 [Point](/reference/api/point) objects that define the *mirror line* |
| `clone` | `true` | `bool` | Whether to clone mirrored points and or paths |
| `points` | | `array` | An array of [Point](/reference/api/point) objects |
| `paths` | | `array` | An array of [Path](/reference/api/path) objects |
| `prefix` | `mirrored` | `string` | A prefix to apply to the names of the clones points and or paths. Ignored if `nameFormat` is set |
| `nameFormat` | | `function` | A method that receives the name of the path or point and should return the name for the cloned path and or point |