1.0.0 • Published 5 years ago

svg.pathmod.js v1.0.0

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

svg.pathmod.js

A plugin for the svgdotjs.github.io library to modify SVG paths. The core of this plugin is based on simplify-js (c) 2017, Vladimir Agafonkin

Demo

If you don't see image below look at this page on https://janmisker.github.io/svg.pathmod.js/, because inline SVG might be disabled.

Quickest to just show it. First image is a path with 133 points, for example drawn by user. Second image is the simplified version of that path.

var svg = SVG().addTo('#drawing').size(100,100)
var path = svg.path(....) // create a path
path.simplify(1, true)

The simplified version has only 16 points, making it much more lightweight, and it also looks better. There are of course parameters, for example using a tolerance of 5 and not employing the radial distance algorithm this is the result:

path.simplify(5, false)

Get Started

ToDo publish to npm

Licence

svg.pathmod.js is licensed under the terms of the MIT License.

Dependencies

This module requires svg.js >= v3.0.12