Apply <svg id="mySVG" ...> ?

14 views
Skip to first unread message

Michael Sartore

unread,
Feb 27, 2021, 9:56:00 PMFeb 27
to Paper.js
Hi,
In exporting svg's I've found how to apply id's to my groups (layer.name) and paths, yet can't figure out what to do to simply give the exported svg tag itself an I'd that I can refer to as an element. 
I tried paper.project.name = 'mySVG';
no dice.
Any knowledge on how to achieve this?
Thanks!

asensi...@gmail.com

unread,
Mar 2, 2021, 1:23:42 AMMar 2
to Paper.js
Hi,
You should use the item `name` property for that.
Here is a sketch demonstrating it.

const item = new Path.Circle({
    center: view.center,
    radius: 50,
    fillColor: 'orange',
    name: 'myCircle'
});

const svg = item.exportSVG({ asString: true });

console.log(svg);
Reply all
Reply to author
Forward
0 new messages