1
0
Fork 0
freesewing/markdown/dev/reference/api/path/setclass/en.md

43 lines
747 B
Markdown
Raw Normal View History

2022-09-22 09:05:20 +02:00
---
title: Path.setClass()
2022-09-22 09:05:20 +02:00
---
The `Path.setClass()` method sets the CSS class(es) of the path.
## Signature
2022-09-22 09:05:20 +02:00
```js
Path path.setClass(string className)
2022-09-22 09:05:20 +02:00
```
<Tip compact>This method is chainable as it returns the `Path` object</Tip>
## Example
<Example caption="Example of the Path.setClass() method">
```js
({ Point, points, Path, paths, part }) => {
2022-09-22 09:05:20 +02:00
points.from = new Point(5, 10)
points.to = new Point(95, 10)
2022-09-22 09:05:20 +02:00
paths.line = new Path()
.move(points.from)
.line(points.to)
.setClass('note dashed')
2022-09-22 09:05:20 +02:00
return part
}
```
2022-09-22 09:05:20 +02:00
</Example>
## Notes
The main purpose of this method is to save your some typing,
as the two following calls yield the same result:
2022-09-22 09:05:20 +02:00
```js
path.attr('class', 'fabric', true)
path.setClass('fabric')
2022-09-22 09:05:20 +02:00
```