2021-10-17 17:34:55 +02:00
|
|
|
***
|
|
|
|
|
|
|
|
## title: clone()
|
2021-08-25 16:09:31 +02:00
|
|
|
|
|
|
|
```js
|
|
|
|
Snippet snippet.clone()
|
|
|
|
```
|
|
|
|
|
|
|
|
Returns a new Snippets object that is a deep copy of this one.
|
|
|
|
|
|
|
|
<Example
|
2021-10-17 17:34:55 +02:00
|
|
|
part="snippet_clone"
|
|
|
|
caption="An example of the Snippet.clone() method"
|
2021-08-25 16:09:31 +02:00
|
|
|
/>
|
|
|
|
|
|
|
|
```js
|
|
|
|
let { Point, points, Snippet, snippets } = part.shorthand();
|
|
|
|
|
|
|
|
points.anchor = new Point(35, 35);
|
|
|
|
snippets.demo = new Snippet("logo", points.anchor)
|
|
|
|
.attr("style", "color: #f006");
|
|
|
|
|
|
|
|
snippets.clone = snippets.demo
|
|
|
|
.clone()
|
|
|
|
.attr("data-scale", 0.5);
|
|
|
|
```
|