2021-10-17 18:26:00 +02:00
---
2021-08-25 16:09:31 +02:00
title: Adding snippets
for: developers
about: Shows you how to add snippets to your pattern
2021-10-17 18:26:00 +02:00
---
2021-08-25 16:09:31 +02:00
2022-02-19 08:04:25 +01:00
After using the [shorthand ](/howtos/code/shorthand/ ) call,
2021-08-25 16:09:31 +02:00
`Snippet` contains the path constructor, while `snippets` is a reference to `part.snippets` ,
which is where you should store your paths.
Things will now *just work* when you do this:
```js
snippets.logo = new Snippet('logo', points.logoAnchor);
```
You can scale and rotate a snippet by setting the `data-scale` and `data-rotate` attributes respectively.
2022-02-19 08:04:25 +01:00
- **data-scale** : Either a single scale factor, or a set of 2 scale factors for the X and Y axis respectively. See [the SVG scale transform ](https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/transform#Scale ) for details.
- **data-rotate** : A rotation in degrees. The center of the rotation will be the snippet's anchor point
2021-08-25 16:09:31 +02:00
< Tip >
2021-08-25 16:16:51 +02:00
See [Using attributes ](/howtos/code/attributes/ ) for details on how to set attributes.
2021-08-25 16:09:31 +02:00
< / Tip >
Below is an example of the available snippets, and the use of the `data-scale` and `data-rotate` attributes:
2022-01-19 12:37:30 +01:00
< Example pattern = "rendertest" options_only = "snippets" >
2022-01-19 11:31:39 +01:00
Overview of available snippets
< / Example >