1.1.0 • Published 1 year ago

svg-path-to-polygon-points v1.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

svg-path-to-polygon-points

Build Status

A simple npm module that converts an SVG path string into a polygon points string.

Installation

npm install svg-path-to-polygon-points

Usage

const svgToPolygonPoints = require('svg-path-to-polygon-points');
const path = 'M100,100 L200,200 L300,100';
const points = svgToPolygonPoints(path);
console.log(points);

[{
  x: 100,
  y: 100
}, {
  x: 110,
  y: 110
}, {
  x: 120,
  y: 120
}, {
  x: 130,
  y: 130
}, {
  x: 140,
  y: 140
}, {
  x: 150,
  y: 150
}, {
  x: 160,
  y: 160
}, {
  x: 170,
  y: 170
}, {
  x: 180,
  y: 180
}, {
  x: 190,
  y: 190
}, {
  x: 200,
  y: 200
}, {
  x: 210,
  y: 190
}, {
  x: 220,
  y: 180
}, {
  x: 230,
  y: 170
}, {
  x: 240,
  y: 160
}, {
  x: 250,
  y: 150
}, {
  x: 260,
  y: 140
}, {
  x: 270,
  y: 130
}, {
  x: 280,
  y: 120
}, {
  x: 290,
  y: 110.00000762939453
}]

API

svgToPolygonPoints(path)

Converts an SVG path string into a polygon points string.

Arguments path - The SVG path string to convert. Returns - A polygon points array

Contributing

Contributions are welcome! Please make a PR.

License

This project is licensed under the MIT License.

1.1.0

1 year ago

1.0.15

1 year ago

1.0.14

1 year ago

1.0.13

1 year ago

1.0.12

1 year ago

1.0.11

1 year ago

1.0.10

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago