svg-polygon-center
v1.0.2
Published
Return the center for a given SVG polygon points
Downloads
237
Readme
svg-polygon-center
Return the center for a given SVG polygon points.
Install
npm install --save svg-polygon-center
or
yarn add svg-polygon-center
Usage
var center = require('svg-polygon-center');
// or
import center from 'svg-polygon-center';
var points = polygon.getAttribute('points');
// e.g. "28,224 256,224 256,352 128,352"
var center = center(points);
// e.g. { x: 192, y: 288 }
License
MIT © Diego Jara