2021-10-17 18:26:00 +02:00
|
|
|
---
|
2022-09-27 18:24:35 +02:00
|
|
|
title: Path.join()
|
2021-10-17 18:26:00 +02:00
|
|
|
---
|
2021-08-25 16:09:31 +02:00
|
|
|
|
2024-02-10 15:40:41 +01:00
|
|
|
The `Path.join()` method joins this path with one or more other paths.
|
|
|
|
|
|
|
|
Any gaps in the path (caused by move operations) will be filled-in with a line.
|
|
|
|
If that's not what you want, you should use
|
|
|
|
[`Path.combine()`](/reference/api/path/combine) instead.
|
2022-09-27 18:24:35 +02:00
|
|
|
|
|
|
|
|
|
|
|
## Signature
|
|
|
|
|
2021-08-25 16:09:31 +02:00
|
|
|
```js
|
|
|
|
Path path.join(path other)
|
|
|
|
```
|
|
|
|
|
2022-09-27 18:24:35 +02:00
|
|
|
## Examples
|
2021-08-25 16:09:31 +02:00
|
|
|
|
2022-09-27 18:24:35 +02:00
|
|
|
<Example caption="Example of the Path.join() method">
|
|
|
|
```js
|
|
|
|
({ Point, points, Path, paths, part }) => {
|
|
|
|
|
2024-02-10 15:40:41 +01:00
|
|
|
points.A1 = new Point(0, 0)
|
|
|
|
points.A2 = new Point(60, 0)
|
|
|
|
points.B1 = new Point(0, 10)
|
|
|
|
points.B2 = new Point(60, 10)
|
|
|
|
points.C1 = new Point(0, 20)
|
|
|
|
points.C2 = new Point(60, 20)
|
2022-12-30 07:47:29 -08:00
|
|
|
|
2022-09-27 18:24:35 +02:00
|
|
|
paths.path1 = new Path()
|
2024-02-10 15:40:41 +01:00
|
|
|
.move(points.A1)
|
|
|
|
.line(points.A2)
|
2022-09-27 18:24:35 +02:00
|
|
|
.setClass("various")
|
2022-12-30 07:47:29 -08:00
|
|
|
|
2022-09-27 18:24:35 +02:00
|
|
|
paths.path2 = new Path()
|
2024-02-10 15:40:41 +01:00
|
|
|
.move(points.B1)
|
|
|
|
.line(points.B2)
|
2022-09-27 18:24:35 +02:00
|
|
|
.setClass("note")
|
2022-12-30 07:47:29 -08:00
|
|
|
|
2024-02-10 15:40:41 +01:00
|
|
|
paths.path3 = new Path()
|
|
|
|
.move(points.C1)
|
|
|
|
.line(points.C2)
|
|
|
|
.setClass("canvas")
|
|
|
|
|
2022-09-27 18:24:35 +02:00
|
|
|
paths.joint = paths.path1
|
2024-02-10 15:40:41 +01:00
|
|
|
.join(paths.path2, paths.path3)
|
2022-09-27 18:24:35 +02:00
|
|
|
.setClass("lining dotted")
|
|
|
|
|
|
|
|
return part
|
|
|
|
}
|
|
|
|
```
|
|
|
|
</Example>
|
2021-08-25 16:09:31 +02:00
|
|
|
|
|
|
|
|
2022-09-27 18:24:35 +02:00
|
|
|
## Notes
|
2021-08-25 16:09:31 +02:00
|
|
|
|
2024-02-10 15:40:41 +01:00
|
|
|
- `Path.join()` is _variadic_, so you can pass multiple paths to join
|
|
|
|
- You cannot join a closed path to another path
|