2021-10-17 18:26:00 +02:00
|
|
|
---
|
2021-08-25 16:09:31 +02:00
|
|
|
title: Path
|
2021-10-17 18:26:00 +02:00
|
|
|
---
|
2021-08-25 16:09:31 +02:00
|
|
|
|
2022-09-29 17:50:53 +02:00
|
|
|
A path represents an SVG path, which are the lines and curves on our pattern.
|
2021-08-25 16:09:31 +02:00
|
|
|
|
2022-09-29 17:50:53 +02:00
|
|
|
## Signature
|
2021-08-25 16:09:31 +02:00
|
|
|
|
|
|
|
```js
|
2022-09-29 17:50:53 +02:00
|
|
|
Path new Path()
|
2021-08-25 16:09:31 +02:00
|
|
|
```
|
|
|
|
|
2022-09-29 17:50:53 +02:00
|
|
|
The Path constructor takes no arguments.
|
|
|
|
|
2022-12-14 21:24:28 -08:00
|
|
|
## Properties
|
2022-09-29 17:50:53 +02:00
|
|
|
|
2021-08-25 16:09:31 +02:00
|
|
|
A Path objects comes with the following properties:
|
|
|
|
|
2022-09-27 18:24:35 +02:00
|
|
|
- `attributes` : An [Attributes](/reference/api/attributes) instance holding
|
|
|
|
the path's attributes
|
|
|
|
- `hidden` : When this is `true` the path will be hidden (excluded it from the
|
|
|
|
output). See [Path.hide()](/reference/api/path/hide),
|
|
|
|
[Path.unhide()](/reference/api/path/unhide), and
|
|
|
|
[Path.setHidden()](/reference/api/path/sethidden) for various methods that
|
|
|
|
allow setting this in a chainable way.
|
2021-08-25 16:09:31 +02:00
|
|
|
|
2022-12-14 21:24:28 -08:00
|
|
|
<Related>
|
|
|
|
See [Using Attributes](/howtos/code/attributes)
|
|
|
|
for information about custom Attributes that can be used with Paths.
|
|
|
|
</Related>
|
2022-09-29 17:50:53 +02:00
|
|
|
## Example
|
|
|
|
|
|
|
|
<Example caption="Example of the Path contructor">
|
|
|
|
```js
|
|
|
|
({ Point, points, Path, paths, part }) => {
|
|
|
|
|
|
|
|
paths.example = new Path()
|
|
|
|
.move(new Point(0,0))
|
|
|
|
.line(new Point(100,0))
|
|
|
|
|
|
|
|
return part
|
|
|
|
}
|
|
|
|
```
|
|
|
|
</Example>
|
|
|
|
|
|
|
|
## Methods
|
|
|
|
|
|
|
|
A Path object exposes the following methods:
|
2021-08-25 16:09:31 +02:00
|
|
|
|
|
|
|
<ReadMore list />
|