1
0
Fork 0
freesewing/sites/dev/docs/reference/macros/banner
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: banner
---

The `banner` macro allows you to add repeating text along a path.

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

## Signature

```js
macro('banner', {
  String id='banner',
  String className='',
  Number dy=1,
  Number repeat=10,
  Number spaces=12,
  Path path,
  String text,
  Boolean force = false,
})
```
  
## Example

<Example caption="Example of the banner macro">
```js
({ Point, points, Path, paths, macro, part }) => {

  points.from = new Point(0,0)
  points.to = new Point(320,0)
  
  paths.banner = new Path()
    .move(points.from)
    .line(points.to)
    .move(new Point(0,-10)) // Prevent clipping
  
  macro('banner', {
    path: paths.banner,
    text: 'banner',
  })

  return part
}
```
</Example>

## Configuration

| Property     | Default    | Type       | Description |
|-------------:|------------|------------|-------------|
| `className`  | ``         | `string`   | Any additional CSS classes to apply to the text |
| `dy`         | `1`        | `number`   | Controls how far the text will be located above the path |
| `id`         | `banner`   | `string`   | The id of this macro instance |
| `path`       |            | `Path`     | The Path to add the text on |
| `repeat`     | `10`       | `number`   | The number of repetitions |
| `spaces`     | `12`       | `number`   | The number of spaces to place between repetitions |
| `text`       |            | `string`   | The text to place repeat along the path |
| `force`      | `false`    | `boolean`  | Set this to `true` to display the macro output even when `complete` is `false` |

## Notes

Under the hood, this macro will:

- Add `data-text`, `data-text-dy`, and `data-text-class` Attributes to the path to generate the text.

This macro takes the `complete` setting into account and won't output anything when both complete and `force` are `false`.