anthonydugois / polynomic

Advanced utilities to manipulate paths with a functional approach

Home Page:http://anthonydugois.com/polynomic/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Polynomic

A set of advanced utilities to manipulate SVG paths.

Installation

npm install --save polynomic

Basic usage

import Polynomic from "polynomic"

// Parse a pathstring and build a normalized array of points
let path = Polynomic.pathstring.parse("M0 0 L100 0 L100 100 L0 100 z")

// Perform some transforms on the path
path = Polynomic.transforms.rotate(path, Math.PI / 4, "center", "center")
path = Polynomic.transforms.translate(path, 25, 50)

// Get the new pathstring
const pathstring = Polynomic.pathstring.build(path)

// ➜ "M75 29.289L145.711 100L75 170.711L4.289 100z"

Documentation

See the official documentation.

Contributing

Clone the repo:

git clone https://github.com/anthonydugois/polynomic.git

Run tests:

npm test

Run linting:

npm run lint

License

MIT

About

Advanced utilities to manipulate paths with a functional approach

http://anthonydugois.com/polynomic/

License:MIT License


Languages

Language:JavaScript 89.4%Language:CSS 10.6%