dom-to-points library

by albinotonnina

HTML

<div id="drawing"></div>

JavaScript

// THIS IS SOMETHING YOU COULD DO WITH THE OUTPuT OF dom-to-points
// https://github.com/albinotonnina/dom-to-points

const pointsIGotWithDomToPoints = '0,0 300,0 300,100 0,100 0,100 200,100 200,200 0,200 0,200 200,200 200,300 0,300 0,300 300,300 300,400 0,400 0,400 0,300 0,300 0,200 0,200 0,100 0,100 0,0'

const draw = SVG('drawing').size(1000, 600)

var polygon = draw.polygon(pointsIGotWithDomToPoints).fill('#f06')